Skip to content

‘workspace/didRenameFiles’ is not sent if workspace/willRenameFiles is not supported by language server #1216

Closed

Description

@sergeysavchuk

Language Server - LS

Version: 0.14.2
Precondition:

  • Server Capability workspace.fileOperations.didRename is set on LS side.
  • Not set Server Capability _ workspace.fileOperations.willRename_ on LS side.

Steps to reproduce:

  • Open any supported file by LS and rename the file.

Expected result:
Client sends the request ‘workspace/didRenameFiles’ to the LS

Actual result:
Client doesn't send the the request ‘workspace/didRenameFiles’

Technial notes:
In this case in the class com.redhat.devtools.lsp4ij.features.refactoring.LSPRefactoringListener#refactoringDone LSPRenameFilesContextHolder.get() returns null because it was not set in com.redhat.devtools.lsp4ij.features.refactoring.LSPRenamePsiElementProcessor as LS doesn't support willRename operation.

LSPRenameFilesContext context = LSPRenameFilesContextHolder.get(); if (context != null) {

Activity

  1. angelozerr commented on Aug 13, 2025

    @angelozerr
    Contributor

    Is there any chance to have a PR?

  2. sergeysavchuk commented on Aug 13, 2025

    @sergeysavchuk
    ContributorAuthor

    @angelozerr Hello, I can prepare a fix in the next few days, but I’m not sure it’s correct yet — needs testing.

  3. angelozerr commented on Aug 13, 2025

    @angelozerr
    Contributor

    To be honnest with you it was a long time that I have implemented this didrenameFiles which worked pretty well with all language servers like Go, TypeScript, Rust, etc

    I don't understand very well your issue.

  4. sergeysavchuk commented on Aug 19, 2025

    @sergeysavchuk
    ContributorAuthor

    @angelozerr hello, there are more details:

    Current behavior

    Currently, didRenameFiles notifications are only sent to language servers that:

    • support willRenameFiles capability
    • have successfully executed willRenameFiles request

    Expected behavior

    didRenameFiles notifications should be sent to any language server that supports the didRenameFiles capability, regardless of:

    • whether they support willRenameFiles
    • whether willRenameFiles was executed successfully

    Some language servers may want to be notified about file renames even if they don't support or didn't handle the willRenameFiles request. The current implementation prevents these servers from receiving the notifications they're capable of handling.
    So, the didRenameFiles notification is part of the LSP file operations capability and should operate independently from willRenameFiles support.

    please review #1223

  5. angelozerr commented on Aug 19, 2025

    @angelozerr
    Contributor

    Thanks so much for your PR.

    Your PR looks good but I need to test with other language servers if it doesnt break their file renames

  6. angelozerr commented on Aug 19, 2025

    @angelozerr
    Contributor

    Just few questions. Which language server requires rhis fix? Do you use an IJ plugin or user defined ls?

    If you are using user defined ls, perhaps it could be a good idea to provide an lsp template like other ls.

    If you could be interested with this lsp template please tell me and I will give you more infos how ro do that.

  7. sergeysavchuk commented on Aug 20, 2025

    @sergeysavchuk
    ContributorAuthor

    @angelozerr The language server is being developed at my current employer and is not open source (internal project).
    Also, I currently have about three open issues that appeared after migrating to lsp4ij. I plan to open separate issues for them as well. Could you advise which language server is best to use to reproduce these problems when filing bugs and to verify the behavior?

  8. angelozerr commented on Aug 20, 2025

    @angelozerr
    Contributor

    @angelozerr The language server is being developed at my current employer and is not open source (internal project).

    OK

    Also, I currently have about three open issues that appeared after migrating to lsp4ij. I plan to open separate issues for them as well. Could you advise which language server is best to use to reproduce these problems when filing bugs and to verify the behavior?

    It depends on feature. I have tried to write several tests wich emulates language server. Unfortunately I have no test with rename files

  9. added
    bug
    on Aug 21, 2025
  10. added this to the 0.15.0 milestone on Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions