autozimu / LanguageClient-neovim

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

Single 'd' deletes a line #132

Closed CarwynNelson closed 6 years ago

CarwynNelson commented 7 years ago

Using the PHP language server from Roxma when the language server is enabled LanguageClientStart a single press of the d key delets a line.

Expected functionality is that a single press of the d key would not delete a line, instead, a double press would.

Neovim version

NVIM 0.1.7
Build type: Release

Plugin Version

➜  LanguageClient-neovim git:(master) git rev-parse HEAD 
7611a20542ca6a31d57f17fba2f1ae0e15e3b5e4

Minimal vimrc

call plug#begin('~/.config/nvim/plugins')
Plug 'autozimu/LanguageClient-neovim', { 'do': 'UpdateRemotePlugins' }
Plug 'roxma/LanguageServer-php-neovim',  { 'do': 'composer install && composer run-script parse-stubs' }
call plug#end()

autocmd FileType php LanguageClientStart

Check Health


health#nvim#check
========================================================================
## Configuration
  - SUCCESS: no issues found

## Performance
  - SUCCESS: Build type: Release

## Remote Plugins
  - SUCCESS: Up to date

## terminfo
  - INFO: key_backspace terminfo entry: key_backspace=\177,

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

## Python 2 provider
  - INFO: `g:python_host_prog` is not set.  Searching for python2 in the environment.
  - INFO: There are multiple python2 executables found.  Set "g:python_host_prog" to avoid surprises.
  - INFO: Executable: /usr/bin/python2
  - INFO: Other python executable: /bin/python2
  - INFO: Python2 version: 2.7.5
  - INFO: python2-neovim version: 0.1.13
  - SUCCESS: Latest python2-neovim is installed: 0.1.13

## Python 3 provider
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/local/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: not found
  - INFO: Host Executable: not found
  - INFO: Host Version: not found

rplugin.vim I do not have an rplugin.vim.

LangaugeClient log Does not seem to contain anything except for logs of files being parsed.

CarwynNelson commented 7 years ago

Just a little bit of an update. This appears to be happening when parsing is underway, ie at the bottom, the following message is shown in vim:

[Log] Parsing file:///home/user/code/location/to/file.php

When a project is fully parsed this does not seem to be an issue. I'm still waiting for the current project I'm having this issue with to parse - which could take a while considering how large it is.

I will update when I have more information.

Update: It looks like my previous assumption was correct. If the project is parsing files (or I imagine any high load) the d key (and other keys) only require one press to do an action that would typically require more than one.

This looks similar to issue #460 in deoplete (which I am not using). Maybe this same, or a similar fix would work?

Shougo commented 7 years ago

Yes, I think it is the same problem.

This looks similar to issue #460 in deoplete (which I am not using). Maybe this same, or a similar fix would work?

It is the timer feature problem. If the timer is fired, the mapping will be canceled.

Shougo commented 7 years ago

https://github.com/roxma/nvim-completion-manager/issues/87

CarwynNelson commented 7 years ago

Is this something that can be easily resolved?

Shougo commented 7 years ago

I have searched LanguageClient-neovim, but I cannot find the timer.

It is the real minimal vimrc?

call plug#begin('~/.config/nvim/plugins')
Plug 'autozimu/LanguageClient-neovim', { 'do': 'UpdateRemotePlugins' }
Plug 'roxma/LanguageServer-php-neovim',  { 'do': 'composer install && composer run-script parse-stubs' }
call plug#end()

autocmd FileType php LanguageClientStart

I think you have installed other auto completion plugin.

CarwynNelson commented 7 years ago

My normal vimrc includes roxma/nvim-completion-manager, but I removed my plugins folder and ran UpdateRemotePlugins to clear everything out before writing the above vimrc so that I could narrow down the issue.

EDIT: I'm assuming that this is the correct way to clear out all plugins?

Shougo commented 7 years ago

I think nvim-completion-manager works. You should set runtimepath manually without the plugin manager.

CarwynNelson commented 7 years ago

I'm not sure I follow? Is the issue not in the LanguageClient-neovim plugin?

Happy to close if it is not.

Shougo commented 7 years ago

I think it is not LanguageClient-neovim problem. Please check.

CarwynNelson commented 7 years ago

Hi @Shougo

I should probably mention that my experience with neovim is limited and I'm not that great at vim either. I switched from a fairly basic vim setup to emacs with evil mode a while back and now I'm looking to get back to vim with neovim.

When you say set runtimepath I'm not entirely sure what you are referring to. I understand from reading the help file that this just tells vim where to look for config files - but I'm not sure I understand how this helps me debug the problem?

I've deleted my old config, added the one above, deleted my plugins folder and ran :set runtimepath which outputs this:

runtimepath=~/.config/nvim,~/.config/nvim/plugins/LanguageClient-neovim/,~/.config/nvim/plugins/Langua
geServer-php-neovim/,/etc/xdg/nvim,~/.local/share/nvim/site,~/.local/share/flatpak/exports/share/nvim/si
te,/var/lib/flatpak/exports/share/nvim/site,/usr/local/share/nvim/site,/usr/share/nvim/site,/usr/share/n
vim/runtime,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,/var/lib/flatpak/exports/share/n
vim/site/after,~/.local/share/flatpak/exports/share/nvim/site/after,~/.local/share/nvim/site/after,/etc/
xdg/nvim/after,~/.config/nvim/after

the nvim-completion-manager plugin does not appear to be on the runtimepath and yet the issue still persists. Am I missing something there? Or doing something wrong?

mike-zorn commented 7 years ago

@Shougo I'm having the same issue and I am using deoplete. Any information I can provide to help out here?

