This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Provide documentation as MarkupContent in signaturehelp
ClosedPublic

Authored by kadircet on Dec 9 2021, 6:12 AM.

Details

Summary

This unifies the behaviour we have in code completion item
documentations and signaturehelp. Providing better line wrapping and detection
of inline code blocks in comments to be renedered appropriately in markdown.

Diff Detail

Event Timeline

kadircet created this revision.Dec 9 2021, 6:12 AM
kadircet requested review of this revision.Dec 9 2021, 6:12 AM

I am thinking about a follow-up which will actually change formatDocumentation to return a Markup::Document instead to make sure we will have a single way of representing documents throughout features in future.
But that's also what we store in the index, hence will require some serialization/deserialization story around it, hence pending some more discussions/thinking :)

sammccall accepted this revision.Dec 9 2021, 9:01 AM

MarkupContent was introduced in 3.12 in 2018.
We could continue to support older clients by rendering plaintext as string instead of the MarkupContent struct but it doesn't seem worth it.

clang-tools-extra/clangd/Protocol.h
495

move next to other sighelp caps?

clang-tools-extra/clangd/test/signature-help.test
1

I definitely don't think we need three copies of this test.

I'd personally probably only keep one, and have it specify markdown explicitly (plaintext is the default).
Keeping a test for both plain and markdown is more coverage, copied tests are a maintenance hazard, up to you.
Keeping both plain-explicitly-specified and plain-by-default seems gratuitous.

This revision is now accepted and ready to land.Dec 9 2021, 9:01 AM
kadircet updated this revision to Diff 393438.Dec 10 2021, 3:50 AM
kadircet marked 2 inline comments as done.
  • Drop extra tests
  • Move capability closer to others
This revision was landed with ongoing or failed builds.Dec 10 2021, 3:58 AM
This revision was automatically updated to reflect the committed changes.