-
Notifications
You must be signed in to change notification settings - Fork 406
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
Filter reported for workspace/willRename excludes folders/packages #3183
Comments
I'd have to check if this was behaviour that actually regressed. If we could support renaming all package declarations of source files when a particular folder (representing a part of the package declaration) is renamed, then we should definitely provide the support. |
Isn't this what this test is about? Lines 142 to 144 in bb26c98
|
Those tests would validate the language server's side of renaming of packages but not the mechanism by which the client detects the need for the renaming. For example, VS Code doesn't rely on |
Hmm, but isn't jdt-ls all about server side? I wonder why it matters how a specific client behaves. And if VS Code doesn't even rely on TBH I also don't quite understand what you mean by "the need for the renaming": If a client supports it, it can send a |
The language server has many different ways a client may configure the behaviour it expects from the server. For example, VS Code wants to get the result of By "the need for renaming" I meant that a client can manually implement detection for rename using its own API and then just manually send Does introducing a pattern for folders fix the issue for nvim ? |
Interesting, but then you basically say that VS Code has solved it in a different way anway. So still not sure, how it's related to this issue here. I just did a test now and hardcoded the filter into the nvim-file-operations plugin. With that in place I can rename a folder and it will update all classes. Actually that's what I expected: The filter is only used internally by the plugin to decide whether to send a I previously disabled the filter check completely and this also worked. For completeness here's how I tested: if will_rename ~= nil then
-- local filters = will_rename.filters or {}
local filters = {
{
pattern = {
glob = '**/*.java',
matches = 'file'
},
scheme = 'file'
},
{
pattern = {
glob = '**',
matches = 'folder'
},
scheme = 'file'
}
}
if utils.matches_filters(filters, data.old_name) then
local edit = getWorkspaceEdit(client, data.old_name, data.new_name)
if edit ~= nil then
log.debug("Going to apply workspace/willRename edit", edit)
vim.lsp.util.apply_workspace_edit(edit, client.offset_encoding)
end
end
end |
It isn't related. It's an example I gave on how clients can configure the language server behaviour differently depending on if the existing workflow doesn't match what they'd like to do. That was in response to a question you had about why an existing testcase doesn't capture the client renaming a folder, and the more general question of why the client-side makes any difference. And that was because I wasn't sure if the renaming of a folder on the client triggered the rename or whether it had to be done strictly in a package declaration.
Ok, then we can definitely add the filter to preserve this behaviour. CC'ing @angelozerr for awareness. |
You should be able to try a nightly of JDT-LS at https://download.eclipse.org/jdtls/snapshots/ once a newer one appears and it should have the fix. |
#3127 introduced a filter for
workspace/willRename
operations:This filter seems to exclude directories. So for some clients this breaks renaming a package - unless they ignore the filter (tested with nvim-lsp-file-operations).
So the reported filter should probably be extended:
The text was updated successfully, but these errors were encountered: