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

:LspHover provide hugly formating #523

Open
LuisBL opened this issue May 26, 2024 · 8 comments
Open

:LspHover provide hugly formating #523

LuisBL opened this issue May 26, 2024 · 8 comments

Comments

@LuisBL
Copy link

LuisBL commented May 26, 2024

Below rendering of :LspHover Vs the one provide by ipython

image

I don't know if it's my configuration or a lsp problem or python-lsp-server side ?

my version of python-lsp-server

  $ pyenv virtualenv system lsp
  $ pyenv activate lsp
  (lsp) $ pip install python-lsp-server[all] -U
  (lsp) $ pip list | grep -E 'lsp'
  python-lsp-jsonrpc    1.1.2
  python-lsp-server     1.11.0
  (lsp) $

vim 9.0:

  $ vim --version | head -1
  VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 10 2022 08:40:37)
  $

my .vimrc:

  $ tail -14 ~/.vimrc
  call plug#begin('~/.vim/plugged')
    Plug 'yegappan/lsp'
  call plug#end()

  let lspOpts = #{autoHighlightDiags: v:true}
  autocmd User LspSetup call LspOptionsSet(lspOpts)

  let lspServers = [#{ name: 'pylsp',
                   \   filetype: 'python',
                   \   path: 'expand(~/.pyenv/versions/lsp/bin/pylsp'),
                   \   args: ['--verbose', '--log-file', '/tmp/out_lsp.log'],
                   \ }]
  autocmd User LspSetup call LspAddServer(lspServers)
  $
@LuisBL
Copy link
Author

LuisBL commented Jul 14, 2024

any news on this ?

@mariobelmar
Copy link

i have the exact same problem.

@Konfekt
Copy link
Contributor

Konfekt commented Jul 18, 2024

Isn't this similar to #296 ?

@suonpaa
Copy link

suonpaa commented Sep 9, 2024

Have you guys found any solution to this?

@rcasta74
Copy link
Contributor

rcasta74 commented Dec 7, 2024

Hi, I have given look to this issue; this is what pylsp is responding:

12/07/24 14:53:49: Sent {'method': 'textDocument/hover', 'params': {'textDocument': {'uri': 'file:///home/roberto/test.py'}, 'position': {'character': 8, 'line': 2}}}
12/07/24 14:53:49: Received {'id': 2, 'jsonrpc': '2.0', 'result': {'contents': {'kind': 'markdown', 'value': '```python^@load(fp: SupportsRead[Union[str, bytes]], *, cls: Optional[Type[JSONDecoder]]=..., object_hook: Optional[Callable[[Dict[Any, Any]], Any]]=..., parse_float: Optional[Callable[[str], Any]]=..., parse_int: Optional[Callable[[str], Any]]=..., parse_constant: Optional[Callable[[str], Any]]=..., object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]]=..., **kwds: Any) -> Any^@```^@^@^@Deserialize ``fp`` (a ``.read()``-supporting file-like object containing^@a JSON document) to a Python object.^@^@``object\_hook`` is an optional function that will be called with the^@result of any object literal decode (a ``dict``). The return value of^@``object\_hook`` will be used instead of the ``dict``. This feature^@can be used to implement custom decoders (e.g. JSON-RPC class hinting).^@^@``object\_pairs\_hook`` is an optional function that will be called with the^@result of any object literal decoded with an ordered list of pairs.M-BM- M-BM- The^@return value of ``object\_pairs\_hook`` will be used instead of the ``dict``.^@This feature can be used to implement custom decoders.M-BM- M-BM- If ``object\_hook``^@is also defined, the ``object\_pairs\_hook`` takes priority.^@^@To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``^@kwarg; otherwise ``JSONDecoder`` is used.'}}}

As you can see there are no newlines within the code block, so the documentation is rendered correctly with respect to the reply of pylsp.

I have tried also with coc.nvim plugin (using coc-pylsp extension).

This is how it looks with coc.nvim:
2024-12-07_14-52
and this is how it looks with lsp plugin:
2024-12-07_14-55

They are pretty similar, so I think that the issue should be investigated within python-lsp-server.

@rcasta74
Copy link
Contributor

rcasta74 commented Dec 7, 2024

Opened python-lsp/python-lsp-server#606

@suonpaa
Copy link

suonpaa commented Dec 7, 2024

Seems right. This should be closed here.

@rcasta74
Copy link
Contributor

rcasta74 commented Dec 8, 2024

As well #506 and #296

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

5 participants