[clangd] Map typedefs to the same LSP completion kind as VSCode
authorIlya Biryukov <ibiryukov@google.com>
Wed, 29 May 2019 15:10:19 +0000 (15:10 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Wed, 29 May 2019 15:10:19 +0000 (15:10 +0000)
For consistency and, more importantly, to get a nicer icon for those in VSCode.

llvm-svn: 361969

clang-tools-extra/clangd/CodeComplete.cpp

index 4328a64..2186bde 100644 (file)
@@ -92,8 +92,10 @@ CompletionItemKind toCompletionItemKind(index::SymbolKind Kind) {
   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?