autozimu / LanguageClient-neovim

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

rename with multiple buffers fails when `set nohidden` #5

Closed sbeckeriv closed 6 years ago

sbeckeriv commented 7 years ago

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))
autozimu commented 7 years ago

Hi, thanks for reporting.

It seems like neovim errors out when trying to switch to a different buffer while current buffer has unsaved changes.

Please try this in your config

set hidden

which will allow the previous described operations through.

I should have include it in the quick start or doc somewhere.

sbeckeriv commented 7 years ago

yah set hidden did it. For some reason I dont normally have hidden set. thanks! worked well. Quick start would be a good place to put it. maybe parse the error message and suggest set hidden or can you set it for the call?

Thanks again! Becker

autozimu commented 7 years ago

I've include it in quick start. Thanks.

As for the parse error message suggestion, I believe it belong to some low priority queue. Maybe we can revisit it later after I implement all the missing functionality.

autozimu commented 6 years ago

The error message is clear enough for a normal vim user. Plus I don't see a straightforward workaround for this.