pappasam/jedi-language-server

Function information provided by Jedi lacks newlines

Closed this issue · 2 comments

I'm using the Jedi language server in VS Code with the my-python extension and see missing newlines in the function outlines it shows when hovering over a function or in this case, a property.

I'm unsure if that's something that VS Code gets wrong, or the LSP extension sends wrong in the first place; opening the issue here as a starting point, please let me know if I should file it somewhere else.

Steps to reproduce

  • Add this code to a Python file in VS Code:
something = Path('hello.txt')
something.suffix 
  • Hover with your mouse over "suffix"

Actual
The implementation of PurePath.suffix is shown, without newlines.

grafik

Expected
Newlines are shown, as in (abbreviated)

def suffix(self):
    """The final component's last suffix, if any."""

When running the jedi LSP server with verbose output I see the following interaction.

INFO:pygls.protocol:Sending data: {"jsonrpc": "2.0", "id": 813, "result": {"contents": {"kind": "markdown", "value": "```python\ndef suffix(self): \"\"\"The final component's last suffix, if any.\"\"\" name = self.name i = name.rfind('.') if 0 < i < len(name) - 1: return name[i:] else: return ''\n```\n---\n```text\nThe final component's last suffix, if any.\n```\n**Full name:** `pathlib.PurePath.suffix`"}, "range": {"start": {"line": 133, "character": 41}, "end": {"line": 133, "character": 47}}}}

Newlines (\n) are there, but I'm unsure if that's the way things are expected to be according to the LSP?

Version: 1.65.0
Commit: 2e6cb65aa783ab7f17c9d3e709e65c65f8da3bb0
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Embedder: unknown

Extension version: 2022.2.1924087327


Note: I have initially reported this issue with the ms-python VS Code extension and was asked to move it here. With multiple moving parts involved I'm unsure which part "gets it wrong".

@imphil please take a look at the linked PR / screenshot and let me know if that acceptably resolves your issue!

@pappasam The screenshot looks great, thanks! (I'll get back if the next VS code update arrives and I find remaining issues.)