Commit graph

43 commits

Author SHA1 Message Date
Marc Huisinga
dfd3d18530
test: improve language server test coverage (#10574)
This PR significantly improves the test coverage of the language server,
providing at least a single basic test for every request that is used by
the client. It also implements infrastructure for testing all of these
requests, e.g. the ability to run interactive tests in a project context
and refactors the interactive test runner to be more maintainable.
Finally, it also fixes a small bug with the recently implemented unknown
identifier code actions for auto-implicits (#10442) that was discovered
in testing, where the "import all unambiguous unknown identifiers" code
action didn't work correctly on auto-implicit identifiers.
2025-09-30 11:15:03 +00:00
jrr6
62f14514da
refactor: update built-in tactic error messages (#9633)
This PR updates various error messages produced by or associated with
built-in tactics and adapts their formatting to current conventions.
2025-07-31 14:16:57 +00:00
Joachim Breitner
8424ddbb3e
feat: prettier expected type mismatch error message (#9099)
This PR improves the “expected type mismatch” error message by omitting
the type's types when they are defeq, and putting them into separate
lines when not.

I found it rather tediuos to parse the error message when the expected
type is long, because I had to find the `:` in the middle of a large
expression somewhere. Also, when both are of sort `Prop` or `Type` it
doesn't add much value to print the sort (and it’s only one hover away
anyways).
2025-07-01 07:50:53 +00:00
Leonardo de Moura
605b9e63c9 chore: disable broken test
It is timing out on OSX, and `master` is failing to build.
This is a temporary "fix."
2025-02-07 11:13:50 -08:00
Sebastian Ullrich
88573c802d
test: do not filter output for non-diff tests (#6308) 2024-12-04 17:49:35 +00:00
Jerry Wu
b333de1a36
fix: make applyEdit optional in WorkspaceClientCapabilities of LSP (#5224)
The `applyEdit` field should be optional in
`WorkspaceClientCapabilities` by the LSP spec and some clients don't
populate it in requests

Closes #4541
2024-10-16 08:38:11 +00:00
Marc Huisinga
3119fd0240
fix: make watchdog more resilient against badly behaving clients (#4443)
This PR addresses some non-critical but annoying issues that sometimes
cause the language server to report an error:
- When using global search and replace in VS Code, the language client
sends `textDocument/didChange` notifications for documents that it never
told the server to open first. Instead of emitting an error and crashing
the language server when this occurs, we now instead ignore the
notification. Fixes #4435.
- When terminating the language server, VS Code sometimes still sends
request to the language server even after emitting a `shutdown` request.
The LSP spec explicitly forbids this, but instead of emitting an error
when this occurs, we now error requests and ignore all other messages
until receiving the final `exit` notification. Reported on Zulip several
times over the years but never materialized as an issue, e.g.
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Got.20.60shutdown.60.20request.2C.20expected.20an.20.60exit.60.20notification/near/441914289.
- Some language clients attempt to reply to the file watcher
registration request before completing the LSP initialization dance. To
fix this, we now only send this request after the initialization dance
has completed. Fixes #3904.

---------

Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
2024-06-13 13:48:36 +00:00
Sebastian Ullrich
f97a7d4234
feat: incremental elaboration of definition headers, bodies, and tactics (#3940)
Extends Lean's incremental reporting and reuse between commands into
various steps inside declarations:
* headers and bodies of each (mutual) definition/theorem
* `theorem ... := by` for each contained tactic step, including
recursively inside supported combinators currently consisting of
  * `·` (cdot), `case`, `next`
  * `induction`, `cases`
  * macros such as `next` unfolding to the above

![Recording 2024-05-10 at 11 07
32](https://github.com/leanprover/lean4/assets/109126/c9d67b6f-c131-4bc3-a0de-7d63eaf1bfc9)

*Incremental reuse* means not recomputing any such steps if they are not
affected by a document change. *Incremental reporting* includes the
parts seen in the recording above: the progress bar and messages. Other
language server features such as hover etc. are *not yet* supported
incrementally, i.e. they are shown only when the declaration has been
fully processed as before.

---------

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
2024-05-22 13:23:30 +00:00
Sebastian Ullrich
68eaf33e86
feat: snapshot trees and language processors (#3014)
This is the foundation for work on making processing in the language
server both more fine-grained (incremental tactics) as well as parallel.
2024-03-14 13:40:08 +00:00
Chris Lovett
3eeb064d83
fix: Clear Diagnostics when file is closed (#1591) 2022-10-07 17:28:15 -07:00
larsk21
cf4e106304 fix: unused variables linter review comments
- ignore unused variables in dep arrows
- avoid negated options
- make syntax stack generation more performant
- make ignore functions more extensible
- change message severity to `warning`
2022-06-03 13:03:52 +02:00
larsk21
393fdef972 fix: disable linters in tests 2022-06-03 13:03:52 +02:00
Leonardo de Moura
e9d85f49e6 chore: remove tryPureCoe?
Based on the discussion at
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/for.2C.20unexpected.20need.20for.20type.20ascription/near/269083574
The consensus seemed to be that "auto pure" is more confusing than its worth.
2022-02-03 16:25:24 -08:00
Sebastian Ullrich
37f5be1b26 chore: fix servertest_init_exit 2022-01-14 09:18:57 +01:00
Sebastian Ullrich
c62c8bd64b chore: reenable servertest_edit 2021-12-21 18:11:28 +01:00
Sebastian Ullrich
5b653197db chore: use --run for servertests
/cc @Garmelon
2021-12-21 16:04:21 +01:00
Wojciech Nawrocki
e8af38f586 chore: fix tests 2021-08-24 08:57:41 -07:00
Daniel Selsam
89364b802b feat: top-down heuristic delaboration 2021-08-03 09:13:18 +02:00
Daniel Fabian
63d58c2f64 refactor: use Except instead of Option in the JSON code. 2021-06-07 12:10:10 +02:00
Wojciech Nawrocki
18e6f78089
fix: publish header processing message log 2021-05-26 09:30:29 +02:00
Leonardo de Moura
9a5f239513 refactor: remove Monad Option and Alternative Option
We should use `OptionM` instead.
`Option` still implements `Functor` and `OrElse`.

cc @Kha
2021-03-20 18:25:25 -07:00
Sebastian Ullrich
b6622d2bef feat: server: preserve full range of messages 2021-03-10 17:09:41 +01:00
Leonardo de Moura
5d3f0606d2 feat: include type of type in "mismatch errors"
@Kha we do that in Lean 3. It helps when the error is due to incorrect universe levels.

BTW, I had to update `tests/lean/server/content_diag.json` since the
error message is different, but a few other stuff changed too.
Could you please take a look whether the test is still correct?
2021-03-08 09:30:34 -08:00
Wojciech Nawrocki
d9c6a992b5 feat: specify version in waitForDiagnostics 2021-01-22 18:02:31 +01:00
Sebastian Ullrich
a8c04388bb chore: disable flaky test 2021-01-04 15:44:03 +01:00
Sebastian Ullrich
4a22854b1e chore: make server tests fixable 2020-12-27 15:05:29 +01:00
Wojciech Nawrocki
a2760d0144 test: multi-process server 2020-12-26 13:22:47 +01:00
Sebastian Ullrich
b2fda9b9ae chore: disable randomly failing test
/cc @mhuisi @Vtech234
2020-12-25 18:48:58 +01:00
Sebastian Ullrich
f42bd8f693 chore: deactivate server tests for now 2020-12-23 20:00:36 +01:00
Wojciech Nawrocki
1b9ae69729 feat: port basic server tests 2020-12-23 20:00:36 +01:00
Leonardo de Moura
fa101444b4 chore: fix tests 2020-10-25 09:11:13 -07:00
Leonardo de Moura
760b658d19 chore: suppress extraMsg in type mismatch errors 2020-10-06 10:58:50 -07:00
Leonardo de Moura
0ce6ac4267 chore: fix error messages 2020-10-06 10:52:04 -07:00
Sebastian Ullrich
f693e910b1 fix: skip minimum amount of tokens during parser recovery
Fixes #186
2020-09-21 11:37:50 +02:00
Sebastian Ullrich
3834a89cdc feat: activate new pretty printer 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
897f277a3e test: strip mvar suffixes 2020-09-15 09:32:00 -07:00
Leonardo de Moura
d8855c2673 feat: elaborate all definitions using elabMutualDef 2020-09-06 07:23:47 -07:00
Wojciech Nawrocki
f3d640a7cf feat: report parser errors in server 2020-08-31 06:50:01 -07:00
Wojciech Nawrocki
7b971c6cc5 fix: server test 2020-08-31 06:50:01 -07:00
Wojciech Nawrocki
23feb04d60 chore: clean up LSP code style and add more definitions from the spec 2020-08-31 06:50:01 -07:00
Wojciech Nawrocki
098c7af1b6 feat: server tests 2020-08-31 06:50:01 -07:00
Leonardo de Moura
6234c60aae chore(*): disable test suite 2018-04-10 12:56:55 -07:00
Leonardo de Moura
abd96e748f fix(frontends/lean/parser): crash on Win 10 2016-11-07 21:30:19 -08:00