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

navigator.definition breaks with jedi_language_server #242

Open
cj opened this issue Oct 26, 2022 · 1 comment
Open

navigator.definition breaks with jedi_language_server #242

cj opened this issue Oct 26, 2022 · 1 comment

Comments

@cj
Copy link

cj commented Oct 26, 2022

I'm using the latest version of navigator.lua with nvim 0.8:

I am getting this error with the command lua require('navigator.definition').definition():

Defination: RPC[Error] code_name = InvalidParams, message = "AttributeError: 'str' object has
no attribute 'as_uri'" data = "{'traceback': ['  File \"/Users/cj/apps/snap/snap-data/.venv/li
b/python3.10/site-packages/pygls/protocol.py\", line 324, in _handle_request\\n    self._execu
te_request(msg_id, handler, params)\\n', '  File \"/Users/cj/apps/snap/snap-data/.venv/lib/pyt
hon3.10/site-packages/pygls/protocol.py\", line 249, in _execute_request\\n    self._send_resp
onse(msg_id, handler(params))\\n', '  File \"/Users/cj/apps/snap/snap-data/.venv/lib/python3.1
0/site-packages/jedi_language_server/server.py\", line 246, in definition\\n    definitions =
[jedi_utils.lsp_location(name) for name in names]\\n', '  File \"/Users/cj/apps/snap/snap-data
/.venv/lib/python3.10/site-packages/jedi_language_server/server.py\", line 246, in <listcomp>\
\n    definitions = [jedi_utils.lsp_location(name) for name in names]\\n', '  File \"/Users/cj
/apps/snap/snap-data/.venv/lib/python3.10/site-packages/jedi_language_server/jedi_utils.py\",
line 77, in lsp_location\\n    return Location(uri=name.module_path.as_uri(), range=lsp_range(
name))\\n']}"{
  bufnr = 1,
  client_id = 5,
  method = "textDocument/definition",
  params = {
    position = {
      character = 17,
      line = 5
    },
    textDocument = {
      uri = "file:https:///Users/cj/apps/snap/snap-data/app/core/config.py"
    }
  }
}

lua vim.lsp.buf.definition() works with no errors.

Please let me know if you need any other information!

@ray-x
Copy link
Owner

ray-x commented Oct 26, 2022

Hi, Cj
I did a quick test on jedi. It works fine for me.
Do I need a specific python code and a specific definition to be found to reproduce?

Here is the code I used to test.

def greet(greeting, name):
    """
    This function greets to
    the person passed in as
    a parameter
    """
    print(greeting +        name + ". Good morning!")

def addition(num: int, num2: int = 2, num3: int = 3):
    return num + num2 + num3

def greet(greeting, name, msg1, msg2):
    """
    This function greets to
    the person passed in as
    a parameter
    """
    print(greeting + name + ". Good morning!")


greet("a", "b")  # I put my cursor on `greet`

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

2 participants