Currently the diagnostics reports the file:line:col, but some LSP frontends
require a non-empty range. Report either the range of an identifier that starts
at location, or a range of 1. Expose the id location to range helper and reuse
here.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp | ||
---|---|---|
70 | I'd rather base this on something real(i.e. heuristically matching a token) than using a magic number. |
It would be nice of we could reuse some of the tokenizing logic from the parser to recover the full range. Maybe we could use the ParserAsmState for this injection, and add a method to transform positions into ranges.
Expose and reuse convertIdLocToRange heuristic instead of fixed range. Now the range is either that of an identifier that starts at that location or a range of one character if not a valid identifier.
mlir/include/mlir/Parser/AsmParserState.h | ||
---|---|---|
109 | If this is intended to be just for identifiers, can you rephrase it to indicate that? e.g. ^ | |
mlir/lib/Parser/AsmParserState.cpp | ||
60 | nit: None of the other methods here have the description copied from the header. | |
mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp | ||
83 | nit: Add a newline before this comment. |
If this is intended to be just for identifiers, can you rephrase it to indicate that? e.g. ^