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

improved handling of lsp failure state #309

Merged
merged 6 commits into from
Feb 4, 2025

Conversation

nborges-aws
Copy link
Contributor

@nborges-aws nborges-aws commented Dec 13, 2024

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:
Screenshot 2024-12-20 at 11 03 37 AM

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

@taldekar taldekar force-pushed the nickdb/lspErrorHandling branch from bd8d40c to 548a9da Compare January 27, 2025 22:42
commands.add("--set-credentials-encryption-key");
setCommands(commands);
} catch (Exception e) {
LspStatusManager.getInstance().setToFailed();
Copy link
Contributor

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?

Copy link
Contributor Author

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.

public void setToActive() {
lspState = LspState.ACTIVE;
Activator.getEventBroker().post(lspState);
ViewVisibilityManager.showDefaultView("restart");
Copy link
Contributor

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

Copy link
Contributor Author

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.

import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.views.ViewVisibilityManager;

public final class LspStatusManager {
Copy link
Contributor

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.

@taldekar taldekar changed the base branch from main to feature/viewRefactor February 4, 2025 21:23
@taldekar taldekar merged commit 0767c4d into feature/viewRefactor Feb 4, 2025
1 check passed
@taldekar taldekar deleted the nickdb/lspErrorHandling branch February 4, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants