Giter Site home page Giter Site logo

autozimu / languageclient-neovim Goto Github PK

View Code? Open in Web Editor NEW
3.5K 3.5K 272.0 44.42 MB

Language Server Protocol (LSP) support for vim and neovim.

License: MIT License

Python 7.41% Shell 1.73% Makefile 0.46% Rust 88.35% JavaScript 0.13% C# 0.07% C++ 0.11% TypeScript 0.04% PHP 0.02% Java 0.23% PowerShell 0.37% CMake 0.03% Go 0.02% Haskell 0.01% C 0.06% HTML 0.03% Dockerfile 0.17% PureScript 0.09% Elixir 0.67% CSS 0.01%
denite-source deoplete-source language-server-protocol languageclient neovim-plugin vim-plugin

languageclient-neovim's Issues

getRootPath support java language.

hi, autozimu
Please help achieve rootPath support java language

    elif languageId == "java":
        rootPath = traverseUp(filepath, isJavaRoot)


def isJavaRoot(folder: str) -> bool:
    if os.path.exists(os.path.join(folder, ".project")):
        return True

    #if os.path.exists(os.path.join(folder, "pom.xml")):
    #    return True

    return False

I work behind the firewall and can not push, tks.

dart_language_server autocompletion not working

So far the dart_language_server marks the errors and warnings on dart files.

nvim-completion-manager is working fine but I am not getting autocompletion specific for the dart language.

I don't know if I configured something wrong or the dart_language_server
is not 100% compatible with LanguageClient-neovim.

I added the request information.
Thanks for the awesome plugin.

  • NVIM 0.1.7

  • Plugin version (git SHA)
    8ef801eb4bb62a89032698950621a1425e5e195c

  • Minimal vimrc.

  call plug#begin('~/.config/nvim/plugged')
  Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' }
  Plug 'roxma/nvim-completion-manager'
  call plug#end()

let g:LanguageClient_serverCommands = {
    \ 'dart': ['dart_language_server'],
    \ }
  • Content of :CheckHealth.
health#nvim#check
========================================================================
## Configuration
  - SUCCESS: no issues found

## Performance
  - SUCCESS: Build type: RelWithDebInfo

## Remote Plugins
  - SUCCESS: Up to date

## terminfo
  - ERROR: key_backspace (kbs) entry is ^H (ASCII DELETE): key_backspace=^H,

    - SUGGESTIONS:
      - Set key_backspace to \177 (ASCII BACKSPACE). Run these commands:
          infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti
          tic $TERM.ti
      - See https://github.com/neovim/neovim/wiki/FAQ

health#provider#check
========================================================================
## Clipboard
  - SUCCESS: Clipboard tool found: xsel

## Python 2 provider
  - INFO: `g:python_host_prog` is not set.  Searching for python2 in the environment.
  - INFO: Executable: /usr/bin/python2
  - INFO: Python2 version: 2.7.12
  - INFO: python2-neovim version: 0.1.9
  - WARNING: Latest python2-neovim is NOT installed: 0.1.13

## Python 3 provider
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: There are multiple python3 executables found.  Set "g:python3_host_prog" to avoid surprises.
  - INFO: Executable: /home/last/anaconda3/bin/python3
  - INFO: Other python executable: /usr/bin/python3
  - INFO: Python3 version: 3.5.2
  - INFO: python3-neovim version: 0.1.13
  - SUCCESS: Latest python3-neovim is installed: 0.1.13

## Ruby provider
  - ERROR: Missing Neovim RubyGem
    - SUGGESTIONS:
      - Install or upgrade the neovim RubyGem using `gem install neovim`.
  - INFO: Ruby Version: ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
  - INFO: Host Executable: not found
  - INFO: Host Version: not found
  • Content of ~/.local/share/nvim/rplugin.vim.
" python3 plugins
call remote#host#RegisterPlugin('python3', '/home/last/.config/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient', [
      \ {'sync': v:true, 'name': 'LanguageClient_alive', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_completionItem/resolve', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_completionManager_refresh', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_exit', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentDocumentSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentReferences', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkWorkspaceSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'BufReadPost', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'CursorMoved', 'opts': {'pattern': '*', 'eval': 'line(''.'')'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'VimEnter', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_initialize', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_registerServerCommands', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_setLoggingLevel', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClientStart', 'opts': {}, 'type': 'command'},
      \ {'sync': v:false, 'name': 'LanguageClientStop', 'opts': {}, 'type': 'command'},
      \ {'sync': v:false, 'name': 'TextChanged', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'TextChangedI', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_completion', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_definition', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_didClose', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'BufWritePost', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_documentSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_hover', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_references', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_rename', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_signatureHelp', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_workspace_symbol', 'opts': {}, 'type': 'function'},
     \ ])


" ruby plugins
#

" python plugins
  • Run :call LanguageClient_setLoggingLevel('DEBUG') and then
    :LanguageClientStart, reproduce the bug, attach content of
    /tmp/LanguageClient.log.

LanguageClient.log

Can call LanguageClient_workspace_symbol with argument?

There is no any argument in function LanguageClient_workspace_symbol.

    @neovim.function('LanguageClient_workspace_symbol')                                                                                                                               
      @args()                                                                                                                                                                           
      def workspace_symbol(                                                                                                                                                             
              self, languageId: str = None, query: str = None,                                                                                                                          
              sync: bool = None, cbs: List = None) -> None:                                                                                                                             
          logger.info("Begin workspace/symbol")                                                                                                                                         
                                                                                                                                                                                        
          if query is None:                                                                                                                                                             
              query = ""                                                                                                                                                                
          if not sync and not cbs:                                                                                                                                                      
              cbs = [partial(self.handleWorkspaceSymbolResponse,                                                                                                                        
                             selectionUI=self.getSelectionUI()),                                                                                                                        
                     self.handleError]                                                                                                                                                  
                                                                                                                                                                                        
          return self.rpc[languageId].call('workspace/symbol', {                                                                                                                        
              "query": query                                                                                                                                                            
x             }, cbs)               

In LSP document:

Workspace Symbols Request

The workspace symbol request is sent from the client to the server to list project-wide symbols matching the query string.

Request:

method: 'workspace/symbol'
params: WorkspaceSymbolParams defined as follows:

/**
 * The parameters of a Workspace Symbol Request.
 */
interface WorkspaceSymbolParams {
    /**
     * A non-empty query string
     */
    query: string;
}

