pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
572 stars 44 forks source link

Hover on notebook fails #262

Closed karthiknadig closed 11 months ago

karthiknadig commented 1 year ago

Steps to reproduce:

  1. Install VS Code and ms-python.python extension
  2. Set "Python: Language Server" == Jedi
  3. Use an .py or .ipynb file
  4. Check notebook-languageserver or Extension Host Output
notebook-languageserver logs:
ERROR:pygls.protocol:Failed to handle request 16 textDocument/hover HoverParams(text_document=TextDocumentIdentifier(uri='file:///Users/joshrichardson/src/josh-test-project/_NotebookConcat_6f44cb10b80a.py'), position=0:0, work_done_token=None)
Traceback (most recent call last):
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/pygls/protocol.py", line 337, in _handle_request
    self._execute_request(msg_id, handler, params)
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/pygls/protocol.py", line 261, in _execute_request
    self._send_response(msg_id, handler(params))
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/jedi_language_server/server.py", line 378, in hover
    jedi_script.help(
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/jedi/api/helpers.py", line 484, in wrapper
    raise ValueError('`column` parameter (%d) is not in a valid range '
ValueError: `column` parameter (1) is not in a valid range (0-0) for line 1 ('').
ERROR:pygls.protocol:Failed to handle request 21 textDocument/documentSymbol DocumentSymbolParams(text_document=TextDocumentIdentifier(uri='file:///'), work_done_token=None, partial_result_token=None)
Traceback (most recent call last):
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/pygls/protocol.py", line 337, in _handle_request
    self._execute_request(msg_id, handler, params)
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/pygls/protocol.py", line 261, in _execute_request
    self._send_response(msg_id, handler(params))
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/jedi_language_server/server.py", line 433, in document_symbol
    jedi_script = jedi_utils.script(server.project, document)
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/jedi_language_server/jedi_utils.py", line 108, in script
    return Script(code=document.source, path=document.path, project=project)
  File "/Users/joshrichardson/.vscode-insiders/extensions/ms-python.python-2023.5.10661006/pythonFiles/lib/jedilsp/pygls/workspace.py", line 288, in source
    with io.open(self.path, 'r', encoding='utf-8') as f:
IsADirectoryError: [Errno 21] Is a directory: '/'

reference: https://github.com/microsoft/vscode-python/issues/20811

pappasam commented 1 year ago

This issue is requesting ipynb support.

dimbleby commented 1 year ago

or is it just asking that https://github.com/pappasam/jedi-language-server/commit/1a75efb491599e6ba69d7c08b637f881586dddb5 be reverted?

I took a look at what was going on there and I believe that the underlying jedi issue is https://github.com/davidhalter/jedi/pull/1923 (of course it might take some time for that fix to reach a release)

davidhalter commented 1 year ago

Will release very soon for various reasons. Expect a release in the next few weeks.