Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single 'd' deletes a line #132

Closed
CarwynNelson opened this issue Sep 19, 2017 · 33 comments
Closed

Single 'd' deletes a line #132

CarwynNelson opened this issue Sep 19, 2017 · 33 comments

Comments

@CarwynNelson
Copy link

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
Copy link
Author

CarwynNelson commented Sep 19, 2017

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
Copy link

Shougo commented Sep 20, 2017

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
Copy link

Shougo commented Sep 20, 2017

@CarwynNelson
Copy link
Author

Is this something that can be easily resolved?

@Shougo
Copy link

Shougo commented Sep 20, 2017

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
Copy link
Author

CarwynNelson commented Sep 20, 2017

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
Copy link

Shougo commented Sep 20, 2017

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

@CarwynNelson
Copy link
Author

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

Happy to close if it is not.

@Shougo
Copy link

Shougo commented Sep 20, 2017

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

@CarwynNelson
Copy link
Author

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
Copy link

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

@mike-zorn
Copy link

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
Copy link
Owner

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
Copy link

Shougo commented Sep 21, 2017

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
Copy link
Author

CarwynNelson commented Sep 21, 2017

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
Copy link
Owner

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
Copy link
Author

Hi @autozimu

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

@autozimu
Copy link
Owner

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
Copy link
Owner

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
Copy link

vorner commented Nov 3, 2017

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

  • It isn't just d. It's mostly anything that is multi-keypress sequence (cw, d%…). It sometimes „presses“ the first key again, changing it into things like cc and then writing w.
  • I think it happens either when a request to the language server is in progress (eg. the rpc was sent, but the answer hasn't arrived yet) or maybe when the answer arrives between the first and second keypress.

I can reproduce it quite often, this is how:

  • I use clangd (language server for C and C++) from clang 5.
  • Since the thing is buggy (crashes, doesn't handle the JSON fields in arbitrary order, etc), I wrap it into this thing: https://github.com/vorner/jsonrpc-param-ord/ (sorry, the readme there is outdated, but simply running this should just start the clangd inside itself and re-format the requests so it kind of works).
  • The clangd doesn't aggregate multiple changes when they come too fast. Therefore, if there's a file that takes a long time to compile and you type fast, it gets a large backlog of requests it hasn't answered yet, it eats 100% CPU for a while before it catches up. During this time the problem happens almost reliably ‒ when the backlog is made and it takes several seconds to catch up, just press ESC cw and see a w being written instead of a word disappearing. When I wait for clangd to process everything (and drop to 0% CPU), it starts working as it should again.

@autozimu
Copy link
Owner

autozimu commented Nov 3, 2017

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

@autozimu
Copy link
Owner

autozimu commented Nov 3, 2017

@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
Copy link

vorner commented Nov 4, 2017

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
Copy link

vorner commented Nov 7, 2017

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
Copy link
Owner

autozimu commented Nov 7, 2017

Great, thanks a lot for your effort!

I will see what I can do.

@vorner
Copy link

vorner commented Nov 11, 2017

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
Copy link
Owner

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
Copy link

vorner commented Nov 13, 2017

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
Copy link

vorner commented Nov 13, 2017

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

@autozimu
Copy link
Owner

autozimu commented Nov 13, 2017 via email

@joereynolds
Copy link

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

markonm/traces.vim#4

@CarwynNelson
Copy link
Author

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
Copy link
Owner

autozimu commented Dec 8, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants