This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Render doc-comment code spans with `backticks` in plaintext mode
ClosedPublic

Authored by sammccall on Apr 29 2020, 4:25 PM.

Diff Detail

Event Timeline

sammccall created this revision.Apr 29 2020, 4:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 29 2020, 4:25 PM
kadircet added inline comments.Apr 30 2020, 2:48 AM
clang-tools-extra/clangd/FormattedString.cpp
365

should we rather use renderInlineBlock here ? because in presence of backticks inside the C.Contents it might become confusing e.g:

this is`foo(`x`)`

this would become:

this is `foo(``x``)`

and instead of keeping a marker maybe just:

if (Preserve && ..)
 OS << Sep << "`" << C.Contents << "`";
else
  OS << Sep << C.Contents;
sammccall marked an inline comment as done.Apr 30 2020, 4:05 AM
sammccall added inline comments.
clang-tools-extra/clangd/FormattedString.cpp
365

rather use renderInlineBlock

I don't think humans deal with escaping better than with ambiguity - those two examples seem equally confusing to me :-\

I'd suggest better is to pick another marker that's unused in the chunk:

this is 'foo(`x`)'

Happy to do that in this patch if you like it.
instead of keeping a marker maybe just:

instead of keeping a marker maybe just

Happy to do that for now if you like, but I don't think it's much clearer. I factored it this way because I think the marker is likely to have more options in future (bold spans, avoiding conflicts) and wanted to hint at that.

kadircet accepted this revision.Apr 30 2020, 4:17 AM

LGTM thanks!

clang-tools-extra/clangd/FormattedString.cpp
365

I don't think humans deal with escaping better than with ambiguity - those two examples seem equally confusing to me :-\
I'd suggest better is to pick another marker that's unused in the chunk:
this is 'foo(x)'
Happy to do that in this patch if you like it.

Yeah that looks like a better approach, feel free to leave a fixme as well. As I believe this should be a rather rare occurrence and we can take care of it once it becomes a real issue or someone has time.

instead of keeping a marker maybe just

Happy to do that for now if you like, but I don't think it's much clearer. I factored it this way because I think the marker is likely to have more options in future (bold spans, avoiding conflicts) and wanted to hint at that.

OK makes sense let's keep it that way.

This revision is now accepted and ready to land.Apr 30 2020, 4:17 AM
This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.