feat: added diagnostics converter patch#353
Open
GitLuckier wants to merge 1 commit into
Open
Conversation
…e extension) to preserve leantags and added shouldHideDiagnosticFromPanel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
The Lean LSP inlcudes non-standard fields inside their diagnostic messages. These properties get lost when vscode converts them. The Lean4 vscode extension rescues those fields by monkey patching the converters:
See: https://github.com/leanprover/vscode-lean4/blob/bbe3ff126cd54defd10ac6e07a2b94dd2d865c42/vscode-lean4/src/utils/converters.ts
This PR uses a more minimal patch in order to rescue just those leanTags and some other fields. This also solves an issue where we had these existing types in
waterproof-vscode/src/lsp-client/lean/requestTypes.ts:but they were never included in the final diagnostics message. Now that they are, the type makes sense.
It then uses those leantags to determine whether a diagnostics message is about
unsolved goals. This means we have a flag to determine whether we should hide thisunsolved goalserror message in the editor (see #332 ). This is more robust then string matching onunsolved goalsin the diagnostic. Furthermore, this patching allows us to add more patching similar to the Lean4 vscode extension if needed in the future.Testing this PR
If you really want, you could inspect the new contents of the diagnostics messages to see the leanTags now being preserved. Otherwise there are some new unit tests.