lean4-htt/src
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
..
bin feat: API to avoid deadlocks from dropped promises (#6958) 2025-02-07 15:33:10 +00:00
cmake chore: fix spelling mistakes (#7328) 2025-04-07 01:15:48 +00:00
include/lean perf: inline lean_inc_ref_cold (#4978) 2025-06-27 15:58:00 +00:00
Init fix: behavior of String.prev (#9441) 2025-07-21 10:50:14 +00:00
initialize feat: remove the old compiler (#9275) 2025-07-09 06:00:46 +00:00
kernel perf: add missing std::moves (#9107) 2025-07-01 12:39:12 +00:00
lake refactor: remove Lean.RBMap usages (#9260) 2025-07-21 14:04:45 +00:00
Lean feat: improved go to definition (#9040) 2025-07-21 15:47:44 +00:00
library chore: add a new tagged IRType for inline tagged scalars (#9394) 2025-07-16 00:42:56 +00:00
runtime fix: behavior of String.prev (#9441) 2025-07-21 10:50:14 +00:00
shell fix: lake: import-related bugs (#8026) 2025-04-19 21:02:38 +00:00
Std refactor: module-ize remainder of Std (#9195) 2025-07-17 11:43:57 +00:00
util chore: have shell.cpp use library/util.h rather than library/compiler… (#9269) 2025-07-09 01:41:04 +00:00
cadical.mk fix: cadical distribution on Linux (#8201) 2025-05-02 18:25:16 +00:00
CMakeLists.txt chore: benchmark using USE_LAKE (#9361) 2025-07-17 18:44:29 +00:00
config.h.in perf: use mimalloc by default (#7710) 2025-03-30 22:40:41 +00:00
githash.h.in
Init.lean chore: module-ize Init.lean 2025-06-29 16:52:13 +02:00
lakefile.toml.in chore: benchmark using USE_LAKE (#9361) 2025-07-17 18:44:29 +00:00
lean-toolchain
Lean.lean feat: add initial error explanations (#8934) 2025-06-23 17:24:09 +00:00
lean.mk.in chore: USE_LAKE: integrate into CMake (#4466) 2025-03-15 08:58:01 +00:00
Leanc.lean
Std.lean feat: Upstream MPL.SPred.* from mpl (#8928) 2025-06-26 11:15:11 +00:00
stdlib.make.in chore: benchmark using USE_LAKE (#9361) 2025-07-17 18:44:29 +00:00
stdlib_flags.h chore: remove old documentation site (#7974) 2025-05-14 14:31:33 +00:00
version.h.in feat: language reference links and examples in docstrings (#7240) 2025-03-12 09:17:27 +00:00