[Mlir-commits] [mlir] 34b3f06 - [mlir:LSP] Add code completions for builtin signed/unsigned integers

River Riddle llvmlistbot at llvm.org
Fri Jul 8 17:57:05 PDT 2022


Author: River Riddle
Date: 2022-07-08T17:55:30-07:00
New Revision: 34b3f0665c1d71a1a544999ce6e2ac0fcfc22977

URL: https://github.com/llvm/llvm-project/commit/34b3f0665c1d71a1a544999ce6e2ac0fcfc22977
DIFF: https://github.com/llvm/llvm-project/commit/34b3f0665c1d71a1a544999ce6e2ac0fcfc22977.diff

LOG: [mlir:LSP] Add code completions for builtin signed/unsigned integers

Added: 
    

Modified: 
    mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
index a2f4f6f8d36d..f535667e25b8 100644
--- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
+++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
@@ -720,16 +720,22 @@ class LSPCodeCompleteContext : public AsmParserCodeCompleteContext {
 
   /// Signal a completion for a type.
   void completeType(const llvm::StringMap<Type> &aliases) override {
+    // Handle the various builtin types.
     appendSimpleCompletions({"memref", "tensor", "complex", "tuple", "vector",
                              "bf16", "f16", "f32", "f64", "f80", "f128",
                              "index", "none"},
                             lsp::CompletionItemKind::Field,
                             /*sortText=*/"1");
-    lsp::CompletionItem item("i<N>", lsp::CompletionItemKind::Field,
-                             /*sortText=*/"1");
-    item.insertText = "i";
-    completionList.items.emplace_back(item);
 
+    // Handle the builtin integer types.
+    for (StringRef type : {"i", "si", "ui"}) {
+      lsp::CompletionItem item(type + "<N>", lsp::CompletionItemKind::Field,
+                               /*sortText=*/"1");
+      item.insertText = type.str();
+      completionList.items.emplace_back(item);
+    }
+
+    // Insert completions for dialect types and aliases.
     completeDialectName("!");
     completeAliases(aliases, "!");
   }


        


More information about the Mlir-commits mailing list