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 {
32
32
ShowSaveFileDialogParams ,
33
33
LSPErrorCodes ,
34
34
tabBarActionRequestType ,
35
+ ShowDocumentParams ,
36
+ ShowDocumentResult ,
37
+ ShowDocumentRequest ,
38
+ contextCommandsNotificationType ,
39
+ ContextCommandParams ,
35
40
} from '@aws/language-server-runtimes/protocol'
36
41
import { v4 as uuidv4 } from 'uuid'
37
42
import * as vscode from 'vscode'
@@ -286,6 +291,23 @@ export function registerMessageListeners(
286
291
targetUri : targetUri . toString ( ) ,
287
292
}
288
293
} )
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
+ } )
289
311
}
290
312
291
313
function isServerEvent ( command : string ) {
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ describe('registerMessageListeners', () => {
27
27
error : errorStub ,
28
28
sendNotification : sandbox . stub ( ) ,
29
29
onRequest : sandbox . stub ( ) ,
30
+ onNotification : sandbox . stub ( ) ,
30
31
} as unknown as LanguageClient
31
32
32
33
provider = {
You can’t perform that action at this time.
0 commit comments