Skip to content

Commit

Permalink
fix: include identifier before cursor in document highlight request
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuisi committed Sep 2, 2024
1 parent 830b119 commit ad8dfa1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Lean/Server/FileWorker/RequestHandling.lean
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ partial def handleDocumentHighlight (p : DocumentHighlightParams)
let trees := snaps.map (·.infoTree)
let refs : Lsp.ModuleRefs ← findModuleRefs text trees |>.toLspModuleRefs
let mut ranges := #[]
for ident in refs.findAt p.position do
for ident in refs.findAt p.position (includeStop := true) do
if let some info := refs.get? ident then
if let some ⟨definitionRange, _⟩ := info.definition? then
ranges := ranges.push definitionRange
Expand All @@ -324,7 +324,7 @@ partial def handleDocumentHighlight (p : DocumentHighlightParams)
return none
return some <| ranges.map ({ range := ·, kind? := DocumentHighlightKind.text })

withWaitFindSnap doc (fun s => s.endPos > pos)
withWaitFindSnap doc (fun s => s.endPos >= pos)
(notFoundX := pure #[]) fun snap => do
let (snaps, _) ← doc.cmdSnaps.getFinishedPrefix
if let some his ← highlightRefs? snaps.toArray then
Expand Down

0 comments on commit ad8dfa1

Please sign in to comment.