Skip to content

Commit

Permalink
Expand "workspace/willRenameFiles" support to include folders.
Browse files Browse the repository at this point in the history
- Allow folder renames to trigger workspace/willRenameFiles since the
  language server can update source files during such an operation

Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Jun 12, 2024
1 parent 822133b commit 02b046f
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,14 @@ public void registerCapabilities(InitializeResult initializeResult) {

if (preferenceManager.getClientPreferences().isWorkspaceWillRenameFilesSupported()) {
FileOperationsServerCapabilities wsFileOperations = new FileOperationsServerCapabilities();
FileOperationPattern fileOpPattern = new FileOperationPattern("**/*.java");
fileOpPattern.setMatches(FileOperationPatternKind.File);
wsFileOperations.setWillRename(new FileOperationOptions(List.of(new FileOperationFilter(fileOpPattern, "file"))));
FileOperationPattern fileOpPatternJava = new FileOperationPattern("**/*.java");
fileOpPatternJava.setMatches(FileOperationPatternKind.File);
FileOperationPattern fileOpPatternPackage = new FileOperationPattern("**");
fileOpPatternPackage.setMatches(FileOperationPatternKind.Folder);
wsFileOperations.setWillRename(new FileOperationOptions(List.of(
new FileOperationFilter(fileOpPatternJava, "file"),
new FileOperationFilter(fileOpPatternPackage, "file")
)));
wsCapabilities.setFileOperations(wsFileOperations);
}

Expand Down

0 comments on commit 02b046f

Please sign in to comment.