Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch changes on directories #1786

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

msujew
Copy link
Member

@msujew msujew commented Jan 9, 2025

Closes #1230

Even though I expected this to be a small fix, this was surprisingly complicated. The main issue is that we don't get notified what is contained in the directory that has changed. Therefore, we need to "manually" dig through the changed directory. Performs a few changes:

  1. Adds a UriTrie data structure. It's a tree structure for document storage that respects directories (compared to the previous flat map). It is required to quickly figure out which documents belong to a changed/deleted directory.
  2. Adjusts the document builder to find all documents that belong either to a changed directory or a deleted directory.
  3. Adds a few new methods to the workspace manager so we can efficiently traverse newly added folders.
  4. Adds a new testing utility VirtualFileSystemProvider that can be programmed for specific tests.

The behavior is tested by some integration tests, and can be manually tested by deleting/renaming directories with DSL files within them. The old documents should be correctly deleted and the documents from the renamed directory should've been correctly added to the documents service.

@msujew msujew force-pushed the msujew/watch-directory-changes branch from bbb5653 to a0f5fc6 Compare January 13, 2025 10:24
@msujew msujew added the index Index/Workspace handling related label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
index Index/Workspace handling related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Langium documents don't get removed after the containing directory is renamed
1 participant