dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.56k stars 1.44k forks source link

Can't get php-language-server working #1773

Closed deevus closed 5 years ago

deevus commented 6 years ago

I've installed the https://github.com/roxma/LanguageServer-php-neovim plugin and set these variables:

let g:ale_php_langserver_use_global = 1
let g:ale_php_langserver_executable = globpath(&rtp,'vendor/felixfbecker/language-server/bin/php-language-server.php',1)
let g:ale_completion_enabled = 1

When opening a php file I get the following error

continuing in function <SNR>244_NeoVimCallback[4]..ale#util#JoinNeovimOutput[2]..<SNR>245_HandleCommandMessage[3]..ale#lsp#HandleMessage[20]..ale#lsp_linter#HandleLSPResponse[5]..<SNR>240_HandleLSPErrorMessage

Error detected while processing function <SNR>244_NeoVimCallback[4]..ale#util#JoinNeovimOutput[2]..<SNR>245_HandleCommandMessage[3]..ale#lsp#HandleMessage[20]..ale#lsp_linter#HandleLSPResponse[5]..<SNR>240_HandleLSPErrorMessage[9]..ale#lsp#response#GetErrorMessage:
line   24:
E712: Argument of get() must be a List or Dictionary

I'm pretty sure I'm missing something. Would love some help

deevus commented 6 years ago

I've checked to see what processes are running and I can't see php-language-server in there. I can see that phpcs runs fine.

Luxed commented 6 years ago

Hey deevus, The plugin you've installed seems to be an extension of the LanguageClien-neovim plugin, not ALE. I'll test this and come back to you with the result of my tests

deevus commented 6 years ago

Thank you. I haven't installed the base plugin.

I had trouble installing php-language-server globally (due to dependency conflicts), and I didn't want to install it as part of projects where I'd be the only user of it.

I figured this plugin should work since all it does is bring php-language-server with it and I could configure ALE to use it.

I appreciate your help with this. I'm still searching for the best php experience in vim.

w0rp commented 6 years ago

Have a look at :ALEInfo at see what it's trying to run.

Luxed commented 6 years ago

@deevus I may have found the issue: I expected the issue to come from the language server itself, I was right. Please update your ALE plugin to the latest version and then run this command: composer run-script --working-dir=vendor/felixfbecker/language-server parse-stubs.

This is how I successfully installed the program by the way (without using the vim plugin) (I wasn't able to install it either): You need to modify (or create) your user's ~/composer.json file to contain this:

{
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "felixbecker/language-server": "^5.4"
    }
}

Then you can require it with composer to install it for your user. And then you run the command given above.

rawaludin commented 6 years ago

@Luxed Can you share your ale config to make it work with php-langserver? I finished installing felixbecker/language-server on global. But don't know where to go next.

Thanks.

Luxed commented 6 years ago

@rawaludin I unfortunately had to reformat my laptop, so I lost the tests I made. But, you can still do :h ale-php-languageserver to get the information on the 2 lines needed for the config to work on a global installation :p

w0rp commented 5 years ago

The GitHub issue template now recommends asking for help with configuring ALE on Stack Exchange or Reddit instead.

deevus commented 5 years ago

Np thanks @w0rp

w0rp commented 5 years ago

I also set up a Gitter, which is just about ready now, so people can talk on there too.