diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2018-09-27 14:21:07 +0000 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2018-09-27 14:21:07 +0000 |
commit | 13530d3070b86f9deb1443080746666bf790870a (patch) | |
tree | 5b565a2caf2735dfa715f54424ba11f50439f956 /clang-tools-extra/clangd | |
parent | dee872f194fbd78e1c86aae2ecd3e3d0d6ee51b7 (diff) |
Tell whether file/folder for include completions.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D52547
Diffstat (limited to 'clang-tools-extra/clangd')
-rw-r--r-- | clang-tools-extra/clangd/CodeComplete.cpp | 5 | ||||
-rw-r--r-- | clang-tools-extra/clangd/Protocol.h | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index 2328fc601d0..e43389ba849 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -349,6 +349,11 @@ struct CodeCompletionBuilder { } Completion.Kind = toCompletionItemKind( C.SemaResult->Kind, C.SemaResult->Declaration, ContextKind); + // Sema could provide more info on whether the completion was a file or + // folder. + if (Completion.Kind == CompletionItemKind::File && + Completion.Name.back() == '/') + Completion.Kind = CompletionItemKind::Folder; for (const auto &FixIt : C.SemaResult->FixIts) { Completion.FixIts.push_back( toTextEdit(FixIt, ASTCtx.getSourceManager(), ASTCtx.getLangOpts())); diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index f09a63c95aa..5e77e8b6acf 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -704,6 +704,13 @@ enum class CompletionItemKind { Color = 16, File = 17, Reference = 18, + Folder = 19, + EnumMember = 20, + Constant = 21, + Struct = 22, + Event = 23, + Operator = 24, + TypeParameter = 25, }; /// Defines whether the insert text in a completion item should be interpreted |