Open przepompownia opened 4 years ago
It not support to pass initializationOptions
in command line by now, you should config the LSP client to send initializationOptions
config in the initialize
request to the LSP.
I am still unfamiliar also with many basics of the LSP protocol. Having the request name, I grepped it within LanguageClient-neovim sources and found the answer:
2.12 g:LanguageClient_settingsPath *g:LanguageClient_settingsPath*
Path for language server settings. If not an absolute path this is relative
to the workspace directory.
Example settings file content: >
{
"rust.clippy_preference": "on"
}
Default: ".vim/settings.json"
Maybe it is worth mentioning explicitly in the documentation (as well as hints for some other popular clients).
Thanks for the answer containing the crucial request name.
The option initializationOptions
is already mention in the readme.
PS. I don't use the other LSP client so i don't know how they config. PR is welcome.
Yes, this examples are helpful, but only partially in my case. Probably it contains the part that is sent with the initial request and some of contents outside this part that are specific to, maybe, coc.nvim.
Using logs from the client I see that the full long runtimepath
appears in logs
{
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"capabilities": {
"textDocument": {
"colorProvider": null,
"completion": {
"completionItem": {
"snippetSupport": false
}
},
"declaration": {
"linkSupport": true
},
"definition": {
"linkSupport": true
},
"implementation": {
"linkSupport": true
},
"publishDiagnostics": {
"relatedInformation": true
},
"signatureHelp": {
"signatureInformation": {
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"typeDefinition": {
"linkSupport": true
}
},
"workspace": {
"applyEdit": true,
"didChangeWatchedFiles": {
"dynamicRegistration": true
}
}
},
"initializationOptions": {
"diagnostic": {
"enable": true
},
"indexes": {
"count": 3,
"gap": 100,
"runtimepath": true
},
"iskeyword": "@,48-57,_,192-255,#",
"runtimepath": "/home/______/.config/nvim,/home/______/.config/nvim/bundle/LanguageClient-neovim,/home/______/.config/nvim/bundle/PHP-Indenting-for-VIm,/home/______/.config/nvim/bundle/ale,/home/______/.config/nvim/bundle/______,/home/______/.config/nvim/bundle/auto-pairs,/home/______/.config/nvim/bundle/bufexplorer,/home/______/.config/nvim/bundle/ctrlp.vim,/home/______/.config/nvim/bundle/deoplete-phpactor,/home/______/.config/nvim/bundle/deoplete.nvim,/home/______/.config/nvim/bundle/fugitive,/home/______/.config/nvim/bundle/fzf.vim,/home/______/.config/nvim/bundle/luciusColorscheme,/home/______/.config/nvim/bundle/neopairs.vim,/home/______/.config/nvim/bundle/nerdtree,/home/______/.config/nvim/bundle/nginx.vim,/home/______/.config/nvim/bundle/phpactor,/home/______/.config/nvim/bundle/snippets,/home/______/.config/nvim/bundle/surround,/home/______/.config/nvim/bundle/tabname,/home/______/.config/nvim/bundle/tail-bundle,/home/______/.config/nvim/bundle/tmux.vim,/home/______/.config/nvim/bundle/ultisnips,/home/______/.config/nvim/bundle/vdebug,/home/______/.config/nvim/bundle/vim-airline,/home/______/.config/nvim/bundle/vim-airline-themes,/home/______/.config/nvim/bundle/vim-commentary,/home/______/.config/nvim/bundle/vim-dispatch,/home/______/.config/nvim/bundle/vim-gitgutter,/home/______/.config/nvim/bundle/vim-javascript,/home/______/.config/nvim/bundle/vim-markdown,/home/______/.config/nvim/bundle/vim-markdown-folding,/home/______/.config/nvim/bundle/vim-move,/home/______/.config/nvim/bundle/vim-pasta,/home/______/.config/nvim/bundle/vim-pathogen,/home/______/.config/nvim/bundle/vim-repeat,/home/______/.config/nvim/bundle/vim-rhubarb,/home/______/.config/nvim/bundle/vim-spacejam,/home/______/.config/nvim/bundle/vim-test,/home/______/.config/nvim/bundle/vim-tmux-focus-events,/home/______/.config/nvim/bundle/vim-toml,/home/______/.config/nvim/bundle/vim-twig,/home/______/.config/nvim/bundle/vim-unimpaired,/etc/xdg/nvim,/home/______/.local/share/nvim/site,/usr/local/share/nvim/site,/usr/share/nvim/site,/usr/share/nvim/runtime,/usr/share/nvim/runtime/pack/dist/opt/matchit,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,/home/______/.local/share/nvim/site/after,/etc/xdg/nvim/after,/home/______/.config/nvim/bundle/vim-markdown-folding/after,/home/______/.config/nvim/bundle/vim-javascript/after,/home/______/.config/nvim/bundle/ultisnips/after,/home/______/.config/nvim/bundle/______/after,/home/______/.config/nvim/after,/usr/share/doc/fzf/examples",
"suggest": {
"fromRuntimepath": true,
"fromVimruntime": true
},
"vimruntime": "/usr/share/nvim/runtime"
},
"processId": 14056,
"rootPath": "/home/______/.vim",
"rootUri": "file:///home/______/.vim",
"trace": "verbose"
},
"id": 1
}
only if I put to the request the contents under vimls
only:
{
"command": "vim-language-server",
"args": ["--stdio"],
"initializationOptions": {
"iskeyword": "@,48-57,_,192-255,#",
"vimruntime": "/usr/share/nvim/runtime",
"runtimepath": "/home/______/.config/nvim,/home/______/.config/nvim/bundle/LanguageClient-neovim,/home/______/.config/nvim/bundle/PHP-Indenting-for-VIm,/home/______/.config/nvim/bundle/ale,/home/______/.config/nvim/bundle/______,/home/______/.config/nvim/bundle/auto-pairs,/home/______/.config/nvim/bundle/bufexplorer,/home/______/.config/nvim/bundle/ctrlp.vim,/home/______/.config/nvim/bundle/deoplete-phpactor,/home/______/.config/nvim/bundle/deoplete.nvim,/home/______/.config/nvim/bundle/fugitive,/home/______/.config/nvim/bundle/fzf.vim,/home/______/.config/nvim/bundle/luciusColorscheme,/home/______/.config/nvim/bundle/neopairs.vim,/home/______/.config/nvim/bundle/nerdtree,/home/______/.config/nvim/bundle/nginx.vim,/home/______/.config/nvim/bundle/phpactor,/home/______/.config/nvim/bundle/snippets,/home/______/.config/nvim/bundle/surround,/home/______/.config/nvim/bundle/tabname,/home/______/.config/nvim/bundle/tail-bundle,/home/______/.config/nvim/bundle/tmux.vim,/home/______/.config/nvim/bundle/ultisnips,/home/______/.config/nvim/bundle/vdebug,/home/______/.config/nvim/bundle/vim-airline,/home/______/.config/nvim/bundle/vim-airline-themes,/home/______/.config/nvim/bundle/vim-commentary,/home/______/.config/nvim/bundle/vim-dispatch,/home/______/.config/nvim/bundle/vim-gitgutter,/home/______/.config/nvim/bundle/vim-javascript,/home/______/.config/nvim/bundle/vim-markdown,/home/______/.config/nvim/bundle/vim-markdown-folding,/home/______/.config/nvim/bundle/vim-move,/home/______/.config/nvim/bundle/vim-pasta,/home/______/.config/nvim/bundle/vim-pathogen,/home/______/.config/nvim/bundle/vim-repeat,/home/______/.config/nvim/bundle/vim-rhubarb,/home/______/.config/nvim/bundle/vim-spacejam,/home/______/.config/nvim/bundle/vim-test,/home/______/.config/nvim/bundle/vim-tmux-focus-events,/home/______/.config/nvim/bundle/vim-toml,/home/______/.config/nvim/bundle/vim-twig,/home/______/.config/nvim/bundle/vim-unimpaired,/etc/xdg/nvim,/home/______/.local/share/nvim/site,/usr/local/share/nvim/site,/usr/share/nvim/site,/usr/share/nvim/runtime,/usr/share/nvim/runtime/pack/dist/opt/matchit,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,/home/______/.local/share/nvim/site/after,/etc/xdg/nvim/after,/home/______/.config/nvim/bundle/vim-markdown-folding/after,/home/______/.config/nvim/bundle/vim-javascript/after,/home/______/.config/nvim/bundle/ultisnips/after,/home/______/.config/nvim/bundle/______/after,/home/______/.config/nvim/after,/usr/share/doc/fzf/examples",
"diagnostic": {
"enable": true
},
"indexes": {
"runtimepath": true,
"gap": 100,
"count": 3
},
"suggest": {
"fromVimruntime": true,
"fromRuntimepath": true
}
},
"filetypes": [ "vim" ]
}
With this configuration I expected to see globals and functions available by autoloading from plugins in completion menu but none of them are present. I then suspect that the configuration is still incorrect.
The log seems right. It need some time to index all your vim files in runtimepath.
Long indexing is probably not the case. For elimination of such potential situation I restricted runtimepath
to /home/______/.config/nvim/bundle/LanguageClient-neovim
and still don't see any public function from its autoload. For example,
call LanguageClient#
with the cursor at the end of line, I expect debugInfo
and other functions.
I added the following line at the end of the scan()
body in parser.js:
log.info(vscode_uri_1.default.file(path_1.join(p, 'f')).toString());
and I get
"parser: file:///home/______/.config/nvim/bundle/LanguageClient-neovim/f"
among other scanned directories. This at least seems to confirm that "runtimepath" is passed correctly in the initial request ;).
Where the index is stored? Is it an in-memory instance only or has it persisted form to read at the next start of the server?
From some hours I have one client-server connection. Indeed, most of autoloaded function are present in the suggestions list. The most of public functions defined in plugins is also visible. Some of plugins are still not invisible, although they are in runtimepath (and callable from the command line).
First, I would like to get detailed log about when each file is indexed and when indexing is complete. Next, why some function and variable names are still not suggested (it seems that whole plugin directories are ignored, e.g. vdebug). Both problems exceed the topic of this issue.
P.S. After reopening connection I noticed absence of many expected suggestions indexed previously. It suggests that there is no cached form of the index to initial use before slow reindexing.
It must be something wrong, it can't take hours to index all plugins. It only take 1x-2x seconds to index 3x plugins with my macbook pro.
If it parser the plugin's file fail, it will not get the items from that plugin's file, and it does not have cache by now.
Thanks for info about VDebug before I worked out this.
I found (using "print debugging" as a typescript beginner) two bugs. The first is the cause of absence of my local plugin. The second is related to logging. I can sent separate pull requests to propose the fixes.
@iamcco Does the plugin automatically use &rtp
if no "runtimepath" option is provided? Is there a way to configure it to use this variable (so that I don't have to go adjust my coc-settings.json every time I install a new plugin)?
@masaeedu The plugin will not use the &rtp
if you don't set the runtimepath
. There is no way use variable if you use coc-setting.json to config, but you can use vim to config read the coc wiki or docs. Or you can use https://github.com/iamcco/coc-vimlsp it will set those option automatically.
@iamcco That's another thing; I am actually using that extension, but until I explicitly added that configuration block in coc-settings.json
, the extension didn't work. I was under the impression that maybe this extension needs the language server to be explicitly configured.
@masaeedu The extension do not need configured in coc-settings.json
Anybody had any luck configuring the server under LanguageClient-neovim ? I've been trying to get it working under vim 8.2 for the past couple of days, but alas - I am still new to the whole LSP thing. I can't seem to get the signature help working at all (I suspect the echodoc plugin that has to actually do it, but still..)
Hello,
I would like to use
vim-language-server
with https://github.com/autozimu/LanguageClient-neovim but I (as not Node developer) have no idea how to pass the configuration presented for--stdio
.With
seems to work, but I would like to configure
fromRuntimepath
and not only.Seriously: I even not know how to list possible options... Running
vim-language-server
without parameters throws the error with suggestion to use only the basicbut not how to display help message and how to inject any configuration.
Please complete documentation.