summaryrefslogtreecommitdiff
path: root/clang-tools-extra/clangd/CodeComplete.h
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-06-15 13:34:18 +0000
committerEric Liu <ioeric@google.com>2018-06-15 13:34:18 +0000
commit15d45c95d32c50290f154333c451593ee02f707f (patch)
treea046f96bcd45b390f4f25b79b804a0aca98a95b9 /clang-tools-extra/clangd/CodeComplete.h
parent1ecc189f5e5c88479bacc6828127f5e6647f550e (diff)
[clangd] UI for completion items that would trigger include insertion.
Summary: 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). Vim: {F6357587} vscode: {F6357589} {F6357591} Reviewers: sammccall, ilya-biryukov, hokein Reviewed By: sammccall Subscribers: MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48163
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.h')
-rw-r--r--clang-tools-extra/clangd/CodeComplete.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.h b/clang-tools-extra/clangd/CodeComplete.h
index 4fb19cb1073..f89aad76cfe 100644
--- a/clang-tools-extra/clangd/CodeComplete.h
+++ b/clang-tools-extra/clangd/CodeComplete.h
@@ -60,6 +60,13 @@ struct CodeCompleteOptions {
/// If more results are available, we set CompletionList.isIncomplete.
size_t Limit = 0;
+ /// A visual indicator to prepend to the completion label to indicate whether
+ /// completion result would trigger an #include insertion or not.
+ struct IncludeInsertionIndicator {
+ std::string Insert = "•";
+ std::string NoInsert = " ";
+ } IncludeIndicator;
+
// Populated internally by clangd, do not set.
/// If `Index` is set, it is used to augment the code completion
/// results.