Passing a query parameter can reduce the fzf selection list

rename with multiple buffers fails when `set nohidden`

example project https://github.com/sbeckeriv/temp-dir/blob/master/src/main.rs rename test to something.

In a simple rust setup I added a mod and a public struct. I am in the main.src and I rename the struct. I get this error stack. It loads the mod with the correct change unsaved. the main.src file is untouched. I can reproduce this in other rust projects.

thanks again.

Error caught while executing async callback:
NvimError(b'Vim(buffer):E37: No write since last change (add ! to override)',)
Traceback (most recent call last):
  File "/Users/becker/.local/share/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient/LanguageC
lient.py", line 30, in <lambda>
    self.nvim.async_call(lambda: self.nvim.command(cmds))
  File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 218, in command
    return self.request('nvim_command', string, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 131, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
    raise self.error_wrapper(err)
neovim.api.nvim.NvimError: b'Vim(buffer):E37: No write since last change (add ! to override)'

the call was requested at
  File "/Users/becker/.local/share/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient/RPC.py",
line 96, in handle
    self.queue[mid](result)
  File "/Users/becker/.local/share/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient/LanguageC
lient.py", line 345, in handleTextDocumentRenameResponse
    self.applyChanges(changes, curPos, bufnames)
  File "/Users/becker/.local/share/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient/LanguageC
lient.py", line 87, in applyChanges
    self.asyncCommand(cmd)
  File "/Users/becker/.local/share/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient/LanguageC
lient.py", line 30, in asyncCommand
    self.nvim.async_call(lambda: self.nvim.command(cmds))

Provide a way to query analysis progress for RLS

This would be possible by using textDocument/diagnosticsBegin and textDocument/diagnosticsEnd.

I'd like to be able to write an airline extension that displays the progress of the analysis, like the status bar of the RLS vscode plugin.

From a quick googling it appears that these methods are RLS-specific.

LanguageClientStart = E492: Not an editor command

:PlugStatus

  • fzf: OK
  • deoplete.nvim: OK
  • LanguageClient-neovim: OK

I have a fresh neovim + python3 installation, and it looks like LanguageClient installed correctly (OK).

Any idea why :LanguageClientStart gives an error? (E492)

different behaviour for `LanguageClient_textDocument_hover`

I recently switched from jedi-vim to LanguageClient-neovim with the python server. The main reason is the improved performance.

I found jedi-vim's jedi#show_documentation() way more helpful, especially for complicated functions from imported modules.

What I would suggest is splitting LanguageClient_textDocument_hover into two functions. One function (LanguageClient_text_Document_documentation) providing something like jedi-vim, this means opening a new window with the documentation, and mapping q to quite. This allows you to have (a lengthy) documentation open, while writing code. And another function (LanguageClient_textDocument_hover) which echos only the first line, so that it can easily be assigned to an CursorHold autocommand.

Incorrect rls command in example settings

When installed through rustup the rls binary isn't actually added to ~/.cargo/bin/rls, I'm guessing there's one leftover on your system from building it locally and using cargo install which can be removed with 'cargo uninstall rls' .

The recommended way to run it now is 'rustup run nightly rls' b/c the binary is nested in one of rustup's toolchain folders which will differ by platform.

I'll submit a PR with a fix shortly.

Errors/warnings not appearing on hover

Description

I have enabled LanguageServer-neovim with RLS. It works to a certain extent: The server runs, the diagnostics/hints show, the goto definition works etc., however when hovering the erroring line with the cursor, the error does not show up.

Exception

It shows up for less than 200 ms. sometimes (maybe 50%) if I go over the line quickly from up to down (does not work if I go over the line from down and upwards). Turns out it works both directions.

Setup details

neovim version

0.1.7 (release build)

Plugin version (git SHA)

ea2531d

Minimal vimrc.

call plug#begin('$XDG_CONFIG_HOME/nvim/plugged')
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
    Plug 'Shougo/echodoc.vim'
    Plug 'airblade/vim-gitgutter'
    Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' }
    Plug 'bling/vim-airline'
    Plug 'cohama/lexima.vim'
    Plug 'kien/ctrlp.vim'
    Plug 'lervag/vimtex'
    Plug 'plasticboy/vim-markdown'
    Plug 'rust-lang/rust.vim'
    Plug 'scrooloose/syntastic'
    Plug 'sjl/badwolf'
    Plug 'ticki/rust-cute-vim'
    Plug 'vim-airline/vim-airline-themes'
call plug#end()

let g:deoplete#enable_at_startup = 1
set completeopt-=preview
let g:LanguageClient_serverCommands = {
    \ 'rust': ['rls'],
\ }

" some stuff ommitted

Content of :CheckHealth.

All success.

Content of ~/.local/share/nvim/rplugin.vim.

" python3 plugins
call remote#host#RegisterPlugin('python3', '/home/ticki/.config/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient', [
      \ {'sync': v:true, 'name': 'LanguageClient_alive', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_completionItem/resolve', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_completionManager_refresh', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_exit', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentDocumentSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentReferences', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkWorkspaceSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'CursorMoved', 'type': 'autocmd', 'opts': {'pattern': '*', 'eval': 'line(''.'')'}},
      \ {'sync': v:false, 'name': 'LanguageClient_initialize', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_registerServerCommands', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_setLoggingLevel', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClientStart', 'type': 'command', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClientStop', 'type': 'command', 'opts': {}},
      \ {'sync': v:false, 'name': 'TextChanged', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'TextChangedI', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_completion', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_definition', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_didClose', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'BufReadPost', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'BufWritePost', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_documentSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_hover', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_references', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_rename', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_signatureHelp', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_workspace_symbol', 'type': 'function', 'opts': {}},
     \ ])
call remote#host#RegisterPlugin('python3', '/home/ticki/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete', [
      \ {'sync': v:true, 'name': '_deoplete', 'type': 'function', 'opts': {}},
     \ ])

Run :call LanguageClient_setLoggingLevel('DEBUG') and then
:LanguageClientStart, reproduce the bug, attach content of
/tmp/LanguageClient.log.

