fix(lsp): clear ghost diagnostics on file deletion (LSP-FIX-015) - #194
Merged
Conversation
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
…et pattern resolution Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
On workspace/didChangeWatchedFiles type=3 (Deleted), the LSP server now: - Evicts the deleted URI from documents, dirty_documents, and overlay. - Sends textDocument/publishDiagnostics with diagnostics:[] immediately. - Uses 'continue' to prevent re-scheduling the deleted file for analysis. Without this fix, VS Code retained stale (ghost) diagnostics in the PROBLEMS panel until the next full workspace scan. Acceptance Criteria (LSP-FIX-015 Fix 1): - Deleting a file immediately clears its errors from the VS Code PROBLEMS panel. Unit test: tests/test_lsp.py::test_file_deletion_clears_ghost_diagnostics Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
… (CORE-FEAT-001) - Z121 (Missing Href): Marked fixable=False in codes.py. Removed HtmlMissingHrefMutation since missing URLs require human context. - Z505 (Untagged Code Block): Marked fixable=True in codes.py. Implemented UntaggedCodeBlockMutation to inject 'text' language specifier into untagged fenced blocks. - Z108 (Empty Link Text): Marked fixable=True in codes.py. Updated EmptyLinkTextMutation to inject 'TODO' placeholder label. - Updated CLI fix and LSP codeAction dispatchers accordingly. - Added comprehensive unit tests in test_redteam_remediation.py, test_custom_rules.py, test_fix.py, and test_lsp.py. Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
- Explicitly route Z108, Z505, and Z603 diagnostics to EmptyLinkTextMutation, UntaggedCodeBlockMutation, and DeadSuppressionMutation. - Complete removal of Z121 handler. - Added test_lsp_code_action_z108 to tests/test_lsp.py. Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
…S-ALIGN-001) Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
…te (LSP-FEAT-003) Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods <gianluca.catalano@gmail.com> # Conflicts: # .bumpversion.toml # .github/ISSUE_TEMPLATE/security_vulnerability.yml # .pre-commit-hooks.yaml # CHANGELOG.md # CITATION.cff # README.md # RELEASE.md # mkdocs.yml # pyproject.toml # src/zenzic/__init__.py # src/zenzic/cli/_standalone.py # uv.lock
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
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.
Objective
Eliminates the LSP ghost diagnostics state leak: when a Markdown file is deleted, the VS Code PROBLEMS panel immediately clears its stale entries.
Root Cause
_handle_file_changes(type=3) removed the file from the engine cache but never senttextDocument/publishDiagnosticswithdiagnostics:[]. VS Code retains ghost diagnostics until the next full workspace scan.Changes
src/zenzic/lsp/server.pyOn
workspace/didChangeWatchedFiles type=3:documents.documents,dirty_documents, andoverlay.textDocument/publishDiagnosticswithdiagnostics:[]immediately.continueto prevent re-adding the deleted URI todirty_documents.tests/test_lsp.pyNew test:
test_file_deletion_clears_ghost_diagnosticsAcceptance Criteria
just verifypasses 100% (1498 passed, DQS 98/100).