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 @@ -295,10 +295,17 @@ export function registerMessageListeners(
295295 languageClient . onRequest < ShowDocumentParams , ShowDocumentResult > (
296296 ShowDocumentRequest . method ,
297297 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
298+ try {
299+ const uri = vscode . Uri . parse ( params . uri )
300+ const doc = await vscode . workspace . openTextDocument ( uri )
301+ await vscode . window . showTextDocument ( doc , { preview : false } )
302+ return params
303+ } catch ( e ) {
304+ return new ResponseError (
305+ LSPErrorCodes . RequestFailed ,
306+ `Failed to open document: ${ ( e as Error ) . message } `
307+ )
308+ }
302309 }
303310 )
304311
You can’t perform that action at this time.
0 commit comments