20:54:48 INFO     Begin LanguageClientStart
20:54:48 INFO     End LanguageClientStart
20:54:48 INFO     Begin initialize
20:54:48 INFO     rootPath: /home/ticki/code/tfs/core
20:54:48 DEBUG     => {"jsonrpc": "2.0", "method": "initialize", "params": {"processId": 19363, "rootPath": "/home/ticki/code/tfs/core", "rootUri": "file:///home/ticki/code/tfs/core", "capabilities": {}}, "id": 0}
20:54:48 DEBUG     <= 
20:54:48 DEBUG     <= {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":[".",":"]},"signatureHelpProvider":{"triggerCharacters":[]},"definitionProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":false,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"renameProvider":true}}}
20:54:48 INFO     End initialize
20:54:48 DEBUG     <= {"jsonrpc":"2.0","method":"rustDocument/diagnosticsBegin","params":null}
20:54:48 WARNING  no handler implemented for rustDocument_diagnosticsBegin
20:54:48 WARNING  register completion manager source failed.
20:54:48 INFO     textDocument/didOpen
20:54:48 DEBUG     => {"jsonrpc": "2.0", "method": "textDocument/didOpen", "params": {"textDocument": {"uri": "file:///home/ticki/code/tfs/core/src/lib.rs", "languageId": "rust", "version": 1, "text": "//! The TFS library.\n//!\n//! This is the official implementation of the TFS specification. It implements the specification\n//! in its full form, and is accessible as a library.\n\n#![feature(conservative_impl_trait, i128_type, try_from)]\n\n#[macro_use]\nextern crate slog;\n\nextern crate crossbeam;\nextern crate futures;\nextern crate little_endian;\nextern crate lz4_compress;\nextern crate mlcr;\nextern crate rand;\nextern crate ring;\nextern crate ring_pwhash;\nextern crate seahash;\nextern crate speck;\nextern crate thread_object;\n\n#[macro_use]\nmod error;\n#[macro_use]\nmod macros;\n\nmod alloc;\nmod disk;\nmod fs;\n\npub use error::Error;", "last_update": 1490900088.4552875, "dirty": true}}}

LanguageClient_textDocument_references -- add line

I use the LanguageClient with the python server, and don't really know on which side is responsible. But I think the LanguageClient_textDocument_references function should not only populate Denite with the file and line information, but also show the content of the line.

Can't support Eclipse JDT Language Server

I test integrated with Eclipse JDT Language Server, but there are something wrong:

  • LanguageClient-neovim log
15:50:16 INFO     Begin textDocument/documentSymbol
  • Eclipse JDT Language Server log
{"jsonrpc": "2.0", "method": "textDocument/documentSymbol", "params": {"textDocument": {"uri": "file:///data1/d257414/git/java/restful/src/main/java/com/huawei/baasda/restful/Result.java"}}, "id": 1}Content-Length: 139

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Feb 28, 2017 3:46:51 PM \u003e\u003e document/documentSymbol"}}Content-Length: 1740

{"jsonrpc":"2.0","id":"1","result":[{"name":"status","kind":8,"location":{"uri":"file:///data1/d257414/git/java/restful/src/main/java/com/huawei/baasda/restful/Result.java","range":{"start":{"line":6,"character":16},"end":{"line":6,"character":22}}},"containerName":"Result"},{"name":"json","kind":8,"location":{"uri":"file:///data1/d257414/git/java/restful/src/main/java/com/huawei/baasda/restful/Result.java","range":{"start":{"line":7,"character":19},"end":{"line":7,"character":23}}},"containerName":"Result"},{"name":"toString","kind":12,"location":{"uri":"file:///data1/d257414/git/java/restful/src/main/java/com/huawei/baasda/restful/Result.java","range":{"start":{"line":10,"character":18},"end":{"line":10,"character":26}}},"containerName":"Result"},{"name":"getStatus","kind":12,"location":{"uri":"file:///data1/d257414/git/java/restful/src/main/java/com/huawei/baasda/restful/Result.java","range":{"start":{"line":22,"character":15},"end":{"line":22,"character":24}}},"containerName":"Result"},{"name":"getJson","kind":12,"location":{"uri":"file:///data1/d257414/git/java/restful/src/main/java/com/huawei/baasda/restful/Result.java","range":{"start":{"line":27,"character":18},"end":{"line":27,"character":25}}},"containerName":"Result"},{"name":"setStatus","kind":12,"location":{"uri":"file:///data1/d257414/git/java/restful/src/main/java/com/huawei/baasda/restful/Result.java","range":{"start":{"line":31,"character":16},"end":{"line":31,"character":25}}},"containerName":"Result"},{"name":"setJson","kind":12,"location":{"uri":"file:///data1/d257414/git/java/restful/src/main/java/com/huawei/baasda/restful/Result.java","range":{"start":{"line":35,"character":16},"end":{"line":35,"character":23}}},"containerName":"Result"}]}

The LanguageClient-neovim can't receive the response message.

Python Language Service Hang

Problem:

Language Client ceases to work after editing for a while. Diagnostic remains even if errors are fixed. No completion is suggested. But the plugin initially works well.

https://github.com/palantir/python-language-server

Env:

LC version: master
neovim version: NVIM 0.1.7
Python Language Server version: master.
OS: producible on both mac OS & Linux

Log:

I have modified logging to record all raw server/client output, so I think it quite useless without source code.

However, my conclusion is that Client side works well, except reading blocks.

A typical raw log looks like this:

15:25:08 INFO    Content-Length: 899
15:25:08 INFO    Content-Type: application/vscode-jsonrpc; charset=utf8
15:25:08 INFO    {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///code/test/python-language-server/pyls/__main__.py","diagnostics":[{"source":"pycodestyle","range":{"start":{"line":31,"character":79},"end":{"line":31,"character":112}},"message":"E501 line too long (111 > 79 characters)","code":"E501","severity":1},{"source":"pycodestyle","range":{"start":{"line":35,"character":79},"end":{"line":35,"character":90}},"message":"E501 line too long (89 > 79 characters)","code":"E501","severity":1},{"source":"pycodestyle","range":{"start":{"line":37,"character":79},"end":{"line":37,"character":89}},"message":"E501 line too long (89 > 79 characters)","code":"E501","severity":1},{"source":"pycodestyle","range":{"start":{"line":37,"character":89},"end":{"line":37,"character":89}},"message":"W292 no newline at end of file","code":"W292","severity":2}]}}

Finding:

After some changes to logging, I found both language server and client stop to reading from /writing to stdio.

Related source.

Client block:
https://github.com/autozimu/LanguageClient-neovim/blob/master/rplugin/python3/LanguageClient/RPC.py#L73

Server block:
https://github.com/palantir/python-language-server/blob/master/pyls/jsonrpc.py#L155

I don't know if it is server's problem or client problem. However, I cannot reproduce it with golang server.

[Suggestion] change camelCase to snake_case

This is just a suggestion.

Python promotes snake_case rather than camelCase in this repo.

If snake_case is adopted, more devs can contribute idiomatic and pythonic code to this.

Can support textDocument/references output to quickfix list?

The current textDocument/references output to fzf list, but I think quickfix list may be better suitable for it

Can you offer a choice of quickfix list?

  1 src/engine/expr/evaluate.go|19 col 6| references to func EvalRecord(ctx *util/env.ReqContext, object *metadata/mdd/api.Object, record   
~                              |    da.Record, expr string) (interface{}, error)                                                                                            
~                              |  2 src/engine/internal/object/internal/object_engine.go|350 col 23| value, err := expr.EvalRecord(oe.ctx, objmd, record, script)
~                              |  3 src/engine/approval/approval_process.go|215 col 19| val, err := expr.EvalRecord(m.ctx, m.objMeta, m.record, criteria)
~                              |  4 src/engine/approval/approval_process.go|346 col 21| value, err = expr.EvalRecord(m.ctx, m.objMeta, m.record, formula)
~                              |  5 src/engine/flow/util/dependency.go|504 col 14| return expr.EvalRecord(d.ctx, nil, context, formula)
~                              |  6 src/engine/flow/util/mock_dependency.go|80 col 14| return expr.EvalRecord(d.Ctx, nil, context, formula)^

Option to disable diagnostics

Hi,

This plugin seems to work fine, however:

I like the idea of validations but I think it should either:

  1. Only happen on save
  2. Display in a different way.

Currently every time I perform an "action" it flickers my screen because its adding an icon to the number bar.

I tried:

"" Php autocomplete
" Disable diagnostics
let g:LanguageClient_diagnosticsDisplay = {}

but that does not seem to help.

Populate tag stack when jumping to definition. #1.

Hello:

I've made a quick change to fix the jumplist issue. It works well for me.

diff --git a/rplugin/python3/LanguageClient/LanguageClient.py b/rplugin/python3/LanguageClient/LanguageClient.py
index 8cc47aa..c45494b 100644
--- a/rplugin/python3/LanguageClient/LanguageClient.py
+++ b/rplugin/python3/LanguageClient/LanguageClient.py
@@ -100,9 +100,9 @@ class LanguageClient:
                 line = edit['range']['start']['line'] + 1
                 character = edit['range']['start']['character'] + 1
                 newText = edit['newText']
-                cmd += "| execute 'normal! {}G{}|cw{}'".format(
+                cmd += "| execute 'keepjumps normal! {}G{}|cw{}'".format(
                         line, character, newText)
-        cmd += "| buffer {} | normal! {}G{}|".format(
+        cmd += "| keepjumps buffer {} | normal! {}G{}|".format(
                     uriToPath(curPos["uri"]),
                     curPos["line"] + 1,
                     curPos["character"] + 1)
@@ -384,10 +384,9 @@ class LanguageClient:
         else:
             defn = result
         path = uriToPath(defn["uri"])
-        cmd = getGotoFileCommand(path, bufnames)
         line = defn['range']['start']['line'] + 1
         character = defn['range']['start']['character'] + 1
-        cmd += "| normal! {}G{}|".format(line, character)
+        cmd = getGotoFileCommand(path, bufnames, line, character)
         self.asyncCommand(cmd)
 
         logger.info('End textDocument/definition')
@@ -538,8 +537,7 @@ call fzf#run(fzf#wrap({{
         line = splitted[1]
         character = splitted[2]
 
-        cmd = getGotoFileCommand(path, bufnames)
-        cmd += "| normal! {}G{}|".format(line, character)
+        cmd = getGotoFileCommand(path, bufnames, line, character)
         self.asyncCommand(cmd)
 
     @neovim.function('LanguageClient_textDocument_references')
@@ -595,8 +593,7 @@ call fzf#run(fzf#wrap({{
         line = splitted[1]
         character = splitted[2]
 
-        cmd = getGotoFileCommand(path, bufnames)
-        cmd += "| normal! {}G{}|".format(line, character)
+        cmd = getGotoFileCommand(path, bufnames, line, character)
         self.asyncCommand(cmd)
 
     @neovim.autocmd("TextChanged", pattern="*")
diff --git a/rplugin/python3/LanguageClient/util.py b/rplugin/python3/LanguageClient/util.py
index 31efe64..7800c7e 100644
--- a/rplugin/python3/LanguageClient/util.py
+++ b/rplugin/python3/LanguageClient/util.py
@@ -75,8 +75,9 @@ def retry(span, count, condition):
         count -= 1
 
 
-def getGotoFileCommand(path, bufnames) -> str:
+def getGotoFileCommand(path, bufnames, line = 1, character = 1) -> str:
     if path in bufnames:
-        return "buffer {}".format(path)
+        cmd = 'buffer'
     else:
-        return "edit {}".format(path)
+        cmd = 'edit'
+    return "{} +keepjumps\ normal\ {}G{}\| {}".format(cmd, line, character, path)

REQ: auto run language client

when using deoplete/deoplete-source, it does not need to run command manually. I wonder is it possible to introduce this feature also, then user experience is improved.

Failed to start language server: []

  • neovim version 0.1.7
  • Plugin version (git SHA) 7c5a0cc
  • Minimal vimrc.
Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' }
let g:LanguageClient_serverCommands = {'php' : ['php', '~/.local/share/nvim/plugged/LanguageServer-php-neovim/vendor/bin/php-language-server.php']}
let g:LanguageClient_autoStart = 1
let g:LanguageClient_signColumnAlwaysOn = 1
" nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
nnoremap <silent> <C-]> :call LanguageClient_textDocument_definition()<CR>

Plug 'roxma/nvim-completion-manager'
Plug 'roxma/LanguageServer-php-neovim', {'do': 'composer install && composer run-script parse-stubs'}
autocmd FileType php LanguageClientStart
  • Content of :CheckHealth.
python2 is not support
python3 is support
  • Content of ~/.local/share/nvim/rplugin.vim.

  • Run :call LanguageClient_setLoggingLevel('DEBUG') and then
    :LanguageClientStart, reproduce the bug, attach content of
    /tmp/LanguageClient.log.

23:55:58 INFO     Begin LanguageClientStart
23:55:58 INFO     End LanguageClientStart
23:55:58 INFO     Begin initialize
23:55:58 INFO     rootPath: /vagrant/trunk/kqc/cyb
23:55:58 DEBUG     => {"params": {"capabilities": {}, "rootPath": "/vagrant/trunk/kq
c/cyb", "rootUri": "file:///vagrant/trunk/kqc/cyb", "trace": "off", "processId": 156
67}, "jsonrpc": "2.0", "method": "initialize", "id": 0}
23:55:58 DEBUG     <= 
23:56:04 ERROR    Failed to start language server: []
23:56:05 ERROR    Failed to start language server: []
23:56:05 ERROR    Failed to start language server: []
23:56:05 ERROR    Failed to start language server: []
23:56:05 ERROR    Failed to start language server: []

when i call the LanguageClient_* function , there is the error messahe Failed to start language server: []

Rename function with palantir/python-language-server return code -32601

Issue

I'm trying to rename the hello function exactly like in the presentation gif but I get the following message : {"code": -32601, "message": "Method not found"}.

On a side note, completion and code navigation seem to work fine.

language server

https://github.com/palantir/python-language-server

min example

import traceback


def hello():
    return "hello world"


def main():
    print(hello())


try:
    main()
except Exception as e:
    print(traceback.format_exc())

Neovim version

NVIM v0.2.0
Build type: Release
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wconversion -DNVIM_MSGPACK_HAS_FLOAT32 -O2 -DNDEBUG -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.2.0/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Optional features included (+) or not (-): +acl   +iconv    +jemalloc +tui      
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Plugin version

aa6b0b0

Minimal vimrc

" minimal init.vim -------------------------------------------------------- {{{

let g:python3_host_prog = '/home/debz/.local/share/virtualenvs/python3_neovim_provider/bin/python3'

set foldcolumn=1                 " column of width 1, that show folds

let g:LanguageClient_serverCommands = {
    \ 'rust': ['rustup', 'run', 'nightly', 'rls'],
    \ 'javascript': ['/opt/javascript-typescript-langserver/lib/language-server-stdio.js'],
    \ 'python': ['pyls']
    \ }

" Automatically start language servers.
let g:LanguageClient_autoStart = 1
let g:LanguageClient_signColumnAlwaysOn = 1

nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
" }}}

Content of :CheckHealth

health#nvim#check
 ========================================================================
 ## Configuration
   - SUCCESS: no issues found
 
 ## Performance
   - SUCCESS: Build type: Release
 
 ## Remote Plugins
   - SUCCESS: Up to date
 
 ## terminal
   - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
   - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
 
 health#provider#check
 ========================================================================
 ## Clipboard (optional)
   - SUCCESS: Clipboard tool found: xclip
 
 ## Python 2 provider (optional)
   - WARNING: No Python interpreter was found with the neovim module.  Using the first available for diag
   nostics.
   - WARNING: provider/pythonx: Could not load Python 2:
     /usr/bin/python2 does not have the "neovim" module. :help provider-python
     /usr/bin/python2.7 does not have the "neovim" module. :help provider-python
     python2.6 not found in search path or not executable.
     /usr/bin/python is Python 3.6 and cannot provide Python 2.
   - ERROR: Python provider error
     - SUGGESTIONS:
       - provider/pythonx: Could not load Python 2:
           /usr/bin/python2 does not have the "neovim" module. :help provider-python
           /usr/bin/python2.7 does not have the "neovim" module. :help provider-python
           python2.6 not found in search path or not executable.
           /usr/bin/python is Python 3.6 and cannot provide Python 2.
   - INFO: Executable: Not found
 
 ## Python 3 provider (optional)
   - INFO: Using: g:python3_host_prog = "/home/debz/.local/share/virtualenvs/python3_neovim_provider/bin/
   python3"
   - INFO: Executable: /home/debz/.local/share/virtualenvs/python3_neovim_provider/bin/python3
   - INFO: Python3 version: 3.6.1
   - INFO: python3-neovim version: 0.1.13
   - SUCCESS: Latest python3-neovim is installed: 0.1.13
 
 ## Ruby provider (optional)
   - INFO: Ruby: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
   - WARNING: Missing "neovim" gem.
     - SUGGESTIONS:
       - Run in shell: gem install neovim
       - Is the gem bin directory in $PATH? Check `gem environment`.
       - If you are using rvm/rbenv/chruby, try "rehashing".

Content of ~/.local/share/nvim/rplugin.vim

" python3 plugins
call remote#host#RegisterPlugin('python3', '/home/debz/.local/share/nvim/site/pack/common/start/LanguageClient-neovim/rplugin/python3/LanguageClient', [
      \ {'sync': v:true, 'name': 'LanguageClient_alive', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_completionItem/resolve', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_completionManager_refresh', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_exit', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentDocumentSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentReferences', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkWorkspaceSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'BufReadPost', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'CursorMoved', 'type': 'autocmd', 'opts': {'pattern': '*', 'eval': 'line(''.'')'}},
      \ {'sync': v:false, 'name': 'VimEnter', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'LanguageClient_initialize', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_registerServerCommands', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_setLoggingLevel', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClientStart', 'type': 'command', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClientStop', 'type': 'command', 'opts': {}},
      \ {'sync': v:false, 'name': 'TextChanged', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'TextChangedI', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_completion', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_completionOmnifunc', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_definition', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_didClose', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'BufWritePost', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_documentSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_hover', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_references', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_rename', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_signatureHelp', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_workspace_symbol', 'type': 'function', 'opts': {}},
     \ ])
call remote#host#RegisterPlugin('python3', '/home/debz/.local/share/nvim/site/pack/common/start/iron.nvim/rplugin/python3/iron', [
      \ {'sync': v:false, 'name': 'IronClearReplDefinition', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'IronRepl', 'type': 'command', 'opts': {'bang': ''}},
      \ {'sync': v:false, 'name': 'IronDumpReplDefinition', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'IronStartRepl', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'IronSendSpecial', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'IronPromptCommand', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'IronPromptRepl', 'type': 'command', 'opts': {}},
      \ {'sync': v:false, 'name': 'IronSendMotion', 'type': 'function', 'opts': {'range': ''}},
      \ {'sync': v:false, 'name': 'IronSend', 'type': 'function', 'opts': {}},
     \ ])


" ruby plugins


" python plugins

/tmp/LanguageClient.log

I'm just inserting the relevant lines:

16:13:38 INFO     Begin LanguageClientStart
16:13:38 INFO     End LanguageClientStart
16:13:38 INFO     Begin initialize
16:13:38 WARNING  Unknown project type. Fallback to use dir as project root.
16:13:38 INFO     rootPath: /home/debz/Documents/Dev/bug_report/LanguageServerNeovim
16:13:38 DEBUG     => {"jsonrpc": "2.0", "method": "initialize", "params": {"processId": 20686, "rootPath": "/home/debz/Documents/Dev/bug_report/LanguageServerNeovim", "rootUri": "file:///home/debz/Documents/Dev/bug_report/LanguageServerNeovim", "capabilities": {}, "trace": "off"}, "id": 0}
16:13:38 DEBUG     <= {"result":{"capabilities":{"completionProvider":{"resolveProvider":false,"triggerCharacters":["."]},"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"definitionProvider":true,"hoverProvider":true,"referencesProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"textDocumentSync":1}},"id":0,"jsonrpc":"2.0"}
16:13:38 INFO     End initialize
16:13:38 WARNING  register completion manager source failed. Error: NvimError(b'Error calling function.',)
16:13:38 INFO     textDocument/didOpen
16:13:38 DEBUG     => {"jsonrpc": "2.0", "method": "textDocument/didOpen", "params": {"textDocument": {"uri": "file:///home/debz/Documents/Dev/bug_report/LanguageServerNeovim/helloworld.py", "languageId": "python", "version": 1, "text": "import traceback\n\n\ndef hello():\n    return \"hello world\"\n\n\ndef main():\n    print(hello())\n\n\ntry:\n    main()\nexcept Exception as e:\n    print(traceback.format_exc())\n"}}}
16:13:38 DEBUG     <= {"method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/debz/Documents/Dev/bug_report/LanguageServerNeovim/helloworld.py","diagnostics":[]},"jsonrpc":"2.0"}
16:13:43 INFO     Begin textDocument/rename
16:13:43 INFO     textDocument/didChange
16:13:46 DEBUG     => {"jsonrpc": "2.0", "method": "textDocument/rename", "params": {"textDocument": {"uri": "file:///home/debz/Documents/Dev/bug_report/LanguageServerNeovim/helloworld.py"}, "position": {"line": 8, "character": 12}, "newName": "world"}, "id": 1}
16:13:46 DEBUG     <= {"error":{"code":-32601,"message":"Method not found"},"id":1,"jsonrpc":"2.0"}
16:13:46 ERROR    {"error": {"code": -32601, "message": "Method not found"}, "id": 1, "jsonrpc": "2.0"}

