File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
test/unit/amazonq/lsp/chat Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ import {
3232 ShowSaveFileDialogParams ,
3333 LSPErrorCodes ,
3434 tabBarActionRequestType ,
35+ ShowDocumentParams ,
36+ ShowDocumentResult ,
37+ ShowDocumentRequest ,
38+ contextCommandsNotificationType ,
39+ ContextCommandParams ,
3540} from '@aws/language-server-runtimes/protocol'
3641import { v4 as uuidv4 } from 'uuid'
3742import * as vscode from 'vscode'
@@ -286,6 +291,23 @@ export function registerMessageListeners(
286291 targetUri : targetUri . toString ( ) ,
287292 }
288293 } )
294+
295+ languageClient . onRequest < ShowDocumentParams , ShowDocumentResult > (
296+ ShowDocumentRequest . method ,
297+ async ( params : ShowDocumentParams ) : Promise < ShowDocumentParams | ResponseError < ShowDocumentResult > > => {
298+ const uri = vscode . Uri . parse ( params . uri )
299+ const doc = await vscode . workspace . openTextDocument ( uri )
300+ await vscode . window . showTextDocument ( doc , { preview : false } )
301+ return params
302+ }
303+ )
304+
305+ languageClient . onNotification ( contextCommandsNotificationType . method , ( params : ContextCommandParams ) => {
306+ void provider . webview ?. postMessage ( {
307+ command : contextCommandsNotificationType . method ,
308+ params : params ,
309+ } )
310+ } )
289311}
290312
291313function isServerEvent ( command : string ) {
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ describe('registerMessageListeners', () => {
2727 error : errorStub ,
2828 sendNotification : sandbox . stub ( ) ,
2929 onRequest : sandbox . stub ( ) ,
30+ onNotification : sandbox . stub ( ) ,
3031 } as unknown as LanguageClient
3132
3233 provider = {
You can’t perform that action at this time.
0 commit comments