muffinmad / anakin-language-server

Yet another Jedi Python language server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return a list of 2 MarkedStrings for function/classes in textDocument/hover

rwols opened this issue · comments

The first MarkedString should be of the form

{"language": "python", "value": "def foo(bar, baz) -> None"} (put the word def in front of it for a function/method, class for a class)

The second MarkedString should be the plaintext docs of the function/class.

Right now the hover content is a bit dry, I think this can be improved greatly with this simple adjustment.

Screenshot from 2020-05-15 20-51-23

MarkedString is deprecated and it is recommended to use MarkupContent instead.

True, but MarkedString[] is a bit easier to implement in this case.

You can also return MarkupContent like this perhaps:

```python
<def or class> entity
```

```
docstring of entity
```

If you don't wrap the docstring in triple backticks you run the risk of not faithfully representing indentation of the docstring.

Of course first detecting whether the client supports markdown content (which the LSP plugin does).

Great idea! Though with class prefix doesn't look nice:

Screenshot 2020-05-16 at 00 03 47