-
Notifications
You must be signed in to change notification settings - Fork 874
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
API/SPI to apply WorkspaceEdit #7401
Conversation
4445f80
to
1808f50
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me.
1808f50
to
54779f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
looks like the language version bump is causing groovy tests to fail since they have to test on JDK 8 due to #4904 I am working on a fix. The recent changes in the build made it easier to bump groovy to more recent JDKs since most pass out of the box now. |
@mbien Thanks -- wouldn't it be better if I downgrade for a while lsp.api back to 8 ? Since the language bump was just because of |
@sdedic we have to bump the remaining few "stuck stuck with 8" tests anyway at some point. I am running them locally now and 98% pass, rest seem to be fixable by updating the golden files (some completion tests are JDK API sensitive for example). Last time I tried this far more failed due to module system issues, but it seems it is resolved now and it looks much better. |
this should fix it I think #7415 |
During implementation of new features, for example project dependency modification or some edits, we increasingly sarted to use
WorkspaceEdit
from the LSP APis, so that the code would apply for both NetBeans IDE and NetBeans running as a NBLS server. Sometimes the action code needs to ensure the changes are applied and possibly saved - but that needs to be perfomed in different ways, depending on whether NB runs as an IDE or as NBLS.So far, the only possibility was to make a command that returns a WorkspaceEdit to the LSP client (or to a wrapper code in NB IDE) and the client (or wrapper) applies the edit. Sadly ;) there is still no standard implementation how to apply the WorkspaceEdit in the NB code, so the IDE implementation would need to be done manually.
This PR introduces an API to apply the changes + SPI that is implemented for NetBeans IDE (in project.dependencies module) and for LSP server (implemented in nbcode/integrations module). The IDE implementation uses
EditorCookie
and Document to make textual changes, andSavable
to perform the save operation.The LSP protocol implementation uses standard
applyWorkspaceEdit
call to perform changes and our customrequestDocumentSave
to save resources.Basic tests for IDE and LSP parts included.