You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
textDocument/didClose is triggered upon the first close event when multiple views of the document are open #574
At least for the user-defined language server, when multiple views of a document are open, closing any one of them triggers a textDocument/didClose. I don't think this is correct.
The proper way to handle multiple open windows and textDocument/didClose is not explicitly described, but based on the discussion in microsoft/language-server-protocol#285 and the specifications, it is strongly implied that textDocument/didClose should only trigger when the last view of a document is closed, rather than the first time the user closes any one of the views.
In the current behaviour in LSP4IJ,
textDocument/didOpen only fires on the first time a user opens a document, not any subsequent times a user opens a new view for the document; it is therefore only possible to balance the number textDocument/didOpen events by triggering at most 1 textDocument/didClose while any views of the document is open. This is correct based on the specfication:
textDocument/didOpen
An open notification must not be sent more than once without a corresponding close notification send before. This means open and close notification must be balanced and the max open count for a particular textDocument is one.
If multiple views of a document are open, and textDocument/didClose triggers before all of them are closed, it is not possible to fulfil the following textDocument/didClose specification:
textDocument/didClose
The document’s master now exists where the document’s Uri points to (e.g. if the document’s Uri is a file Uri the master now exists on disk). As with the open notification the close notification is about managing the document’s content.
This is because the client, at this point in time with opened views of the document, still owns the content.
Apart from triggering language server methods in textDocument/didClose too early, this issue also causes the language server to start shutting down when only one text document (with multiple views) is open, and you close any one of them.
There might be other ways of doing this, but I always use split views:
Right-click the file bar for the file you want to get another view for (here, manager.py) to get the menu shown, then choose either Split Right or Split Down. This will open another view of the file.
Activity
angelozerr commentedon Oct 13, 2024
I dont master IntelliJ, could you explain me how you do that please (with wich menu)
bzoracler commentedon Oct 13, 2024
There might be other ways of doing this, but I always use split views:
Right-click the file bar for the file you want to get another view for (here,
manager.py) to get the menu shown, then choose eitherSplit RightorSplit Down. This will open another view of the file.angelozerr commentedon Oct 13, 2024
Thanks @bzoracler
fix: textDocument/didClose is triggered upon the first close event when
fix: textDocument/didClose is triggered upon the first close event when
angelozerr commentedon Oct 13, 2024
Please give a try to the latest nightly build, it should fix your issue, if no please reopen the issue.
See https://github.com/redhat-developer/lsp4ij?tab=readme-ov-file#testing-nightly-builds for more information with nightly build.
The 0.7.0 will be released Tuesday, see #572
bzoracler commentedon Oct 13, 2024
Thanks for the fast response, this worked perfectly!
fix: textDocument/didClose is triggered upon the first close event when
angelozerr commentedon Oct 14, 2024
OK great. Thanks for having reported the issue and give me feedback.