chore: review fixes

This commit is contained in:
Wojciech Nawrocki 2022-05-18 17:30:52 -04:00 committed by Sebastian Ullrich
parent 8c67afae2f
commit cd47c30e47
3 changed files with 11 additions and 5 deletions

View file

@ -116,7 +116,7 @@ def locationLinksOfInfo (kind : GoToKind) (ci : Elab.ContextInfo) (i : Elab.Info
if let some modUri ← documentUriFromModule name then
let range := { start := ⟨0, 0⟩, «end» := ⟨0, 0⟩ : Range }
let ll : LocationLink := {
originSelectionRange? := (·.toLspRange text) <$> i.stx[2].getRange?
originSelectionRange? := (·.toLspRange text) <$> i.stx[2].getRange? (originalOnly := true)
targetUri := modUri
targetRange := range
targetSelectionRange := range

View file

@ -102,12 +102,17 @@ builtin_initialize
(Array InteractiveDiagnostic)
getInteractiveDiagnostics
structure GetGoToLocationParams where
kind : FileWorker.GoToKind
info : WithRpcRef InfoWithCtx
deriving RpcEncoding
builtin_initialize
registerBuiltinRpcProcedure
`Lean.Widget.getGoToLocation
(FileWorker.GoToKind × WithRpcRef InfoWithCtx)
GetGoToLocationParams
(Array Lsp.LocationLink)
fun (kind, ⟨i⟩) => RequestM.asTask <|
fun ⟨kind, ⟨i⟩⟩ => RequestM.asTask <|
FileWorker.locationLinksOfInfo kind i.ctx i.info
end Lean.Widget

View file

@ -21,7 +21,8 @@ structure InfoWithCtx where
info : Elab.Info
deriving Inhabited, RpcEncoding with { withRef := true }
structure CodeToken where
/-- Information about a subexpression within delaborated code. -/
structure SubexprInfo where
/-- The `Elab.Info` node with the semantics of this part of the output. -/
info : WithRpcRef InfoWithCtx
/-- The position of this subexpression within the top-level expression.
@ -32,7 +33,7 @@ structure CodeToken where
deriving Inhabited, RpcEncoding
/-- Pretty-printed syntax (usually but not necessarily an `Expr`) with embedded `Info`s. -/
abbrev CodeWithInfos := TaggedText CodeToken
abbrev CodeWithInfos := TaggedText SubexprInfo
def CodeWithInfos.pretty (tt : CodeWithInfos) :=
tt.stripTags