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

[PoC] Fix #823 - Add support for willRenameFiles/willCreateFiles/willDeleteFiles #824

Closed
wants to merge 1 commit into from

Conversation

zulus
Copy link
Contributor

@zulus zulus commented Sep 25, 2023

This is a poc for rename. Unfortunately changes produced by LSPEclipseUtils.toCompositeChange arent correct:

  1. TextDocumentChanges isn't grouped per file, so preview is broken (same document is re-used)
  2. If files are opened in editors, change leave them in dirty state
  3. In theory "will*" operations should be invoked sequentially, if not two servers can report same change, some de-duplication should be invoked

@zulus
Copy link
Contributor Author

zulus commented Sep 30, 2023

1. TextDocumentChanges isn't grouped per file, so preview is broken (same document is re-used)

Fixed on platform level (already merged): eclipse-platform/eclipse.platform.ui#1172

return true;
}
return willRename.getFilters().stream().anyMatch(filter -> {
return FileSystems.getDefault().getPathMatcher("glob:" + filter.getPattern().getGlob()) //$NON-NLS-1$
Copy link
Contributor

Choose a reason for hiding this comment

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

FileSystems.getDefault().getPathMatcher("glob:" have a limitation, when you define **/*.ts and your base dir is

C:/Users/

  • C:/Users/foo/bar.ts will match **/*.ts
  • C:/Users/bar.ts will NOT match **/*.ts although vscode support it and it sa very commons usecases.

More its is better to cache the globfile pattern.

I suggest that you see my test code at https://github.com/redhat-developer/lsp4ij/blob/main/src/test/java/com/redhat/devtools/lsp4ij/features/filewatchers/FileSystemWatcherManagerTest.java which are the same test than vscode.

In otherwords I suggest that you copy/paste my https://github.com/redhat-developer/lsp4ij/blob/main/src/main/java/com/redhat/devtools/lsp4ij/features/filewatchers/PathPatternMatcher.java and use it.

PathPatternMatcher is used to manage glob pattern for didChangeFilesWatcher and willRenameFiles, etc

Here my current PR to support willRenameFiles redhat-developer/lsp4ij#198

Hope it will help.

@eclipsewebmaster eclipsewebmaster deleted the branch eclipse:master May 21, 2024 14:09
@mickaelistria
Copy link
Contributor

The initial target branch master was deleted and replaced by main, so this PR got closed automatically. If this is still relevant, please re-create this PR targetting the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants