You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The formatting of signatures in hover and code completion documentation is fine for signatures of small functions:
but is not necessarily readable for functions with many complex arguments:
Proposed solution
Add a hook allowing to format the signature with a formatter of choice, e.g. with black. Users could then customize the number of characters in a lines, wrapping, and potentially custom highlighting (instead of using code fences).
Context
Currently docstrings in hover and completion documentation are composed of two parts:
signature
the docstring itself
The docstring gets formatted by docstring-to-markdown which now supports entrypoints allowing to add support for custom formats used in internal codebases or to override the formatting.
Problem
The formatting of signatures in hover and code completion documentation is fine for signatures of small functions:
but is not necessarily readable for functions with many complex arguments:
Proposed solution
Add a hook allowing to format the signature with a formatter of choice, e.g. with
black
. Users could then customize the number of characters in a lines, wrapping, and potentially custom highlighting (instead of using code fences).Context
Currently docstrings in hover and completion documentation are composed of two parts:
The docstring gets formatted by
docstring-to-markdown
which now supports entrypoints allowing to add support for custom formats used in internal codebases or to override the formatting.python-lsp-server/pylsp/_utils.py
Lines 212 to 241 in cc6d398
The signature part formatting is hard-coded to use
wrap_signature
:python-lsp-server/pylsp/_utils.py
Lines 194 to 195 in cc6d398
The signature strings come from jedi's
BaseSignature.to_string()
method:python-lsp-server/pylsp/plugins/jedi_completion.py
Lines 213 to 216 in cc6d398
python-lsp-server/pylsp/plugins/hover.py
Lines 33 to 50 in cc6d398
The text was updated successfully, but these errors were encountered: