[PATCH] D48163: [clangd] UI for completion items that would trigger include insertion.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 14 02:59:04 PDT 2018


ioeric created this revision.
ioeric added reviewers: sammccall, ilya-biryukov, hokein.
Herald added subscribers: cfe-commits, jkorous, MaskRay.

For completion items that would trigger include insertions (i.e. index symbols
that are not #included yet), add a visual indicator "+" before the completion
label. The inserted headers will appear in the completion detail.

Open to suggestions for better visual indicators; "+" was picked because it
seems cleaner than a few other candidates I've tried (*, #, @ ...).

The displayed header would be like a/b/c.h (without quote) or <vector> for system
headers. I didn't add quotation or "#include" because they can take up limited
space and do not provide additional information after users know what the
headers are. I think a header alone should be obvious for users to infer that
this is an include header..

To align indentation, also prepend ' ' to labels of candidates that would not
trigger include insertions (only for completions where index results are
possible).

(Placeholder: add screenshots)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D48163

Files:
  clangd/CodeComplete.cpp
  clangd/Headers.cpp
  clangd/Headers.h
  test/clangd/completion-snippets.test
  unittests/clangd/CodeCompleteTests.cpp
  unittests/clangd/HeadersTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48163.151319.patch
Type: text/x-patch
Size: 12984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180614/ec7d81a5/attachment-0001.bin>


More information about the cfe-commits mailing list