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

C++ rename refactoring with cquery fails #217

Closed
vargheseg opened this issue Dec 15, 2017 · 3 comments
Closed

C++ rename refactoring with cquery fails #217

vargheseg opened this issue Dec 15, 2017 · 3 comments

Comments

@vargheseg
Copy link

vargheseg commented Dec 15, 2017

Installation Details:

  • neovim v0.2.1-dev
  • Plugin version: 55bbfac
  • Language server: cquery (a90a1b31c4ba51156f8c43ee66ef716afd6eebf7)

Issue:

Refactoring class name Foo to Fo, with :call LanguageClient_textDocument_rename()
fails in the code below:

#include <iostream>

class Foo {
    public:
        int bar;
};

int main(int argc, char* argv[]) {
    Foo foo;
    int a;
    std::cout << 9;
}

langserver_error

Logs

From LanguageClient.log

2017-12-16T00:21:00.240679041+01:00 INFO languageclient::languageclient - => {"jsonrpc":"2.0","method":"textDocument/rename","params":{"newName":"Fo","position":{"character":4,"line":8},"textDocument":{"uri":"file_path_to_main.cpp"}},"id":38}

2017-12-16T00:21:00.241042531+01:00 INFO languageclient::languageclient - <= {"jsonrpc":"2.0","id":38,"result":{"documentChanges":[{"textDocument":{"uri":"file_path_to_main.cpp","version":0},"edits":[{"range":{"start":{"line":2,"character":6},"end":{"line":2,"character":9}},"newText":"Fo"},{"range":{"start":{"line":8,"character":4},"end":{"line":8,"character":7}},"newText":"Fo"}]}]}}

2017-12-16T00:21:00.242505962+01:00 ERROR languageclient::languageclient - Error handling message. Message: {"id": 4, "jsonrpc": "2.0", "method": "textDocument/rename", "params": {"character": 4, "handle": true, "languageId": "cpp", "line": 8, "buftype": "", "cword": "Foo", "filename": "file_path_to_main.cpp"}}. Error: Err(ErrorImpl { code: Message("missing field changes"), line: 0, column: 0 })

From the logs I see cquery responds correctly to the textDocument/rename request, but afterwards the LanguageClient runs into error for some reason.

@MaskRay
Copy link
Contributor

MaskRay commented Dec 15, 2017

The issue seems like: changes? in WorkspaceEdit is optional.

@vargheseg
Copy link
Author

Language Server Protocol v 2-x, seems changes are not optional in WorkspaceEdit.
https://github.com/Microsoft/language-server-protocol/blob/master/versions/protocol-2-x.md#workspaceedit

@DeltaEvo
Copy link
Contributor

@vargheseg LanguageClient-neovim supports 3.x version of the protocol

This plugin use a library that provide LSP Types in Rust but this lib seems to don't have the 3.0 version of WorkspaceEdit https://github.com/gluon-lang/languageserver-types/blob/master/src/lib.rs#L269

I will try to work on this tommorow

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

3 participants