mike-zorn commented 7 years ago

Actually, ignore me for now. I am having issues isolating the problem with a minimal .vimrc. I'll update this issue if I am able to find a minimal .vimrc I can reproduce with.

autozimu commented 7 years ago

EDIT: I'm assuming that this is the correct way to clear out all plugins?

It is the correct way to try minimal vimrc.

This project does not use timer. Not sure what happened in your situation.

Could you reproduce the issue with a public available repo?

Shougo commented 7 years ago

Actually, ignore me for now. I am having issues isolating the problem with a minimal .vimrc. I'll update this issue if I am able to find a minimal .vimrc I can reproduce with.

Please provide the reproduce ways.

CarwynNelson commented 7 years ago

I've just tried this on a different machine (macbook pro) which has never had neovim on it before. Same vimrc and the bug persists.

As an example of loading in a large project I am using microsoft/tolerant-php-parser.

EDIT: Could this possibly be a bug in vim?

autozimu commented 7 years ago

That's not a valid min vimrc.

When I start neovim with the provided vimrc, got "No language server found for php", which is a valid error message for the given vimrc.

Please verify.

CarwynNelson commented 7 years ago

Hi @autozimu

Do you have to run :PlugInstall - or have Plug installed?

autozimu commented 7 years ago

Yes, I do have it installed.

roxma/LanguageServer-php-neovim will register the php language server at some point at startup. And when opening a file with nvim -u min-vimrc src/Node.php, because of autocmd FileType php LanguageClientStart, neovim will try start LanguageClient, but at this point, the php language server hasn't been registered by roxma/LanguageServer-php-neovim yet. That's why I'm saying the provided vimrc is not a valid one to reproduce the issue.

Please make sure you are using the real min vimrc to reproduce the issue, not your original vimrc, either by replace your vimrc file with min vimrc, or with command nvim -u min-vimrc src/Node.php.

autozimu commented 7 years ago

Actually please ignore my previous comment. I made a mistake when running with the min vimrc.

I got a blocking issue when trying to reproduce the issue,

10:37:25 DEBUG   [RPC-php   ] <= Warning: Unterminated comment starting line 2 in /Users/lijunfen/.local/share/nvim/plugged/LanguageServer-php-neovim/vendor/microsoft/tolerant-php-parser/src/PhpTokenizer.php on

After seeing this message at initialization, the php language server stopped responding. Might because of latest changes.

vorner commented 7 years ago

I might have some observations that might (or might not) be relevant to the issue.

I can reproduce it quite often, this is how:

autozimu commented 7 years ago

Thanks for the info, @vorner . I will try with it to see if I can get more insight.

autozimu commented 7 years ago

@vorner Could you provide the project link if it is open source?

I tried a few c++ projects. clangd either works instantaneously or never respond.

vorner commented 7 years ago

Unfortunately no, it is company code. However, I suspect it might be caused by the catch unit testing framework included in the source code.

If this still doesn't help, I'll try to create a fake language server that simulates the long response times.

vorner commented 7 years ago

OK, I tried to create a fake language server that helps me to reproduce the problem quite reliably: https://github.com/vorner/sls. It is in rust, so building with cargo install or similar should work.

I then configured the language server for text file type, opened x.txt and typed fast for a while. Then hit bbcw and with like 50% chance it produced the behaviour.

The sls thing just produces a publishDiagnostics notification after a short while for each didChange and responds with small dummy completion result. The requests are blocking ‒ if you type fast, you create a backlog and the answers come as they get served.

autozimu commented 7 years ago

Great, thanks a lot for your effort!

I will see what I can do.

vorner commented 7 years ago

Another observation. If I don't load deoplete, I can't reproduce. So it seems to be somewhere inside the integration with deoplete, maybe…

autozimu commented 7 years ago

I actually tried with the language server, but still cannot reproduce this issue.

Could you try a different completion framework, like https://github.com/roxma/nvim-completion-manager?

vorner commented 7 years ago

I've already migrated to NCM because I don't get the problem with it. The thing is, I don't get the problems with deoplete without the language client, it's just the two together.

vorner commented 7 years ago

I upgraded to neovim 0.2.1 and I can no longer reproduce it either.

autozimu commented 7 years ago

Thanks for the update.

I’m actually using 0.2.1 long before the official release. That’s probably the reason why I never seen this issue.

On Mon, Nov 13, 2017 at 12:56 vorner notifications@github.com wrote:

I upgraded to neovim 0.2.1 and I can no longer reproduce it either.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/autozimu/LanguageClient-neovim/issues/132#issuecomment-344055198, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYt72qCGiRNstYxk-czdCJHjPH7rfOLks5s2K0GgaJpZM4PcPi0 .

joereynolds commented 6 years ago

It's an issue with Neovim's timers that have since been fixed in newer versions. I raised an identical issue on a different plugin a few months back

https://github.com/xtal8/traces.vim/issues/4

CarwynNelson commented 6 years ago

If the issue was fixed in neovim 0.2.1 then I am more than happy to close this issue.

Is it worth maybe adding this to the documentation under something like Common Issues or Troubleshooting?

autozimu commented 6 years ago

Sounds good.

On Fri, Dec 8, 2017 at 01:32 Carwyn Nelson notifications@github.com wrote:

If the issue was fixed in neovim 0.2.1 then I am more than happy to close this issue.

Is it worth maybe adding this to the documentation under something like Common Issues or Troubleshooting?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/autozimu/LanguageClient-neovim/issues/132#issuecomment-350217220, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYt73XM5DGFy8UEOwyLEvzynEeWZ9_Rks5s-QIcgaJpZM4PcPi0 .