Skip to content
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

Closed editors after successful save to avoid duplication #7769

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

subhash-arabhi
Copy link
Contributor

These changes fix Issue #279
The changes made in PR #7749 do not fix this issue, although the issues seem similar

Brief

  1. The QuickFix action to enable the preview uses node.cookie (SaveCookie) to save the changes to pom.xml.
  2. The EditorCookie is not closed after a successful save.
  3. In subsequent run operations, the LifecycleManager (line 167) in MavenCommandLineExecutor.java saves the previous changes again.

Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a in-editor hint should not close (seemingly unrelated) editor tabs. Document closing should also not be a side effect of aUtilities#saveChanges utility method.

@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests labels Sep 19, 2024
@neilcsmith-net neilcsmith-net added the VSCode Extension [ci] enable VSCode Extension tests label Sep 19, 2024
@neilcsmith-net
Copy link
Member

Agree with @mbien This also appears to be a VSCode / LSP only issue? This should not be fixed this way, and if the issue is not in the IDE, should not be fixed there but in the LSP integration.

@sdedic
Copy link
Member

sdedic commented Sep 19, 2024

This does not (now) have a workable solution IMHO; the close could be done, iff the process is running headless, or can be conditioned by 'branding API' which would default to "do not close" and NBLS distribution would brand it to close.

But the problem is NOT just maven-specific, it's general, for all opened editor types: if the SaveCookie.save() is invoked, it modifies the on-disk file, LSP client might (and vscode does) recognize it as external modification and will inform LSP servers with didChange -- which actually causes the Document in NB become modified with duplicate contents.

Most proper solution is to relay the actual write to file to the LSP client (quite hard), or "somehow" detect that the didChange actually originates from the save (also quite hard). But we should work on that somehow.

@neilcsmith-net
Copy link
Member

@sdedic sounds fun! Perhaps something like an on-save task to save the modified regions somewhere like a document property. Depends whether NB and LSP idea of range matches?!

Still, if it can't be solved generically (which would be ideal) I guess branded close would be OK. Headless was pointed out to be a problem in another PR recently IIRC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests VSCode Extension [ci] enable VSCode Extension tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplication of "--enable-preview" tag in pom.xml
4 participants