Skip to content

After rename across files, didChange returns the wrong text content #659

@snoe

Description

@snoe

Describe the bug

Rename a symbol that is present in two files.

When the server sends back the two textEdits they are properly applied.

However, the follow up didChange notice for both documents contains the text content from the first file.

Environment

  • neovim/vim version (nvim --version or vim --version): NVIM v0.3.0
  • This plugin version (git rev-parse --short HEAD): 95608f5
  • This plugin's binary version (bin/languageclient --version): languageclient 0.1.127
  • Minimal vimrc content (A minimal vimrc is the smallest vimrc that could
    reproduce the issue. Refer to an example here):
  • Language server link and version: https://github.com/snoe/clojure-lsp release-20181120T050154

To Reproduce

text of test.clj = "(defn foo [])"
text of thing.clj = "(declare foo)"
rename to produce a change like this (see lc-errors.log[0] line 279):

{"jsonrpc":"2.0","result":{"changes":{"file:///private/tmp/test.clj":[{"newText":"foobar","range":{"end":{"character":9,"line":0},"start":{"character":6,"line":0}}}],"file:///private/tmp/thing.clj":[{"newText":"foobar","range":{"end":{"character":12,"line":0},"start":{"character":9,"line":0}}}]}},"id":5}

Current behavior (see lc.errors.log[0] lines 332 and 319)

didChange.text of test.clj = "(defn foobar [])"
didChange.text of thing.clj = "(defn foobar [])"

Expected behavior

didChange.text of test.clj = "(defn foobar [])"
didChange.text of thing.clj = "(declare foobar)"

Additional context

Lines 313-316 look suspicious, it seems LSP#text() is being run and getting the current buffer's text?

23:07:51 INFO main src/languageclient.rs:49 gather_args: [LanguageId, Filename] = [String("clojure"), String("/private/tmp/thing.clj")]
23:07:51 INFO main src/languageclient.rs:30 Some arguments are not available. Requesting from vim. Keys: ["text"]. Exps: ["LSP#text()"]
23:07:51 INFO main src/vim.rs:92 => None {"jsonrpc":"2.0","method":"eval","params":["[LSP#text()]"],"id":53}
23:07:51 INFO reader-main src/vim.rs:390 <= None {"id": 53, "jsonrpc": "2.0", "result": [["(defn foobar [])", ""]]}

lc-errors.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions