chore: upstream rangeOfStx? from Batteries (#10490)
This PR upstreams a helper function that is used in ProofWidgets. --------- Co-authored-by: Marc Huisinga <mhuisi@protonmail.com>
This commit is contained in:
parent
979c2b4af0
commit
20b0bd0a20
1 changed files with 4 additions and 0 deletions
|
|
@ -94,6 +94,10 @@ def utf8PosToLspPos (text : FileMap) (pos : String.Pos) : Lsp.Position :=
|
|||
def utf8RangeToLspRange (text : FileMap) (range : String.Range) : Lsp.Range :=
|
||||
{ start := text.utf8PosToLspPos range.start, «end» := text.utf8PosToLspPos range.stop }
|
||||
|
||||
/-- Gets the LSP range of syntax `stx`. -/
|
||||
def lspRangeOfStx? (text : FileMap) (stx : Syntax) (canonicalOnly := false) : Option Lsp.Range :=
|
||||
text.utf8RangeToLspRange <$> stx.getRange? canonicalOnly
|
||||
|
||||
def lspRangeToUtf8Range (text : FileMap) (range : Lsp.Range) : String.Range :=
|
||||
{ start := text.lspPosToUtf8Pos range.start, stop := text.lspPosToUtf8Pos range.end }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue