Skip to content

saveas makes nvim-lsp run into problems #18688

@srinathava

Description

@srinathava

Neovim version (nvim -v)

NVIM v0.7.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by runner@fv-az316-460

Vim (not Nvim) behaves the same?

no

Operating system/version

Linux x86_64

Terminal name/version

xfce4-terminal / 0.8.10

$TERM environment variable

xterm-256color

Installation

Download binary from https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-linux64.tar.gz

How to reproduce the issue

I apologize that I cannot provide an extremely minimal reproduction since this requires lsp which in turn requires lspconfig which does not ship with nvim by default.

But it is reasonably simple to explain:

I have nvim lsp setup with clangd. It all works fine except if I open a C++ file and issue the command saveas othername.cpp from within it.

Expected behavior

I expect that clangd will pick up definitions etc. in the new file.

Actual behavior

After the saveas command, I get the following error repeatedly printed on the command line:

clangd: -32602: trying to get AST for non-added document

From what I can see from looking at ~/.cache/nvim/lsp.log, it looks like during the saveas command, nvim did not provide a bufOpen command to clangd and directly asked for documentHighlights on the new file name. I'm attaching the relevant log file.

nvim-lsp-bug.log.txt

When I tried this with coc.nvim, it looks like it does the right thing. As a comparison, the log with coc.nvim is below:

coc-nvim-lsp.log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions