padawan-php / padawan.vim

A vim plugin for padawan.php completion server
MIT License
78 stars 6 forks source link

No Autocomplete in padawan server #22

Open Kedra opened 7 years ago

Kedra commented 7 years ago

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 commented 7 years ago

hi @Kedra,

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

Kedra commented 7 years ago

v0.2.1

as used composer global info

mkusher commented 7 years ago

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

Kedra commented 7 years ago

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 commented 7 years ago

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

Kedra commented 7 years ago

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 commented 7 years ago

@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?

Kedra commented 7 years ago

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

mkusher commented 7 years ago

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? :scream: :scream: :scream:

Kedra commented 7 years ago

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 commented 7 years ago

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

mkusher commented 7 years ago

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

Kedra commented 7 years ago

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

mkusher commented 7 years ago

@Kedra it is in your vim configuration(compilation)

Kedra commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

Kedra commented 7 years ago

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

mkusher commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

@Kedra and you saw php contents in ncat?

Kedra commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

Thanks, I'll just switch to Linux to ease my workflow problem :+1: