We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
rangeOfStx?
1 parent 979c2b4 commit 20b0bd0Copy full SHA for 20b0bd0
src/Lean/Data/Lsp/Utf16.lean
@@ -94,6 +94,10 @@ def utf8PosToLspPos (text : FileMap) (pos : String.Pos) : Lsp.Position :=
94
def utf8RangeToLspRange (text : FileMap) (range : String.Range) : Lsp.Range :=
95
{ start := text.utf8PosToLspPos range.start, «end» := text.utf8PosToLspPos range.stop }
96
97
+/-- Gets the LSP range of syntax `stx`. -/
98
+def lspRangeOfStx? (text : FileMap) (stx : Syntax) (canonicalOnly := false) : Option Lsp.Range :=
99
+ text.utf8RangeToLspRange <$> stx.getRange? canonicalOnly
100
+
101
def lspRangeToUtf8Range (text : FileMap) (range : Lsp.Range) : String.Range :=
102
{ start := text.lspPosToUtf8Pos range.start, stop := text.lspPosToUtf8Pos range.end }
103
0 commit comments