Skip to content

honour hover.content_format client capability #6140

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

Merged
merged 4 commits into from
Oct 6, 2020
Merged

Conversation

robinvd
Copy link
Contributor

@robinvd robinvd commented Oct 5, 2020

This removes all markdown when the client does not support the markdown MarkupKind.

Otherwise the output on the editor will have some markdown boilerplate, making it less readable.

For example kak_lsp does not currently support markdown.
image

after:
image

This removes all markdown when the client does not support the markdown MarkupKind

Otherwise the output on the editor will have some markdown boilerplate, making it less readable
match event {
Event::Text(text) | Event::Code(text) => out.push_str(&text),
Event::SoftBreak | Event::HardBreak | Event::Rule => out.push('\n'),
_ => {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should also push * for list items. Otherwise

  • foo
  • bar

would be rendered as

foo
bar

which doesn't look like a list at all. You should also render tables using ascii art I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where it goes, but is it possible to preserve the empty line in the example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lnicola in the screenshot? that might be possible, and indeed look better.

@bjorn3 that would be a good idea, but i think this is enough when only the hover implementation uses it, as it only uses simple markdown. I can add a comment stating the lack off styling

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Event::End(Tag::CodeBlock(_))

Was the empty line missing otherwise?

Looks good to me, (with the exception of the two boolean arguments function, which I'm not a fan of but is probably fine for now), but I didn't test it.

@kjeremy
Copy link
Contributor

kjeremy commented Oct 5, 2020

#4326

@kjeremy
Copy link
Contributor

kjeremy commented Oct 5, 2020

This should also apply to completion and signature help requests.

@matklad
Copy link
Member

matklad commented Oct 6, 2020

cc @flw-cn

Am I correct that vim8 generally handles markdowns, and its only the links that create problems?

@robinvd robinvd requested a review from lnicola October 6, 2020 14:35
@matklad
Copy link
Member

matklad commented Oct 6, 2020

bors r=lnicola

@bors
Copy link
Contributor

bors bot commented Oct 6, 2020

@bors bors bot merged commit 57735f2 into rust-lang:master Oct 6, 2020
@flw-cn
Copy link
Contributor

flw-cn commented Oct 7, 2020

Yes. vim8 is capable of rendering markdown correctly, including highlighting blocks and bold and italic, etc. Only links are not handled very well.

@matklad

@kjeremy
Copy link
Contributor

kjeremy commented Oct 17, 2020

@robinvd
Copy link
Contributor Author

robinvd commented Oct 17, 2020

Ah, there should be no markdown in the message, but it is still marked as a markdown string.

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 this pull request may close these issues.

6 participants