Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Autocomplete in padawan server #22

Open
Kedra opened this issue Aug 7, 2016 · 27 comments
Open

No Autocomplete in padawan server #22

Kedra opened this issue Aug 7, 2016 · 27 comments

Comments

@Kedra
Copy link

Kedra commented Aug 7, 2016

So I tried removing the symfony component and auto-completing with vim it doesn't show any matchings with either using , ->, :: . I used YouCompleteMe in this case but somehow even with it, no results are found; even renamed new ycm triggers too (Windows x64):

`let g:ycm_semantic_triggers = {
\ 'c' : ['->', '.'],

\ 'ocaml' : ['.', '#'],

\ 'cpp,objcpp' : ['->', '.', '::'],

\ 'perl' : ['->'],

\ 'php' : ['->', '::', '(', 'use ', 'namespace ', ''],

\ 'cs,java,javascript,typescript,d,python,perl6,scala,vb,elixir,go' : ['.'],

\ 'ruby' : ['.', '::'],

\ 'lua' : ['.', ':'],

\ 'erlang' : [':'],

\ }`

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

hi @Kedra,

can you show which version of padawan.php is installed?

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

v0.2.1

as used composer global info

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

@Kedra are there any messages in vim(:messages)?

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

So I tried saving a file, issue a command and then :messages to scroll to the bottom,
here is the output:

"routes.php" [unix] 35L, 722C written

Error occurred Could not define empty line context

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

hm, can you try to issue completion after -> on some object?

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

so I instantiate an object:

$user = new User();

and issued a completion on it

$user->// <c-x><c-o>

nothing completion appeared nor a message while editing also

but using :messages gives me the same error:

Error occurred Could not define empty line context

I'm using a laravel project with a .padawan folder beside its contents e.g app/, vendor/, etc.

Was I doing a wrong generation of index when I done it on the root folder?

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

@Kedra I think the problem is not with the index generation, but with vim plugin. It sends wrong column to padawan I guess. Can you try disabling all other plugins and issue completion one more time?

@mkusher mkusher added the bug label Aug 7, 2016
@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

After disabling every plugin except padawan.vim plugin,
Omnicompletion returned a pattern not found.

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

omg, that's weird. Could you try different cases, like issue completion after $, after use? And did it work before? And have you got latest version of padawan.vim? 😱 😱 😱

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

So without with other plugins, the two cases did returned also a Pattern not found messages

then enabled all plugins and used use and $ for completion and it returned nothing and had the same error messages also for :messages; also changed omnifunc=padawan#Complete

I am using two versions of x64 Python interpreters (3.5.2 and 2.7.12) for windows to specify since there's a *.py file in the plugin folder of padawan.vim

should I include vimrc too?

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

I did update again with the latest version of padawan.vim and it still gets errors somehow.

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

@Kedra could you try both versions of python? Vim plugin is written with python, so this could be the problem...

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

which file/lines or how do I change the python version on the server initialization? (I might say it wrong)

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

@Kedra it is in your vim configuration(compilation)

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

so I interchange between user path environment between python 2.7 and python 3.5
and it still returns errors too

server logs:
[2016-08-07 10:09:43] completer.DEBUG: Cache status: active [] []
[2016-08-07 10:09:43] completer.ERROR: Parsing failed in file \app\Http\Controllers``\UserController.php [] []
[2016-08-07 10:09:43] completer.DEBUG: Processing nodes 0 [] []
[2016-08-07 10:09:43] completer.DEBUG: Cache status: active [] []
[2016-08-07 10:09:43] completer.ERROR: Parsing failed in file \app\Http\Controllers``\UserController.php [] []
[2016-08-07 10:09:43] completer.DEBUG: 0.05243706703186 seconds for ast processing [] []
Could not define empty line contextResponse time: 0.052817106246948

EDIT: using Vim in 64bit since 32bit doesn't support python+
EDITT: I tried using python3 support in linux and padawan.vim doesn't work with python3 support only
while python2 works normal; same with Windows.

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

looks like it only has issues with Windows (Vim with both python2/python3), my Linux test was doing actually fine using vim-nox-py2 in terminal.

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

@Kedra maybe the problem is connected to windows path names?

@Kedra
Copy link
Author

Kedra commented Aug 7, 2016

I'll try to resolve it on next week, really wanted to make it work.

@mkusher
Copy link
Member

mkusher commented Aug 7, 2016

@Kedra thank you, post here any info you'll get. I'm thinking that the problem is not with padawan.vim, but with padawan.php... You can try to log requests that vim sends to padawan by running something like netcat on 15155 port

@Kedra
Copy link
Author

Kedra commented Aug 8, 2016

I used ncat for Win10

Here's my test method and results:
ncat.exe -l -p 15155 << I run this and made a autocompletion with ->, ::, use and namespace
It returns this (I took the return values from the cmd and used a url decoder to make it readable):

