-
Notifications
You must be signed in to change notification settings - Fork 63
Don't leak buffers on moved files #1266
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
Conversation
de16a12
to
257a6ca
Compare
These two tests were failing before, I've adopted expectations, but I honestly don't understand what the tests were checking and why they have expected something to "survive" closed project: Test Result (2 failures ) |
@sebthom, @mickaelistria : could you please take a look? Note, I have almost zero knowledge in LSP area, so I did the change by "best guessing" how that all is supposed to work. |
org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/WorkspaceFoldersTest.java
Outdated
Show resolved
Hide resolved
Looks like Jenkins had issues?
|
I guess it is more than that: https://www.eclipsestatus.io
|
The testProjectClose test fails consistently with your patch applied because the WorkspaceFolderEvents are different.
[DidChangeWorkspaceFoldersParams [
event = WorkspaceFoldersChangeEvent [
added = ArrayList (
WorkspaceFolder [
uri = "file:///D:/workspaces/junit-workspace/WorkspaceFoldersTest_testProjectClose_1747991065251/"
name = "WorkspaceFoldersTest_testProjectClose_1747991065251"
]
)
removed = ArrayList ()
]
], DidChangeWorkspaceFoldersParams [
event = WorkspaceFoldersChangeEvent [
added = ArrayList ()
removed = ArrayList ()
]
]] instead of [DidChangeWorkspaceFoldersParams [
event = WorkspaceFoldersChangeEvent [
added = ArrayList (
WorkspaceFolder [
uri = "file:///D:/workspaces/junit-workspace/WorkspaceFoldersTest_testProjectClose_1747991209996/"
name = "WorkspaceFoldersTest_testProjectClose_1747991209996"
]
)
removed = ArrayList ()
]
], DidChangeWorkspaceFoldersParams [
event = WorkspaceFoldersChangeEvent [
added = ArrayList ()
removed = ArrayList (
WorkspaceFolder [
uri = "file:///D:/workspaces/junit-workspace/WorkspaceFoldersTest_testProjectClose_1747991209996/"
name = "WorkspaceFoldersTest_testProjectClose_1747991209996"
]
)
]
]] before the patch. |
Thanks. I haven't yet tried to understand what this test is doing and why it is failing now, as I've found yet another buffer leak. This time no file move is needed, it is enough for client to call The last patch fixes that too. I have to stop working now, my family needs me. If no one has an idea about how to fix failing test, I plan to continue investigating next week. |
Here are my updated tests that show the problem in presence of Copilot plugin and are green with the latest patch here: |
Yet another fix was needed, so updated tests: TestBuffers_updated2.zip |
Thanks for the PR, it looks sensible. Thanks for working on it. You can just tell me when it is ready to review. |
Yes, this PR looks quite good. The failing test needs a fix though. |
I'm on it, trying to setup an error free workspace to debug tests... |
OK, the Stack at which we disconnect resource listener with the patch here:
|
To keep existing behavior I've fixed The org.eclipse.lsp4e.test.WorkspaceFoldersTest.testProjectClose()` test should be green now (locally it is) and with that, please review this PR. |
Note: the PR can't be built because of TP issues not caused by this PR:
|
Updated test that currently fails with GitHub Copilot 0.6.0.202505160326 (works except two tests still failing also with patched GitHub Copilot 0.6.0.202505230325 and lsp4e with current PR on top): So far remaining two tests failing seem to be a problem of Github Copilot plugin that doesn't use proper (updated) URI for disconnecting of renamed buffers for non-text editors. One could argue that if client connected document using Anyway, the patch that "workarounds" current Copilot troubles with rename of non-text editors would look like
but as said, it will only work for "simple" use cases with a one-time file rename. So my personal preference is to fix client code here. |
I am fixing this in #1276 |
@iloveeclipse , if you rebase the target should be fine now. |
- adds listener callbacks on buffer changes - disconnects previously connected buffers from ITextFileBufferManager on disconnect() - properly watch on project close events Fixes eclipse-lsp4e#1265
Thanks! |
Thanks for merge. Are there any nightly build p2 repo one can consume? |
Yes, please find the links to snapshots build in https://github.com/eclipse-lsp4e/lsp4e/blob/main/README.md , or you may also use the link to the p2 repository archived directly on Jenkins (we may actually get rid of download.eclipse.org for snapshots one day to make things simpler). Note that when submitting a PR, the p2 repo is also generated on Jenkins and archived as long as the PR is open in order to allow more testing. |
Fixes #1265