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

JDT LS should mention as capability that it can support willRenameFiles #3126

Closed
angelozerr opened this issue Apr 4, 2024 · 1 comment · Fixed by #3127
Closed

JDT LS should mention as capability that it can support willRenameFiles #3126

angelozerr opened this issue Apr 4, 2024 · 1 comment · Fixed by #3127
Assignees

Comments

@angelozerr
Copy link

I have tested quicly JDT LS inside IntelliJ with https://github.com/redhat-developer/lsp4ij with my current willRenameFiles LSP client support and it doesn't work because JDT LS doesn't return the proper server capability.

It is working on vscode-java because you did some hack https://github.com/redhat-developer/vscode-java/blob/9bfd8a89b7f2259757999443adda0d5a7a505cc8/src/fileEventHandler.ts#L141

I think JDT LS should return this kind of capability:

[Trace - 4:38:09 PM] Received response 'initialize - (0)' in 7241ms.
Result: {
    "capabilities": {
  ...
        },
        "workspace": {
            "fileOperations": {
                "willRename": {
                    "filters": [
                        {
                            "scheme": "file",
                            "pattern": {
                                "glob": "**/*.{java}",
                                "matches": "file"
                            }
                        }
                    ]
                },
                "didRename": {
                    "filters": [
                        {
                            "scheme": "file",
                            "pattern": {
                                "glob": "**/*.{java}",
                                "matches": "file"
                            }
                        }
                    ]
                }
            }
        }
...
}

And if there are some good reason why you did this hack and if server capability returns that, it could break vscode-java, perhaps JDT LS could receive a property to say "please return me the workspace.fileOperations' capability.

@rgrunber
Copy link
Contributor

rgrunber commented Apr 5, 2024

My guess would be we never properly set :

/**
   * The server is interested in receiving willRenameFiles requests.
    */
willRename?: FileOperationRegistrationOptions;

WorkspaceServerCapabilities wsCapabilities = new WorkspaceServerCapabilities();
WorkspaceFoldersOptions wsFoldersOptions = new WorkspaceFoldersOptions();
wsFoldersOptions.setSupported(Boolean.TRUE);
wsFoldersOptions.setChangeNotifications(Boolean.TRUE);
wsCapabilities.setWorkspaceFolders(wsFoldersOptions);
capabilities.setWorkspace(wsCapabilities);

So maybe clients are respecting that and we need to declare it.

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

Successfully merging a pull request may close this issue.

2 participants