autozimu / LanguageClient-neovim

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

Getting " [LC] 'Vim(return):Can''t send data to closed stream' " from neovim after closing .sh & init.vim #1127

Closed iddinev closed 3 years ago

iddinev commented 3 years ago

Describe the bug

When I modify files I get the error from the title printed on my terminal.

Environment

Features: +acl +iconv +tui


- This plugin version (`git rev-parse --short HEAD`):
**d6d6d08**
- This plugin's binary version (`bin/languageclient --version`):
****languageclient 0.1.160****
- Minimal vimrc content (A minimal vimrc is the smallest vimrc that could
  reproduce the issue. Refer to an example [here][min-vimrc.vim]):
- Language server link and version:
[Bash - 1.17.0](https://github.com/bash-lsp/bash-language-server)
[Vim - 2.0.0](https://github.com/iamcco/vim-language-server)
[Python - 0.35.1](https://github.com/palantir/python-language-server)
[min-vimrc.vim]: https://github.com/autozimu/LanguageClient-neovim/blob/next/min-vimrc.vim

## To Reproduce

Steps to reproduce the behavior:

- Open the sample python file (or any other python/bash/vim file) using the min-vimrc.
- Edit the file (remove/add line).
- :wq.

## Current behavior

Most of the times I do the steps I get the error message, sometimes I get the message without modifying the file at all - just doing :wq.

## Expected behavior
This not happening anymore.

## Screenshots

![image](https://user-images.githubusercontent.com/11410938/97812668-8f96f900-1c8b-11eb-906e-425dcc6342b1.png)

## Additional context

Issue mentiond on the bash-language-server repo - https://github.com/bash-lsp/bash-language-server/issues/112
Another person has stated that he has not observed the issue with other LCs (CoC) and that he has observed the problem with other servers when running LanguageClient-neovim.
martskins commented 3 years ago

Yep, can reproduce. Could reproduce with 0.1.158 as well. Will look into it but I'm fairly sure that's just our handleBufWritePost autocmd trying to run after w but not getting there before q so it shouldn't be critical. As as temporary workaround, if you set let g:LanguageClient_loggingLevel = 'ERROR' (instead of INFO, which I presume you have) that message won't be visible.

iddinev commented 3 years ago

Somehow I managed to spend 30 min troubleshooting the issue with the minimal rc without realizing that this is just a logging message not being written to the proper place... Indeed I have the logging level set to 'INFO'...

martskins commented 3 years ago

@iddinev #1128 should fix this. If you want to try it out you can check that branch out and build from source. I'll give it a spin for today an tomorrow and if everything is right I'll merge, at which point it will be available in the dev branch.

iddinev commented 3 years ago

I just pulled your branch and gave it a go - issue seems fixed. The change is only in vim script code so I don't actually need to build anything right ?

martskins commented 3 years ago

Ah yeah my bad, I just defaulted to the usual explanation but yeah, you don't need to build anything for this one 👍