[mlir-lsp] Report range of potential identifier starting at location of diagnostic
authorJacques Pienaar <jpienaar@google.com>
Wed, 2 Jun 2021 17:49:53 +0000 (10:49 -0700)
committerJacques Pienaar <jpienaar@google.com>
Wed, 2 Jun 2021 17:49:53 +0000 (10:49 -0700)
commit644f722b369d9d7e0bef3694d11c48d7d333d36a
tree7ca22dc5c5781dec77d1615038af830db23d0956
parent6745ffe4fa1c35778f88cffd671b7a7a936fb4d9
[mlir-lsp] Report range of potential identifier starting at location of diagnostic

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.

Differential Revision: https://reviews.llvm.org/D103482
mlir/include/mlir/Parser/AsmParserState.h
mlir/lib/Parser/AsmParserState.cpp
mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
mlir/test/mlir-lsp-server/diagnostics.test