[PATCH] D76094: [clangd] Change line break behaviour for hoverinfo
Lorenz Junglas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 12 13:01:29 PDT 2020
lolleko created this revision.
lolleko added a reviewer: sammccall.
lolleko added a project: clang.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
`convertLineBreaks` retains hard line breaks and removes soft line breaks.
Wether a line break is hard or soft is determined by the following rules (some of which have been discussed in https://github.com/clangd/clangd/issues/95):
- Hard Markdown line breaks (https://github.github.com/gfm/#hard-line-breaks) are retained
- Line breaks that are preceded by a punctuation are retained
- Line breaks that are followed by "interesting characters" (e.g. Markdown syntax, doxygen commands) are retained
- All other line breaks are removed
Even though markdown doc comments in cpp are still rare, I removed the markdown escaping.
I think the chance that markdown constructs are introduced by accident is fairly low especially with proper line breaks.
That means that doc comments which use markdown are now supported and should be rendered properly (in supported editors).
In addition `canonicalizeSpaces` has been removed.
`canonicalizeSpaces` removed duplicate whitespaces anywhere in a string. Now only (duplicate) whitespaces before and after a line break are trimmed.
Since this is my first contribution feel free to be extra thorough.
Fixes https://github.com/clangd/clangd/issues/301, Potentially resolves https://github.com/clangd/clangd/issues/95
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76094
Files:
clang-tools-extra/clangd/FormattedString.cpp
clang-tools-extra/clangd/unittests/FormattedStringTests.cpp
clang-tools-extra/clangd/unittests/HoverTests.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76094.250027.patch
Type: text/x-patch
Size: 11304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200312/f7b9d0b6/attachment-0001.bin>
More information about the cfe-commits
mailing list