POST` /complete?column=10&path=C:\Users\kedra\Code\socialnetwork&line=33&filepath=\app\Http\Controllers\UserController.php HTTP/1.1
Accept-Encoding: identity
Content-Length: 1793
Host: localhost:15155
Content-Type: application/x-www-form-urlencoded
Connection: close
User-Agent: Python-urllib/2.7

@mkusher
Copy link
Member

mkusher commented Aug 8, 2016

@Kedra are the line and column right? And is path to file ok? And one more thing: after this first part(after User-Agent) there should be file contents

@Kedra
Copy link
Author

Kedra commented Aug 8, 2016

Yes, issued autocompletion in $user-><< here . Path is okay; in the root folder of the composer project (laravel). Oh and forgot about the contents. Here it is:

<?php

namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Http\Requests;

class UserController extends Controller
{
    public function getDashboard() {
        return view('dashboard');
    }

    public function postSignUp(Request $request) {

        $this->validate($request, [
            'email' => 'required|email|unique:users',
            'first_name' => 'required|max:120',
            'password' => 'required|min:4'
        ]);

        $email = $request["email"];
        $first_name = $request["first_name"];
        $password = bcrypt($request['password']);

        $user = new User();
        $user->email = $email;
        $user->first_name = $first_name;
        $user->password = $password;
        $user->save();
        $user->

        Auth::login($user);

        return redirect()->route('dashboard');
    }

    public function postSignIn(Request $request) {

        $this->validate($request, [
            'email' => 'required|email|unique:users',
            'password' => 'required|min:4'
        ]);

        if (Auth::attempt(['email' => $request['email'], 'password' => $request['password']])) {
            return redirect()->route('dashboard');
        } else {
            return redirect()->back();
        }
    }
}

@mkusher
Copy link
Member

mkusher commented Aug 8, 2016

@Kedra and you saw php contents in ncat?

@Kedra
Copy link
Author

Kedra commented Aug 8, 2016

actually the overall output was url encoded like this:

POST%60+%2fcomplete%3fcolumn%3d10%26path%3dC%3a%5cUsers%5ckedra%5cCode%5csocialnetwork%26line%3d33%26filepath%3d%5capp%5cHttp%5cControllers%5cUserController.php+HTTP%2f1.1%0d%0aAccept-Encoding%3a+identity%0d%0aContent-Length%3a+1793%0d%0aHost%3a+localhost%3a15155%0d%0aContent-Type%3a+application%2fx-www-form-urlencoded%0d%0aConnection%3a+close%0d%0aUser-Agent%3a+Python-urllib%2f2.7%0d%0a%0d%0a%3c%3fphp%0d%0a%0d%0anamespace+App%5cHttp%5cControllers%3b%0d%0a%0d%0ause+App%5cUser%3b%0d%0ause+Illuminate%5cHttp%5cRequest%3b%0d%0ause+Illuminate%5cSupport%5cFacades%5cAuth%3b%0d%0ause+App%5cHttp%5cRequests%3b%0d%0a%0d%0aclass+UserController+extends+Controller%0d%0a%7b%0d%0a++++public+function+getDashboard()+%7b%0d%0a++++++++return+view(%27dashboard%27)%3b%0d%0a++++%7d%0d%0a%0d%0a++++public+function+postSignUp(Request+%24request)+%7b%0d%0a%0d%0a++++++++%24this-%3evalidate(%24request%2c+%5b%0d%0a++++++++++++%27email%27+%3d%3e+%27required%7cemail%7cunique%3ausers%27%2c%0d%0a++++++++++++%27first_name%27+%3d%3e+%27required%7cmax%3a120%27%2c%0d%0a++++++++++++%27password%27+%3d%3e+%27required%7cmin%3a4%27%0d%0a++++++++%5d)%3b%0d%0a%0d%0a++++++++%24email+%3d+%24request%5b%22email%22%5d%3b%0d%0a++++++++%24first_name+%3d+%24request%5b%22first_name%22%5d%3b%0d%0a++++++++%24password+%3d+bcrypt(%24request%5b%27password%27%5d)%3b%0d%0a%0d%0a++++++++%24user+%3d+new+User()%3b%0d%0a++++++++%24user-%3eemail+%3d+%24email%3b%0d%0a++++++++%24user-%3efirst_name+%3d+%24first_name%3b%0d%0a++++++++%24user-%3epassword+%3d+%24password%3b%0d%0a++++++++%24user-%3esave()%3b%0d%0a++++++++%24user-%3e%0d%0a%0d%0a++++++++Auth%3a%3alogin(%24user)%3b%0d%0a%0d%0a++++++++return+redirect()-%3eroute(%27dashboard%27)%3b%0d%0a++++%7d%0d%0a%0d%0a++++public+function+postSignIn(Request+%24request)+%7b%0d%0a%0d%0a++++++++%24this-%3evalidate(%24request%2c+%5b%0d%0a++++++++++++%27email%27+%3d%3e+%27required%7cemail%7cunique%3ausers%27%2c%0d%0a++++++++++++%27password%27+%3d%3e+%27required%7cmin%3a4%27%0d%0a++++++++%5d)%3b%0d%0a%0d%0a++++++++if+(Auth%3a%3aattempt(%5b%27email%27+%3d%3e+%24request%5b%27email%27%5d%2c+%27password%27+%3d%3e+++%24request%5b%27password%27%5d%5d))+%7b%0d%0a++++++++++++return+redirect()-%3eroute(%27dashboard%27)%3b%0d%0a++++++++%7d+else+%7b%0d%0a++++++++++++return+redirect()-%3eback()%3b%0d%0a++++++++%7d%0d%0a++++%7d%0d%0a%7d

@Kedra
Copy link
Author

Kedra commented Aug 8, 2016

I just decoded it to make it more readable for this issue.
EDIT: only the php contents are url encoded, had to correct myself.

@mkusher
Copy link
Member

mkusher commented Aug 8, 2016

@Kedra yep, that looks correct. So, looks like the issue is in the padawan.php, no padawan.vim. Sorry, I have no windows os to test :(

@Kedra
Copy link
Author

Kedra commented Aug 9, 2016

Thanks, I'll just switch to Linux to ease my workflow problem 👍

@mkusher mkusher added the Windows label Aug 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants