[clang-tools-extra] r361969 - [clangd] Map typedefs to the same LSP completion kind as VSCode

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 08:10:19 PDT 2019


Author: ibiryukov
Date: Wed May 29 08:10:19 2019
New Revision: 361969

URL: http://llvm.org/viewvc/llvm-project?rev=361969&view=rev
Log:
[clangd] Map typedefs to the same LSP completion kind as VSCode

For consistency and, more importantly, to get a nicer icon for those in VSCode.

Modified:
    clang-tools-extra/trunk/clangd/CodeComplete.cpp

Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=361969&r1=361968&r2=361969&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original)
+++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Wed May 29 08:10:19 2019
@@ -92,8 +92,10 @@ CompletionItemKind toCompletionItemKind(
   case SK::Extension:
   case SK::Union:
     return CompletionItemKind::Class;
-  // FIXME(ioeric): figure out whether reference is the right type for aliases.
   case SK::TypeAlias:
+    // We use the same kind as the VSCode C++ extension.
+    // FIXME: pick a better option when we have one.
+    return CompletionItemKind::Interface;
   case SK::Using:
     return CompletionItemKind::Reference;
   case SK::Function:
@@ -481,7 +483,8 @@ private:
         return EmptyArgs ? "()" : "($0)";
       return *Snippet; // Not an arg snippet?
     }
-    if (Completion.Kind == CompletionItemKind::Reference ||
+    // 'CompletionItemKind::Interface' matches template type aliases.
+    if (Completion.Kind == CompletionItemKind::Interface ||
         Completion.Kind == CompletionItemKind::Class) {
       if (Snippet->front() != '<')
         return *Snippet; // Not an arg snippet?




More information about the cfe-commits mailing list