File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
packages/amazonq/src/lsp/chat Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -306,10 +306,17 @@ export function registerMessageListeners(
306306 languageClient . onRequest < ShowDocumentParams , ShowDocumentResult > (
307307 ShowDocumentRequest . method ,
308308 async ( params : ShowDocumentParams ) : Promise < ShowDocumentParams | ResponseError < ShowDocumentResult > > => {
309- const uri = vscode . Uri . parse ( params . uri )
310- const doc = await vscode . workspace . openTextDocument ( uri )
311- await vscode . window . showTextDocument ( doc , { preview : false } )
312- return params
309+ try {
310+ const uri = vscode . Uri . parse ( params . uri )
311+ const doc = await vscode . workspace . openTextDocument ( uri )
312+ await vscode . window . showTextDocument ( doc , { preview : false } )
313+ return params
314+ } catch ( e ) {
315+ return new ResponseError (
316+ LSPErrorCodes . RequestFailed ,
317+ `Failed to open document: ${ ( e as Error ) . message } `
318+ )
319+ }
313320 }
314321 )
315322
You can’t perform that action at this time.
0 commit comments