[Suggestion] Ignore null RPC result

Sometimes a language server will return {"id": 12, "result": null}. Though spec itself does not allow null result, some server will return null when no info is available. For example, a Hover request on an empty line will return a null result.

It is better if language client can be more lenient on nullable result.

Problem with rls

When I check out alacritty and run RLS I don't get any completion or anything. It seems that RLS reports some error which isn't propagated to Vim.

I've tried installing rls both with cargo install rls --git=... and add it as rls in serverCommands and I've tried checking it out into /opt/rls, building it and running it with cargo run --release ....

Plugin version

6862bf2

content of rplugin.vim

$ cat ~/.local/share/nvim/rplugin.vim

" python3 plugins
call remote#host#RegisterPlugin('python3', '/home/niklas/git/dotfiles/config/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient', [
      \ {'sync': v:true, 'name': 'LanguageClient_alive', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_completionItem/resolve', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_completionManager_refresh', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_exit', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentDocumentSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentReferences', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkWorkspaceSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'CursorMoved', 'type': 'autocmd', 'opts': {'pattern': '*', 'eval': 'line(''.'')'}},
      \ {'sync': v:false, 'name': 'LanguageClient_initialize', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_registerServerCommands', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_setLoggingLevel', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClientStart', 'type': 'command', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClientStop', 'type': 'command', 'opts': {}},
      \ {'sync': v:false, 'name': 'TextChanged', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'TextChangedI', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_completion', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_definition', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_didClose', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'BufReadPost', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'BufWritePost', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_documentSymbol', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_hover', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_references', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_rename', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_signatureHelp', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'LanguageClient_workspace_symbol', 'type': 'function', 'opts': {}},
     \ ])
