Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Handle workspace modifications #611

Merged
merged 2 commits into from
Jul 28, 2022
Merged

Conversation

charlespwd
Copy link
Contributor

@charlespwd charlespwd commented Jul 20, 2022

Fix #588

Issue summary:

  • We didn't know when files were deleted, which caused the textDocument/didClose handler to throw an Errno::ENOENT when trying to "sync" the storage with the file system.

Fix summary:

  • Rescue Errno::ENOENT in textDocument/didClose for language clients that do not support the workspace.fileOperations.didDeleteFiles client capability
  • Start handling 2 new LSP client->server notifications:
  • Start handling a new LSP client->server request:
    • workspace/willRenameFiles
      • When we get those, we move the contents of the old path to the
        new path in the InMemoryStorage, and then remove the content at the
        old path.

@charlespwd charlespwd requested a review from a team July 20, 2022 14:22
@@ -21,6 +21,8 @@ def path(relative_path)

def read(relative_path)
file(relative_path).read(mode: 'rb', encoding: 'UTF-8')
rescue Errno::ENOENT
nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic here is that InMemoryStorage also returns string | nil, so we're copying the signature by catching those errors.

@charlespwd charlespwd force-pushed the fix/588-handle-file-deletion branch from 97654ca to 0463fc9 Compare July 20, 2022 18:26
@charlespwd charlespwd force-pushed the fix/588-handle-file-deletion branch from 0463fc9 to 74ce506 Compare July 28, 2022 17:14
* Minor refactor of DiagnosticsEngine

* Handle array argument in analyze_and_send_offenses

* Adjust file rename diagnostics handling

- update our storage
- clear the old diagnostics from the DiagnosticsManager
- send "NO_DIAGNOSTICS" to the client for the deleted files
- rerun theme check for the new files

* More diagnostic lifecycle fixes

- When you close a file and only_single_file is on, clear its diagnostics
- If you delete or rename a file, clear its diagnostics and rerun whole theme
  checks (in case MissingTemplate should now be reported)

Fixes #569
@charlespwd charlespwd merged commit 41840df into main Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Theme check crashes when file is deleted
1 participant