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

Migrate from deprecated MarkedString to MarkupContent #21

Closed
krassowski opened this issue Apr 25, 2021 · 1 comment · Fixed by #80
Closed

Migrate from deprecated MarkedString to MarkupContent #21

krassowski opened this issue Apr 25, 2021 · 1 comment · Fixed by #80
Milestone

Comments

@krassowski
Copy link
Contributor

Both hover's content and completion's documentation return a plain string:

  • in the case of hover it indicates a MarkedString which is explicitly deprecated in favour of MarkupContent
  • in case of completion the use of string is not deprecated, but MarkupContent is allowed and would make the transition to markdown easier in the future

MarkupContent was added in 3.3.0 (11/24/2017) which was 4 years ago and should be safe to transition now given that most clients already support much newer versions of LSP specification (usually at least 3.14).

Updating the following function to return a dictionary complying with MarkupContent interface will be sufficient:

def format_docstring(contents):
"""Python doc strings come in a number of formats, but LSP wants markdown.
Until we can find a fast enough way of discovering and parsing each format,
we can do a little better by at least preserving indentation.
"""
contents = contents.replace('\t', u'\u00A0' * 4)
contents = contents.replace(' ', u'\u00A0' * 2)
return contents

See https://github.com/krassowski/python-language-server/pull/4/files.

@ccordoba12
Copy link
Member

I agree with this change, as long as it keeps returning plain text and not only Markdown.

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

Successfully merging a pull request may close this issue.

2 participants