question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

textDocument/definition not working

See original GitHub issue

Hi nice work,

I have some problems using the goto definition feature. My setup include nvim + LanguageClient (or even builtin LSP) and jedi-language-server.

The problem in my case is that when calling LanguageClient#textDocument_definition() the cursor do not move, nvim complains as:

[LC] data did not match any variant of untagged enum GotoDefinitionResponse

and the client log is as follows:

17:04:44 DEBUG reader-Some("python") src/rpcclient.rs:207 <= Some("python") {"id": 1, "jsonrpc": "2.0", "result": [{"uri": null, "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 7}}}]}
17:04:44 ERROR unnamed src/rpchandler.rs:27 Error handling message: data did not match any variant of untagged enum GotoDefinitionResponse
Message: {"jsonrpc":"2.0","method":"textDocument/definition","params":{"bufnr":1,"character":0,"filename":"/home/mauro/t.py","gotoCmd":null,"handle":true,"languageId":"python","line":4,"text":["def foo():","    print('FOO')","","","foo()",""]},"id":1}
Error: data did not match any variant of untagged enum GotoDefinitionResponse

In particular note that it seams that the server do not send back the URI to the file, instead there is a null entry, and that with the method textDocument/publishDiagnostics, the server send back the right URI to the file position.

I found the same problem with anakin https://github.com/muffinmad/anakin-language-server/issues/17 but not with other servers such as python-language-server.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pappasamcommented, Dec 25, 2020

On second thought, since this tool targets the latest version of Jedi, I’ll just wait for the next version of Jedi and use the path objects directly (pinning the latest Jedi version in that release). from_fs_path is unnecessary when working with pathlib.Path objects; it provides its own as_uri method.

Anyway, thanks for raising this and I look forward to Jedi’s next version’s stabilization!

0reactions
pappasamcommented, Jan 13, 2021

resolved in the latest published release (0.22.0)!

Read more comments on GitHub >

github_iconTop Results From Across the Web

textDocument/definition not working #2654 - GitHub
build tool: stack CI Continuous integration type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Read more >
nvim-lspconfig error 'method textDocument/codeAction is not ...
I config vimls in nvim-lspconfig, but get an error with my cursor move. Error detected while processing CursorHold Autocommands for "*": method…
Read more >
VS Code - Request textDocument/definition failed
I want to code and debug my own code, not manage my ecosystem of tools and debug their problems. At least they should...
Read more >
Lsp - Neovim docs
Q: Why isn't completion working? ... To override the handler for the "textDocument/definition" method: vim.lsp.handlers["textDocument/definition"] = ...
Read more >
Language Server Protocol Specification - 3.17
This mechanism can be used to report any kind of progress including work done ... the server most likely should not reorder textDocument/definition...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found