Skip to content

didClose and didOpen events go out of balance when dragging an editor window from the main IDE view to another view #1383

Done

Description

@bzoracler

The out-of-balance causes similar problems to #574.


"Dragging an editor window from the main IDE view to another view" is shown below.

This is the initial state of the main IDE view:

Image

After dragging file2.py out to another IDE view:

Image

This dragging event only triggers a single textDocument/didClose event, so the language server now thinks file2.py is closed.

[Trace - 09:42:09] Sending notification 'textDocument/didClose'


For this particular example, where only one file2.py view is present, I expected either one of these after dragging:

  • Neither didClose nor didOpen events should trigger
  • Both didClose and didOpen events should trigger

However, in the scenario where there was another open editor window of file2.py (so 2 or more views of file2.py in total), then dragging file2.py out should not trigger any didOpen or didClose events (currently, LSP4IJ behaves correctly in this scenario).


I do not know when this problem started occurring; it may have started before the latest release of LSP4IJ. This bug reproduction is for the latest release (v0.18).

Activity

  1. angelozerr commented on Nov 28, 2025

    @angelozerr
    Contributor

    Have you this issue with other language server like CSS or JavaScript?

  2. bzoracler commented on Nov 28, 2025

    @bzoracler
    ContributorAuthor

    I just checked CSS using ESLint with WebStorm, and rust-analyzer with RustRover, and it seems like this problem doesn't occur in those language servers. Both of these were tested with LSP4IJ 0.18 interfacing with user-defined LS.

    I thought this should be an LSP4IJ problem, because didOpen and didClose are both client-to-server messages. Do you think it's a possibility that my language server has issues? If so, I'll dig a bit deeper there instead.

  3. bzoracler commented on Nov 28, 2025

    @bzoracler
    ContributorAuthor

    Okay so I tested this in PyCharm with another Python language server running simultaneously with mine, and the other language server successfully triggers both didClose and didOpen, whereas my one doesn't.

    There's probably a bug somewhere in my language server, so this isn't an LSP4IJ issue.

    Thanks!

  4. angelozerr commented on Nov 28, 2025

    @angelozerr
    Contributor

    @bzoracler I dont think it is a bug from your language server.

    I think it doesnt work with your language server because it supports none lsp features like doculenrtHighlight. Symbols etc which force the didOpen.

    Indeed I did a big perf improvment when you have several language servers and a lot of opened tabs.

    When IJ restart, only the visible tab must start the server and not other tabsb which are not visible.

    Before didOpen was sent when IJ file open was triggered. Now didOpen is trigerred by the call of lsp request like highlight. I did that because IJ filesopen is called even if tab is not visible.

  5. bzoracler commented on Nov 28, 2025

    @bzoracler
    ContributorAuthor

    Oh, so this is somewhat related to #1224.

    Thank you! In that case I'll reopen this for now.

  6. bzoracler commented on Nov 28, 2025

    @bzoracler
    ContributorAuthor

    Yes, your suspicion was right.

    I added a textDocument/documentHighlight feature to my language server that has no implementation, and textDocument/didOpen triggers now (although, you have to still do something in the new editor window, like type something or click on something to trigger it. Still, this is better than the language client thinking that it's permanently closed).

  7. added
    bug
    on Nov 21, 2026
  8. added a commit that references this issue on Nov 25, 2026
    1a0dca5
  9. added this to the 0.30.2 milestone on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions