[mlir:LSP] Improve conversion between SourceMgr and LSP locations
authorRiver Riddle <riddleriver@gmail.com>
Tue, 26 Apr 2022 20:05:23 +0000 (13:05 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Thu, 28 Apr 2022 19:58:00 +0000 (12:58 -0700)
commit32bf1f1d57e7fdc240ee6e703306c57b0fa16c8e
tree0cfcf7154ec3f10923a64e214678743410637ff9
parent9613a850b69d2abf621d4c4a9dd9d967c580bd80
[mlir:LSP] Improve conversion between SourceMgr and LSP locations

SourceMgr generally uses 1-based locations, whereas the LSP is zero based.
This commit corrects this conversion and also enhances the conversion from SMLoc
to SMRange to support string tokens.

Differential Revision: https://reviews.llvm.org/D124584
mlir/lib/Parser/AsmParserState.cpp
mlir/lib/Tools/lsp-server-support/Protocol.h
mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.cpp
mlir/test/mlir-lsp-server/diagnostics.test
mlir/test/mlir-pdll-lsp-server/definition-split-file.test