call remote#host#RegisterPlugin('python3', '/home/niklas/git/dotfiles/config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete', [
      \ {'sync': v:true, 'name': '_deoplete', 'type': 'function', 'opts': {}},
     \ ])
" ruby plugins
" python plugins

Error message

15:12:44 DEBUG     <= {"jsonrpc":"2.0","method":"rustDocument/diagnosticsBegin","params":null}
15:12:44 WARNING  no handler implemented for rustDocument_diagnosticsBegin
15:12:44 DEBUG     <= {"jsonrpc":"2.0","method":"rustDocument/diagnosticsEnd","params":null}
15:12:44 WARNING  no handler implemented for rustDocument_diagnosticsEnd
15:12:45 DEBUG     <= {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/niklas/git/alacritty/src/main.rs","diagnostics":[{"range":{"start":{"line":19,"character":0},"end":{"line":19,"character":23},"label":"can't find crate"},"secondaryRanges":[],"severity":1,"code":"E0463","source":"rustc","message":"can't find crate for `alacritty`\ncan't find crate"}]}}
15:12:46 DEBUG     <= {"jsonrpc":"2.0","method":"rustDocument/diagnosticsEnd","params":null}
15:12:46 WARNING  no handler implemented for rustDocument_diagnosticsEnd

Option to use cwd as rootPath

When LanguageClient-neovim sends its initialize request, it sets the rootPath option as the directory containing the file.

It would be very helpful for complex projects to allow the root to be set based on the current working directory. To work around this I've just created a suite of files at the root of my projects called ls.java, ls.go, etc. which I open first so the root starts in the appropriate place.

I figure this could be implemented with a boolean toggle for using cwd or as a parameter to LanguageClientStart where I could set the root.

Updates

(For update announcements only, please refrain from off-topic comments.)

Quickfix gets overwritten by Diagnostics

Hello,

this is not a real bug but something that interferes with other usecases.

If the quickfix list is populated with search results and an item is selected, the LanguageServer diagnostics pushes diagnostic results to the client and the quickfix list is overwritten.

It happens in this line: https://github.com/autozimu/LanguageClient-neovim/blob/master/rplugin/python3/LanguageClient/LanguageClient.py#L963

I use LanguageClient-neovim and LanguageServer-php-neovim.

Suggestions: The (file dependant) LocationList can be used instead of the QuickfixList or an option to disable diagnostics could be added...

Thanks in advance!

PHP language server issues

I did a quick test with https://github.com/felixfbecker/php-language-server and found a couple of issues, I did quick fixes to continue testing, I will try and create pull requests but if these are easy for you then you can probably do them faster than me as my python is not great. After the quick fixes starting/initialising/hover/go to definition all worked, I haven't done further testing yet:

Great work this is exciting stuff!

PHP + default rootPath

Here's a modified getRootPath() which adds support for PHP (looks for a composer.json file) and also falls back to looking for a .git folder when other checks fail. When all fail it falls back to the directory of the opened file (currently it sends back the whole file path which breaks because it's supposed to be a directory).

