lean4-htt/tests/lean/interactive
Marc Huisinga 8b8561a699
feat: improved go to definition (#9040)
This PR improves the 'Go to Definition' UX, specifically:
- Using 'Go to Definition' on a type class projection will now extract
the specific instances that were involved and provide them as locations
to jump to. For example, using 'Go to Definition' on the `toString` of
`toString 0` will yield results for `ToString.toString` and `ToString
Nat`.
- Using 'Go to Definition' on a macro that produces syntax with type
class projections will now also extract the specific instances that were
involved and provide them as locations to jump to. For example, using
'Go to Definition' on the `+` of `1 + 1` will yield results for
`HAdd.hAdd`, `HAdd α α α` and `Add Nat`.
- Using 'Go to Declaration' will now provide all the results of 'Go to
Definition' in addition to the elaborator and the parser that were
involved. For example, using 'Go to Declaration' on the `+` of `1 + 1`
will yield results for `HAdd.hAdd`, `HAdd α α α`, `Add Nat`,
``macro_rules | `($x + $y) => ...`` and `infixl:65 " + " => HAdd.hAdd`.
- Using 'Go to Type Definition' on a value with a type that contains
multiple constants will now provide 'Go to Definition' results for each
constant. For example, using 'Go to Type Definition' on `x` for `x :
Array Nat` will yield results for `Array` and `Nat`.

### Details
'Go to Definition' for type class projections was first implemented by
#1767, but there were still a couple of shortcomings with the
implementation. E.g. in order to jump to the instance in `toString 0`,
one had to add another space within the application and then use 'Go to
Definition' on that, or macros would block instances from being
displayed. Then, when the .ilean format was added, most 'Go to
Definition' requests were already handled using the .ileans in the
watchdog process, and so the file worker never received them to handle
them with the semantic information that it has available.

This PR resolves most of the issues with the previous implementation and
refactors the 'Go to Definition' control flow so that 'Go to Definition'
requests are always handled by the file worker, with the watchdog merely
using its .ilean position information to update the positions in the
response to a more up-to-date state. This is necessary because the file
worker obtains its position information from the .oleans, which need to
be rebuilt in order to be up-to-date, while the watchdog always receives
.ilean update notifications from each active file worker with the
current position information in the editor.

Finally, all of the 'Go to Definition' code is refactored to be easier
to maintain.

### Breaking changes
`InfoTree.hoverableInfoAt?` has been generalized to
`InfoTree.hoverableInfoAtM?` and now takes a general `filter` argument
instead of several boolean flags, as was the case before.
2025-07-21 15:47:44 +00:00
..
533.lean
533.lean.expected.out
863.lean
863.lean.expected.out
1018unknowMVarIssue.lean chore: change chatty test to interactive test (#8348) 2025-05-15 07:56:26 +00:00
1018unknowMVarIssue.lean.expected.out chore: change chatty test to interactive test (#8348) 2025-05-15 07:56:26 +00:00
1031.lean
1031.lean.expected.out
1265.lean
1265.lean.expected.out
1403.lean
1403.lean.expected.out
1525.lean
1525.lean.expected.out
1659.lean
1659.lean.expected.out
2058.lean
2058.lean.expected.out feat: improve infer binder type failure message and range (#8263) 2025-07-14 20:19:11 +00:00
2881.lean
2881.lean.expected.out
4078.lean
4078.lean.expected.out
4880.lean
4880.lean.expected.out chore: use note and hint' for message addenda (#8980) 2025-06-27 15:16:01 +00:00
5659.lean
5659.lean.expected.out feat: improve split error messages (#9424) 2025-07-18 22:36:10 +00:00
6594.lean
6594.lean.expected.out
amb.lean
amb.lean.expected.out
anonHyp.lean
anonHyp.lean.expected.out
autoBoundIssue.lean
autoBoundIssue.lean.expected.out
builtinCodeactions.lean
builtinCodeactions.lean.expected.out
cancellation.lean fix: cancellation of synchronous part of previous elaboration (#7882) 2025-04-10 11:43:41 +00:00
cancellation.lean.expected.out test: goals accomplished (#8319) 2025-05-13 13:00:47 +00:00
catHover.lean
catHover.lean.expected.out
codeaction.lean
codeaction.lean.expected.out
compHeader.lean
compHeader.lean.expected.out
completion.lean
completion.lean.expected.out
completion2.lean
completion2.lean.expected.out
completion3.lean
completion3.lean.expected.out
completion4.lean
completion4.lean.expected.out
completion5.lean
completion5.lean.expected.out
completion6.lean
completion6.lean.expected.out
completion7.lean
completion7.lean.expected.out
completionAtPrint.lean
completionAtPrint.lean.expected.out
completionBracketedDot.lean
completionBracketedDot.lean.expected.out
completionCheck.lean
completionCheck.lean.expected.out
completionDanglingDot.lean
completionDanglingDot.lean.expected.out
completionDeprecation.lean
completionDeprecation.lean.expected.out
completionEOF.lean
completionEOF.lean.expected.out
completionFallback.lean
completionFallback.lean.expected.out
completionFromExpectedType.lean
completionFromExpectedType.lean.expected.out
completionIStr.lean
completionIStr.lean.expected.out
completionOpenNamespaces.lean
completionOpenNamespaces.lean.expected.out
completionOption.lean
completionOption.lean.expected.out
completionPrefixIssue.lean
completionPrefixIssue.lean.expected.out feat: Lean.Grind.IsCharP (#7870) 2025-04-10 08:36:42 +00:00
completionPrivateTypes.lean
completionPrivateTypes.lean.expected.out fix: search path related bugs (#7873) 2025-04-09 15:37:49 +00:00
completionPrv.lean
completionPrv.lean.expected.out fix: search path related bugs (#7873) 2025-04-09 15:37:49 +00:00
completionStructureInstance.lean
completionStructureInstance.lean.expected.out
completionTactics.lean
completionTactics.lean.expected.out
compNamespace.lean
compNamespace.lean.expected.out fix: namespace completion to only use the short name (#8350) 2025-05-22 11:58:47 +00:00
definition.lean test: make test deterministic (#7916) 2025-04-11 11:16:16 +00:00
definition.lean.expected.out feat: improved go to definition (#9040) 2025-07-21 15:47:44 +00:00
Diff.lean
Diff.lean.expected.out feat: pretty print props with only if domain is prop, add pp.foralls (#7812) 2025-04-04 02:55:47 +00:00
discrsIssue.lean
discrsIssue.lean.expected.out
docstringLinksExamples.lean
docstringLinksExamples.lean.expected.out
dotIdCompletion.lean
dotIdCompletion.lean.expected.out
editAfterError.lean
editAfterError.lean.expected.out feat: update and explain "unknown constant" and "failed to infer type" errors (#9423) 2025-07-18 19:20:31 +00:00
editCompletion.lean
editCompletion.lean.expected.out
errorExplanationInteractive.lean feat: add initial error explanations (#8934) 2025-06-23 17:24:09 +00:00
errorExplanationInteractive.lean.expected.out feat: add initial error explanations (#8934) 2025-06-23 17:24:09 +00:00
expectedTypeAsGoal.lean
expectedTypeAsGoal.lean.expected.out feat: use omission dots for hidden let values in Infoview (#8041) 2025-05-27 23:09:11 +00:00
explicitAppInstHole.lean
explicitAppInstHole.lean.expected.out
foldingRange.lean
foldingRange.lean.expected.out
ghostGoals.lean
ghostGoals.lean.expected.out
goalEOF.lean
goalEOF.lean.expected.out
goalIssue.lean
goalIssue.lean.expected.out
goalsAccomplished.lean test: goals accomplished (#8319) 2025-05-13 13:00:47 +00:00
goalsAccomplished.lean.expected.out test: goals accomplished (#8319) 2025-05-13 13:00:47 +00:00
goTo.lean feat: improved go to definition (#9040) 2025-07-21 15:47:44 +00:00
goTo.lean.expected.out feat: improved go to definition (#9040) 2025-07-21 15:47:44 +00:00
goTo2.lean feat: improved go to definition (#9040) 2025-07-21 15:47:44 +00:00
goTo2.lean.expected.out feat: improved go to definition (#9040) 2025-07-21 15:47:44 +00:00
haveInfo.lean
haveInfo.lean.expected.out
highlight.lean
highlight.lean.expected.out
hover.lean fix: search path related bugs (#7873) 2025-04-09 15:37:49 +00:00
hover.lean.expected.out feat: improved go to definition (#9040) 2025-07-21 15:47:44 +00:00
hoverAt.lean
hoverAt.lean.expected.out
hoverBinderUndescore.lean
hoverBinderUndescore.lean.expected.out
hoverDot.lean
hoverDot.lean.expected.out
hoverException.lean
hoverException.lean.expected.out
hoverTacticExt.lean
hoverTacticExt.lean.expected.out
incrementalCombinator.lean fix: update Parser.Term.letIdDeclNoBinders to use new letIdDecl format (#8929) 2025-06-22 19:28:46 +00:00
incrementalCombinator.lean.expected.out fix: update Parser.Term.letIdDeclNoBinders to use new letIdDecl format (#8929) 2025-06-22 19:28:46 +00:00
incrementalCommand.lean
incrementalCommand.lean.expected.out feat: improve split error messages (#9424) 2025-07-18 22:36:10 +00:00
incrementalInduction.lean
incrementalInduction.lean.expected.out
incrementalMutual.lean
incrementalMutual.lean.expected.out feat: update and explain "unknown constant" and "failed to infer type" errors (#9423) 2025-07-18 19:20:31 +00:00
incrementalTactic.lean
incrementalTactic.lean.expected.out feat: improve split error messages (#9424) 2025-07-18 22:36:10 +00:00
infoIssues.lean
infoIssues.lean.expected.out
internalNamesIssue.lean
internalNamesIssue.lean.expected.out
inWordCompletion.lean
inWordCompletion.lean.expected.out
isRflParallel.lean chore: fix spelling mistakes (#8711) 2025-06-10 20:24:28 +00:00
isRflParallel.lean.expected.out feat: explicit defeq attribute (#8419) 2025-06-06 18:40:06 +00:00
issue4527.lean
issue4527.lean.expected.out
issue5021.lean
issue5021.lean.expected.out chore: fix spelling mistakes (#7328) 2025-04-07 01:15:48 +00:00
issue5597.lean
issue5597.lean.expected.out
jumpMutual.lean fix: search path related bugs (#7873) 2025-04-09 15:37:49 +00:00
jumpMutual.lean.expected.out feat: improved go to definition (#9040) 2025-07-21 15:47:44 +00:00
keywordCompletion.lean
keywordCompletion.lean.expected.out
lean3HoverIssue.lean
lean3HoverIssue.lean.expected.out
macroGoalIssue.lean
macroGoalIssue.lean.expected.out
match.lean
match.lean.expected.out
matchPatternHover.lean
matchPatternHover.lean.expected.out
matchStxCompletion.lean
matchStxCompletion.lean.expected.out
partialNamespace.lean
partialNamespace.lean.expected.out
plainGoal.lean
plainGoal.lean.expected.out feat: pretty print props with only if domain is prop, add pp.foralls (#7812) 2025-04-04 02:55:47 +00:00
plainTermGoal.lean
plainTermGoal.lean.expected.out
ppShowLetValues.lean feat: use omission dots for hidden let values in Infoview (#8041) 2025-05-27 23:09:11 +00:00
ppShowLetValues.lean.expected.out feat: use omission dots for hidden let values in Infoview (#8041) 2025-05-27 23:09:11 +00:00
rename.lean
rename.lean.expected.out
run.lean
rwElabConst.lean fix: deduplicate elaboration of constant argument to rw (#8232) 2025-05-15 11:33:10 +00:00
rwElabConst.lean.expected.out fix: deduplicate elaboration of constant argument to rw (#8232) 2025-05-15 11:33:10 +00:00
signatureHelp.lean fix: wrong signature help after map/filter/etc (#8655) 2025-06-06 13:07:01 +00:00
signatureHelp.lean.expected.out fix: wrong signature help after map/filter/etc (#8655) 2025-06-06 13:07:01 +00:00
stdOutput.lean
stdOutput.lean.expected.out
strInterpSynthError.lean fix: improve precision of synthesis failure spans in interpolated strings (#9004) 2025-06-27 01:47:32 +00:00
strInterpSynthError.lean.expected.out chore: use note and hint' for message addenda (#8980) 2025-06-27 15:16:01 +00:00
structInstFieldHints.lean feat: add hints for missing structure instance fields (#9317) 2025-07-17 03:22:34 +00:00
structInstFieldHints.lean.expected.out feat: add hints for missing structure instance fields (#9317) 2025-07-17 03:22:34 +00:00
structNameParentProj.lean
structNameParentProj.lean.expected.out
terminationBySuggestion.lean
terminationBySuggestion.lean.expected.out
test_single.sh
travellingCompletions.lean
travellingCompletions.lean.expected.out
unterminatedDocComment.lean
unterminatedDocComment.lean.expected.out
userWidget.lean
userWidget.lean.expected.out