-
Notifications
You must be signed in to change notification settings - Fork 409
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
Automatically rename file to type name on save #3091
Conversation
f45557c
to
08ad3bd
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.
Haven't run this yet, but seems like it should work. I'm only wondering if there's a way to really simplify this.
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/SaveActionHandler.java
Outdated
Show resolved
Hide resolved
a1fdcc3
to
428f537
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 fine so far. just some small things.
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/SaveActionHandler.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/SaveActionHandler.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/SaveActionHandler.java
Outdated
Show resolved
Hide resolved
edit.setChanges(Collections.emptyMap()); | ||
final boolean applyNow = JavaLanguageServerPlugin.getPreferencesManager().getClientPreferences().isWorkspaceApplyEditSupported(); | ||
if (applyNow) { | ||
JavaLanguageServerPlugin.getInstance().getClientConnection().applyWorkspaceEdit(edit); |
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.
Per our discussion, this call, during willSaveWaitUntil
short circuits the client-side saving logic (you're effectively deleting a file that is in the process of being saved) and the result is didSave
never occurs, which causes improper saving (and a dirty editor). Maybe moving the logic into didSave
itself is a better approach.
cfc4b4e
to
f7b4ce8
Compare
Just for the sake of documenting. We ran into an issue here where the language server completely stopped responding to requests after The main hint came when I decided to track which thread was handling the So the listening thread handled the incoming Turns out this is documented at https://github.com/eclipse-lsp4j/lsp4j/blob/main/documentation/README.md#launch-and-connect-with-a-languageclient and mentioned at eclipse-lsp4j/lsp4j#775 :
This should definitely serve as a warning because we have a lot of helper methods in |
7f250b1
to
d8c9e62
Compare
If you cause a rename and try to perform some actions in between, it can cause these stacktraces in some instances :
I've seen it for codelens, hover, and folding range. The failure is basically in |
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
Addresses redhat-developer/vscode-java#3408.
Only applicable for clients that support https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_applyEdit