File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -195,23 +195,22 @@ export async function startLanguageServer(
195195 client . onRequest < ShowDocumentParams , ShowDocumentResult > (
196196 ShowDocumentRequest . method ,
197197 async ( params : ShowDocumentParams ) : Promise < ShowDocumentParams | ResponseError < ShowDocumentResult > > => {
198+ const uri = vscode . Uri . parse ( params . uri )
199+ getLogger ( ) . info ( `Processing ShowDocumentRequest for URI scheme: ${ uri . scheme } ` )
198200 try {
199- const uri = vscode . Uri . parse ( params . uri )
200201 if ( uri . scheme . startsWith ( 'http' ) ) {
201- try {
202- await openUrl ( vscode . Uri . parse ( params . uri ) )
203- return params
204- } catch ( err : any ) {
205- getLogger ( ) . error ( `Failed to open http from LSP: error: %s` , err )
206- }
202+ getLogger ( ) . info ( 'Opening URL...' )
203+ await openUrl ( vscode . Uri . parse ( params . uri ) )
204+ } else {
205+ getLogger ( ) . info ( 'Opening text document...' )
206+ const doc = await vscode . workspace . openTextDocument ( uri )
207+ await vscode . window . showTextDocument ( doc , { preview : false } )
207208 }
208- const doc = await vscode . workspace . openTextDocument ( uri )
209- await vscode . window . showTextDocument ( doc , { preview : false } )
210209 return params
211210 } catch ( e ) {
212211 return new ResponseError (
213212 LSPErrorCodes . RequestFailed ,
214- `Failed to open document : ${ ( e as Error ) . message } `
213+ `Failed to process ShowDocumentRequest : ${ ( e as Error ) . message } `
215214 )
216215 }
217216 }
You can’t perform that action at this time.
0 commit comments