-
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
Send chat prompt message to lsp #26
Conversation
plugin/src/software/aws/toolkits/eclipse/amazonq/chat/ChatMessageProvider.java
Show resolved
Hide resolved
e.printStackTrace(); | ||
} | ||
return null; |
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.
Instead of swallowing the exception let's wrap the original with an AmazonQPluginException
and throw it back to the caller. In that case it should probably be the top level webview command execution logic that catches any error occurring during the processing of one of the commands. That could then log + potentially display an error to the user in the view (this part can come later).
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.
Good idea! Didn't realize there was an AmazonQPluginException
. Added to the other LSP send functions also.
void tabAdd(GenericTabParams params); | ||
|
||
@JsonNotification("aws/chat/ready") | ||
void chatReady(); |
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.
Did it not work when annotated as a JsonRequest
with a void response type (CompletableFuture<Void>
)? Maybe this makes more sense as an explicit fire & forget non blocking type though.
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.
Yeah the LSP server did not recognize the request when it was annotated as a JsonRequest
. The server is explicitly expecting a Notification
. Surprisingly, most of the LSP features are Notifications
rather than requests as specified in their doc (https://github.com/aws/language-server-runtimes/tree/main/runtimes#feature-specification-4)
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.
Cool, thanks for the info. That makes sense.
a5ca0d4
to
4ff9d04
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.
Made the requested updates
PluginLogger.error("Unhandled chat command: " + command.toString()); | ||
} | ||
return null; |
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.
Avoid the null return by explicitly raising a PluginException
here. This is a specific internal failure that should not be squelched.
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.
Throw AmazonQPlugiinException
for missing commands and fix checkstyle errors
default: | ||
PluginLogger.error("Unhandled chat command: " + command.toString()); | ||
throw new AmazonQPluginException("Unhandled command in ChatCommunicationManager: " + command.toString()); |
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.
@breedloj Throwing the PluginException
as you mentioned. You also mentioned throwing the exception to avoid returning null - I moved the return null
statements to the associated cases to be more explicit about which cases null is being returned on.
@@ -34,8 +40,7 @@ public final void handleCommand(final ParsedCommand parsedCommand, final Browser | |||
case TELEMETRY_EVENT: | |||
break; | |||
default: | |||
PluginLogger.info("Unhandled command: " + parsedCommand.getCommand()); | |||
break; | |||
throw new AmazonQPluginException("Unhandled command in AmazonQChatViewActionHandler: " + command.toString()); |
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.
@breedloj Also updated the ActionHandler to a PluginException
to match the unhandled command case in ChatCommunicationManager
Description:
aws/chat/sendChatPrompt
messageDemo of UI to Logged response
Log_response.mov