padawan-php / padawan.vim

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

`Error occured, code: 255` when calling `PadawanGenerateIndex` #15

Open cprn opened 8 years ago

cprn commented 8 years ago

I just installed padawan server and plugin. Running :PadawanGenerateIndex in root of composer project returns Error occured, code: 255. My home dir .composer/vendor/bin is in $PATH, I run neovim on Ubuntu GNOME 16.04 (up to date) and successfully called sudo pecl install event-2.0.4.tgz (which should provide ext-event). What else can I do? How do I debug this?

mkusher commented 8 years ago

Can you run: :! echo $PATH in neovim and check whether composer's bin in there?

cprn commented 8 years ago

Yes, it is in the $PATH - both :echo $PATH and :!echo $PATH.

mkusher commented 8 years ago

@cprn can you manually run $ padawan generate in the project root?

bezhermoso commented 8 years ago

I am also running into this issue, and can verify that Composer's bin directory is on my path.

padawan generate works.

python << endpython
import vim
from padawan import client
filepath = vim.eval("expand('%:p')")
client.Generate(filepath)
endpython

...works

cprn commented 8 years ago

When I open empty buffer in a project directory and call :PadawanGenerateIndex error 255 occurs but it works if I open any path or window, i.e.:

COMMAND ACTIONS RESULT
vim :PadawanGenerateIndex Error 255
vim . :PadawanGenerateIndex Success
vim file.php :PadawanGenerateIndex Success
vim :Explore :PadawanGenerateIndex Success
vim :NERDTreeToggle :PadawanGenerateIndex Success

Tiny detail: I use nvim but that shouldn't matter, should it?

mkusher commented 8 years ago

hm. It looks like the issue occurs when there is now file in a buffer

iwyg commented 8 years ago

I can confirm that error. With no buffer loaded, I get error 255.

greg0ire commented 8 years ago

IMO, the problem comes from this line % refers to the current file, which is not defined when you use vim without any argument. So the question is : how to get the current working directory when no file is opened?

mkusher commented 8 years ago

@greg0ire :pwd should work, so we just need to add check whether current file is specified. If not than use :pwd else report error. I think this will solve the issue

greg0ire commented 8 years ago

Why not use :pwd all the time?

cprn commented 8 years ago

In regards to using :pwd all the time... Doesn't it force the user to always start vim in project directory?

:pwd
/home/cprn/
:vsp tmp/foobar.txt   " opens buffer with file in different working directory
:pwd
/home/cprn/           " even though I'm in a buffer with different directory
mkusher commented 8 years ago

or do :cd if you're switching projects

cprn commented 8 years ago

Okay... Then I find it sensible to always use :pwd assuming you display correct error message instead of just 255 when current :pwd isn't the project root. Alternatively in such case you can interactively ask the user where the project root is but I think it would be an overkill, :cd should be enough.