I don't think this is pull-request quality code so this is just to illustrate the idea, you may want to tidy it up:

def getRootPath(filepath: str) -> str:
    if filepath.endswith('.rs'):
        return traverseUp(
            filepath,
            lambda folder: os.path.exists(os.path.join(folder, 'Cargo.toml')))
    elif filepath.endswith('.php'):
        try:
            path = traverseUp(
                filepath,
                lambda folder: os.path.exists(os.path.join(folder, 'composer.json')))
        except Exception:
            pass
    try:   
        return traverseUp(filepath, lambda folder: os.path.exists(os.path.join(folder, '.git')))
    except Exception:
        return os.path.dirname(filepath)

Denite references doesn't respect working directory

I am using the python-language-server, I am sorry if the problem is on the server site.

The Denite references source displays the proper line numbers, but the wrong file.

In my case I have am in projectroot and work on the file projectroot/subdir/myfile, the references then refer to (the also existing) file projectroot/myfile. If I change to projectroot/subdir everything works fine.

It would also be nice to additionally include the content of the line in the Denite buffer.

Feature - Only validate after save and initial load

I think it would make sense to have the validation to be more configurable:

  1. Only validate on file load
  2. Only validate on file save

What do you think? If you give me a starting point I might try to implement myself.

command not found: "LanguageClientStart"

#16 may be related to this.

" ruby plugins


" python plugins


This occurs using the minimal nvim config even after clearing all nvim dirs and reinstalling plugins & python deps.

PHP language server issues

I've come across a couple more issues while testing compatibility with the php language server:

  1. Using nvim-completion-manager, completion shows null in the list instead of the correct variable name, in completionManager_refresh doing the following gives me a better menu:
-                e['abbr'] = item.get('insertText', "")
+                if 'insertText' in item and item['insertText']:
+                    e['abbr'] = item.get('insertText', "")

Though when I select an item from the popup menu, it repeats the $, so if I type $ and then select $foo from the menu, I get $$foo

  1. in showDiagnosticMessage(), entry["code"] is an int, not a string, so msg += code fails, msg += str(code) works

  2. In LanguageClientStart(), because textDocument_didOpen is being called straight after self.initialize([]), the textDocument_didOpen request is being sent before the InitializeResponse is received. The specification says:

Until the server has responded to the initialize request with an InitializeResult the client must not sent any additional requests or notifications to the server.

This is causing completion to not work until I open a file after php-language-server has initialized.

Again, thanks for your work, this is really cool

Not an editor command: LanguageClientStart

Even with the most minimal setup, I can't get LanguageClientStart to work.

:help LanguageClient works, so I guess the plugin is correctly installed.

I must be missing something obvious, but I don't know what it is.

" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
call plug#begin('~/.local/share/nvim/plugged')

" Make sure you use single quotes

Plug 'sheerun/vim-polyglot'

Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' }

" Initialize plugin system
call plug#end()

set hidden

let g:LanguageClient_serverCommands = {
    \ 'rust': ['cargo', 'run', '--release', '--manifest-path=/Users/Paul/git/rls/Cargo.toml'],
    \ }

Jump back from definition

Hi, great plugin, I have been waiting for a semi functional LSP plugin for vim.

Is there a way to jump back after using LanguageClient_textDocument_definition?

It doesen't appear to register anything in the tag stack, so I can't use the usual Ctrl-T

triggerCharacters is optional, so NCM shouldn't skip registering if it doesn't exists

//cc @roxma

export interface CompletionOptions {
    /**
     * The server provides support to resolve additional
     * information for a completion item.
     */
    resolveProvider?: boolean;

    /**
     * The characters that trigger completion automatically.
     */
    triggerCharacters?: string[];
}

triggerCharacters is optional, so if completionProvider exists in capabilities but triggerCharacters doesn't it should continue to register the source instead of pass.

    def registerCMSource(self, result: Dict) -> None:
        trigger_patterns = []
        try:
            for c in result['capabilities']['completionProvider']['triggerCharacters']:  # noqa E501
                trigger_patterns.append(re.escape(c)+'$')
        except:
            pass


    ....register ncm source...

timeout

Do you think it would be a good idea/possible to implement some sort of timer. I think a timeout of 0.5 seconds or something would decrease the amount of data sent back and forth to the language server. I'm thinking that the timout gets reset every time you use the keyboard.

Allow user to configure on/off for `Realtime diagnostics/compiler/lint message`

I came to know about this plugin from deoplete and the intention for installing was mainly for its autocompletion source (Which is really amazing)

For me personally, the realtime factor is not really necesary and can be slightly distracting at times.
Therefore, allow turning the diagnostic off will be helpful for me.

Maybe we could have states like:

  • Realtime
  • On save
  • Off

Thank you!

[Spec] doHover returns `MarkedString | MarkedString[]`

According to the spec, doHover will return a MarkedString rather than a plain string.

That means a response from a faithful server will be rendered as if double-escaped in LanguageClient-neovim.

screenshot from 2017-06-03 17-45-51

For example, when used with vetur-server and LCN, parenthesis are double escaped.

Disable Preview and Autocompletion

So I've been trying out the LanguageClient with RLS for a bit now and it works okay most of the time (sometimes renaming and stuff like that can be an issue but nothing unexpected).
I have two major problems with it tho:

