-
Notifications
You must be signed in to change notification settings - Fork 4
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
improved handling of lsp failure state #309
Conversation
30d43f9
to
bd8d40c
Compare
bd8d40c
to
548a9da
Compare
commands.add("--set-credentials-encryption-key"); | ||
setCommands(commands); | ||
} catch (Exception e) { | ||
LspStatusManager.getInstance().setToFailed(); |
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.
is this caught by startProcess on L70?
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.
No, both these exceptions are caught at separate changes so no overlap. The exception on L47 is caught by eclipse during instantiation of the class, and the exception on L70 is caught once eclipse begins the LSP init process in the earlyStartup process.
plugin/src/software/aws/toolkits/eclipse/amazonq/views/ViewVisibilityManager.java
Outdated
Show resolved
Hide resolved
public void setToActive() { | ||
lspState = LspState.ACTIVE; | ||
Activator.getEventBroker().post(lspState); | ||
ViewVisibilityManager.showDefaultView("restart"); |
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.
what does the string value represent? It is unclear what it does to me. If its somehow related to metrics it should be indicated so with a enum class that holds these string eg. if this represents a click event then Source.Restart and similar
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.
The string value is indeed metric related, and you're right that it should be an enum. I'll start work to refactor all these instances. These metric strings are widely used and I don't want to dilute this PR with the changes, thus I'll open a separate PR with the edits.
plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/manager/LspStatusManager.java
Outdated
Show resolved
Hide resolved
plugin/src/software/aws/toolkits/eclipse/amazonq/providers/LspProviderImpl.java
Show resolved
Hide resolved
import software.aws.toolkits.eclipse.amazonq.plugin.Activator; | ||
import software.aws.toolkits.eclipse.amazonq.views.ViewVisibilityManager; | ||
|
||
public final class LspStatusManager { |
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.
I think we can avoid having the LspStatusManager. The EventBroker keeps track of the latest state, so if we emit to the event bus, then every subscriber will get the latest LSP state when the subscribe.
Issue #297
Description of changes:
Added enhancement to plugin in order to handle language server failure state gracefully, showing a view to the user and disabling interaction with certain features.
Todo: While addressing exception handling in LSP components, we should consider conditionally adding detailed failure messages to this view based on error codes.
Screenshot:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.