[all-commits] [llvm/llvm-project] 2e41ea: [mlir:LSP] Add support for keyword code completions

River Riddle via All-commits all-commits at lists.llvm.org
Fri Jul 8 16:56:35 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e41ea32472a2342f2563f57e2957a149bad5f3f
      https://github.com/llvm/llvm-project/commit/2e41ea32472a2342f2563f57e2957a149bad5f3f
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-07-08 (Fri, 08 Jul 2022)

  Changed paths:
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/include/mlir/Parser/CodeComplete.h
    M mlir/lib/Parser/AsmParserImpl.h
    M mlir/lib/Parser/Parser.cpp
    M mlir/lib/Parser/Parser.h
    M mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
    M mlir/test/mlir-lsp-server/completion.test

  Log Message:
  -----------
  [mlir:LSP] Add support for keyword code completions

This commit adds code completion results to the MLIR LSP when
parsing keywords. Keyword support is currently limited to the
case where the expected keyword is provided, but a followup will
work on expanding the set of keyword cases we handle (e.g. to
allow capturing attribute/type mnemonics).

Differential Revision: https://reviews.llvm.org/D129184


  Commit: fe4f512be7a57ea7bbaa36b5261c2fa00e306cf9
      https://github.com/llvm/llvm-project/commit/fe4f512be7a57ea7bbaa36b5261c2fa00e306cf9
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-07-08 (Fri, 08 Jul 2022)

  Changed paths:
    M flang/lib/Optimizer/Dialect/FIRType.cpp
    M mlir/docs/AttributesAndTypes.md
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/include/mlir/Parser/CodeComplete.h
    M mlir/lib/Dialect/PDL/IR/PDLTypes.cpp
    M mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp
    M mlir/lib/Parser/AsmParserImpl.h
    M mlir/lib/Parser/AttributeParser.cpp
    M mlir/lib/Parser/DialectSymbolParser.cpp
    M mlir/lib/Parser/Lexer.h
    M mlir/lib/Parser/Parser.cpp
    M mlir/lib/Parser/Parser.h
    M mlir/lib/Parser/TypeParser.cpp
    M mlir/lib/Tools/lsp-server-support/Protocol.h
    M mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
    M mlir/test/lib/Dialect/Test/TestTypes.cpp
    M mlir/test/mlir-lsp-server/completion.test
    M mlir/test/mlir-tblgen/attrdefs.td
    M mlir/test/mlir-tblgen/default-type-attr-print-parser.td
    M mlir/test/mlir-tblgen/typedefs.td
    M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp

  Log Message:
  -----------
  [mlir:LSP] Add support for code completing attributes and types

This required changing a bit of how attributes/types are parsed. A new
`KeywordSwitch` class was added to AsmParser that provides a StringSwitch
like API for parsing keywords with a set of potential matches. It intends to
both provide a cleaner API, and enable injection for code completion. This
required changing the API of `generated(Attr|Type)Parser` to handle the
parsing of the keyword, instead of having the user do it. Most upstream
dialects use the autogenerated handling and didn't require a direct update.

Differential Revision: https://reviews.llvm.org/D129267


Compare: https://github.com/llvm/llvm-project/compare/f9f8693be31c...fe4f512be7a5


More information about the All-commits mailing list