My first issue is that whenever I'm autocompleting from another file with nvim it shows the path of the file in a preview window, which I then have to manually close. It's possible to use autocmd to close this window instantly but that creates a bug with neovim (the current buffer in vim-airline has unfocused colors). I'd love the option to disable this completely since I don't really see a benefit in the way it works right now anyways (just showing the path to the module I'm autocompleting to).
With variables this is a little more helpful since it shows the line where the variable is created but it still opens this annoying buffer every time that I then have to close again. Since it always only shows a single line maybe the cmdline is a better place to show this info?

My second issue is the autocompletion. I have to admit I haven't tried the autocompletion yet, but right now rust.vim does that for me anyways. I have that installed for syntax (I could use polyglot for that), autocompletion and rustfmt. Now since I have both rust.vim and LanguageClient enabled I feel like weird stuff is happening. Sometimes if I type variables it autocompletes without me doing anything. Which, I'm sure you can imagine, can be quite annoying. Disregarding if I should use rust.vim or LanguageClient for autocompletion I feel like it would be a good idea to be able to disable certain features of the LanguageClient. This would allow to use only what I actually want without having the rest of the LanguageClient mess with my stuff.

I hope this is the right place for these improvement ideas and I really feel like the LanguageClient and RLS might have a bright future. However I'd love to be able to use it as soon as possible without starting to hate it for minor annoyances.

how to use for python?

I installed https://github.com/palantir/python-language-server with pip and got the executable pyls, which I added to the server commands like so:

let g:LanguageClient_serverCommands = {
    \'python' : ['/Users/alokbeniwal/Library/Python/3.6/bin/pyls',]
    \ }

I call :LanguageClientStart and get no error message, but none of the LanguageClient functions are available to call. I'm not sure what's wrong with my installation, since running that executable on the command line gives the following:

2017-03-04 23:23:24,210 UTC - INFO - pyls.language_server - Starting PythonLanguageServer IO language server

`infile.read` is not compatible with vscode-rpc

I'm using vetur's language server. The setup is rather complicated.

And I encountered cross boundary read.

The log looks like

TIMESTAMP  DEBUG     <=  {"jsonrpc":"2.0",
....
'on content inserted into child components to indicate which named slot the content belongs to."}]}}Content-Length: 15

The root cause is the discrepancy how python reading bytes and how vscode-jsonrpc computes length.

Note the vscode-implementation: Buffer.byteLength is used instead of message.length

https://github.com/Microsoft/vscode-languageserver-node/blob/master/jsonrpc/src/messageWriter.ts#L75

This makes LC-neovim misfunctions.

Example response: https://gist.github.com/HerringtonDarkholme/456d6af5d6a8509df00019fc8bd0a973

You can inspect the string length and the Buffer.byteLength difference.

roxma/nvim-completion-manager source?

As deoplete does not support async source, right now completion function is implemented as sync calls.

Might even better support async completion.

roxma/nvim-completion-manager looks cool and actively maintained/developed.

@roxma

Completion usage

I use deoplete for auto-completion.
What's the preferred way of making it use LanguageClient_textDocument_completion as the source? Eg. I would like deoplete do display a window with suggestions in insert mode whenever possible.
Should I keep or uninstall racer?

version or commit of rls

hello,

I was wondering what version or commit of rls you are running? I am on commit db07d336e13e563802692887fc79b3abf9f9db37 and rename seems to fail for me.

"Content-Length: 222\r\n\r\n{\"params\": {\"textDocument\": {\"uri\": \"file:///Users/becker/trash/cargo-becker/src/bin/bench.rs\"}, \"position\": {\"character\": 25, \"line\": 73}, \"newName\": \"Renamed\"}, \"id\": 5, \"jsonrpc\": \"2.0\", \"method\": \"textDocument/rename\"}\0"

response
"{\"jsonrpc\":\"2.0\",\"id\":5,\"result\":{\"changes\":{}}}\0"

I do not think its a problem with the plugin.
thanks
Becker

textDocument/references disabled

textDocument/references is disabled, it is report:

No selection UI found. Consider install fzf or denite.vim.

Maybe the follow code not initialize variable: selectionUI

    @neovim.function('LanguageClient_textDocument_references')
    def textDocument_references(self, args: List) -> None:
        if not self.alive(warn=True):
            return
        logger.info("Begin textDocument/references")

        uri, line, character, sync, cb = self.getArgs(
                args, ["uri", "line", "character", "sync", "cb"])
        if not sync and not cb:
            cb = partial(
                    self.handleTextDocumentReferencesResponse,
                    self.getSelectionUI())

Issues registering with deoplete

When I try to use LanguageClient with deoplete it doesn't work. I looked into the code and made a small diff but I can't troubleshoot it any further becuase I don't really know any details. It works fine with NCM.

I use latest master of both plugins. CheckHealth reports that everything is fine.

diff --git a/rplugin/python3/LanguageClient/LanguageClient.py b/rplugin/python3/LanguageClient/LanguageClient.py
index 8dfd904..64f6402 100644
--- a/rplugin/python3/LanguageClient/LanguageClient.py
+++ b/rplugin/python3/LanguageClient/LanguageClient.py
@@ -277,7 +277,7 @@ class LanguageClient:
                 cm_refresh='LanguageClient_completionManager_refresh'))
             logger.info("register completion manager source ok.")
         except Exception as ex:
-            logger.warn("register completion manager source failed.")
+            logger.warn("register completion manager source failed. %s", ex)
     @neovim.autocmd('BufReadPost', pattern="*")
     @args(warn=False)
23:48:17 WARNING  register completion manager source failed. b'Error calling function.'
$ cat ~/.local/share/nvim/rplugin.vim
" python3 plugins
call remote#host#RegisterPlugin('python3', '/home/niklas/.config/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient', [
      \ {'sync': v:true, 'name': 'LanguageClient_alive', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_completionItem/resolve', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_completionManager_refresh', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_exit', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentDocumentSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentReferences', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkWorkspaceSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'CursorMoved', 'opts': {'pattern': '*', 'eval': 'line(''.'')'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_initialize', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_registerServerCommands', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_setLoggingLevel', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClientStart', 'opts': {}, 'type': 'command'},
      \ {'sync': v:false, 'name': 'LanguageClientStop', 'opts': {}, 'type': 'command'},
      \ {'sync': v:false, 'name': 'TextChanged', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'TextChangedI', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_completion', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_definition', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_didClose', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'BufReadPost', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'BufWritePost', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_documentSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_hover', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_references', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_rename', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_signatureHelp', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_workspace_symbol', 'opts': {}, 'type': 'function'},
     \ ])
call remote#host#RegisterPlugin('python3', '/home/niklas/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete', [
      \ {'sync': v:true, 'name': '_deoplete', 'opts': {}, 'type': 'function'},
     \ ])
" ruby plugins
" python plugins

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.