autozimu / LanguageClient-neovim

Language Server Protocol (LSP) support for vim and neovim.
MIT License
3.55k stars 274 forks source link

pluggable language server and auto discover #11

Closed roxma closed 7 years ago

roxma commented 7 years ago

I think setup language server manually and then update g:LanguageClient_serverCommands is kind of tedious, is there a way to do that automatically?

FYI, I wrote an experimental language server plugin that works with NCM, https://github.com/roxma/nvim-cm-php-language-server, backed by php-language-server. The installation is simple:

Plug 'roxma/nvim-cm-php-language-server',  {'do': 'composer install && composer run-script parse-stubs'}
autozimu commented 7 years ago

I agree the current setup process is not streamlined.

The main problem is that, different language have different toolchains and ecosystems, like python has pypi/pip, js has npm and yarn. It is almost impossible to cover all cases.

Besides, many language server are still actively developed. Like python's and js's, they are not available on PyPi or npmjs yet.

I felt it is more appropriate to left the language server installion process to the user as he is one most famililar with the lanuage that needs support, e.g., I don't use ocaml, as plugin author, I don't want to learn how to setup its dev env, and as plugin user, I don't want to have ocaml toolchain or language server installed for me automatically.

On Fri, Feb 24, 2017 at 00:40 rox notifications@github.com wrote:

I think setup language server manually and then update g:LanguageClient_serverCommands is kind of tedious, is there a way to do that automatically?

FYI, I wrote an experimental language server plugin that works with NCM, https://github.com/roxma/nvim-cm-php-language-server, backed by php-language-server https://github.com/felixfbecker/php-language-server. The installation is simple:

Plug 'roxma/nvim-cm-php-language-server', {'do': 'composer install && composer run-script parse-stubs'}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/autozimu/LanguageClient-neovim/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYt7wArwBCUdydz4Rf__NonqbsPJiHeks5rfm1MgaJpZM4MK2MY .

autozimu commented 7 years ago

Also, there might be multiple language server implementation for one language, for example, python. In which case, the current one time manual explicit way of declaration in init.vim is more flexible.

roxma commented 7 years ago

I mean, it would still be nice to have an api like LanguageClient#register_server()

Then a language server plugin package could register it self, instead of letting the user tweak the definition of global dictionary g:LanguageClient_serverCommands, which could be terrible for users like me working on different machines and systems, and may need to handle different installation paths.

A language server plugin could have a small plugin.vim that register itself, and handle the relative path expansion nicely.

let s:path = globpath(&rtp,'some_server/bin/server')
call LanguageClient#register_server(['some cmd',s:path])

Then the install for a vim user could be as easily as:

Plug 'some_server',  {'do': 'npm, composer install, or whatever'}
autozimu commented 7 years ago

Ok, I see what you mean. It is definitely possible.

On Fri, Feb 24, 2017 at 08:55 rox notifications@github.com wrote:

I mean, it would still be nice to have an api like LanguageClient#register_server()

Then a language server plugin package could register it self, instead of letting the user tweak the definition of global dictionary g:LanguageClient_serverCommands, which could be terrible for users like me working on different machines and systems, and may need to handle different installation paths.

A language server plugin could have a small plugin.vim that register itself, and handle the relative path expansion nicely.

let s:path = globpath(&rtp,'some_server/bin/server')call LanguageClient#register_server(['some cmd',s:path])

Then the install for a vim user could be as easily as:

Plug 'some_server', {'do': 'npm, composer install, or whatever'}

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/autozimu/LanguageClient-neovim/issues/11#issuecomment-282296464, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYt75smjL7cgobuWKP8fc_xZ0t1xBjhks5rfuE5gaJpZM4MK2MY .