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

Fall back to default chat options if LSP is unavailable #326

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@

package software.aws.toolkits.eclipse.amazonq.lsp;

import java.util.Arrays;
import java.util.Collections;

import software.aws.toolkits.eclipse.amazonq.lsp.model.AwsServerCapabilities;
import software.aws.toolkits.eclipse.amazonq.lsp.model.ChatOptions;
import software.aws.toolkits.eclipse.amazonq.lsp.model.Command;
import software.aws.toolkits.eclipse.amazonq.lsp.model.QuickActions;
import software.aws.toolkits.eclipse.amazonq.lsp.model.QuickActionsCommandGroup;

public final class AwsServerCapabiltiesProvider {
private static AwsServerCapabiltiesProvider instance;
private AwsServerCapabilities serverCapabilties;
private static final ChatOptions DEFAULT_CHAT_OPTIONS = new ChatOptions(
new QuickActions(
Collections.singletonList(
new QuickActionsCommandGroup(
Arrays.asList(
new Command("/help", "Learn more about Amazon Q"),
new Command("/clear", "Clear this session")
)
)
)
)
);

public static synchronized AwsServerCapabiltiesProvider getInstance() {
if (instance == null) {
Expand All @@ -24,6 +42,6 @@ public ChatOptions getChatOptions() {
if (serverCapabilties != null) {
return serverCapabilties.chatOptions();
}
return null;
return DEFAULT_CHAT_OPTIONS;
}
}
Loading