File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export class RequestBodyDocumentLinkProvider implements DocumentLinkProvider {
1515 let lines : string [ ] = text . split ( / \r ? \n / g) ;
1616 for ( var index = 0 ; index < lines . length ; index ++ ) {
1717 var line = lines [ index ] ;
18- let match : RegExpMatchArray | null ;
18+ let match : RegExpMatchArray ;
1919 if ( match = this . _linkPattern . exec ( line ) ) {
2020 let filePath = match [ 2 ] ;
2121 const offset = match [ 1 ] . length ;
@@ -41,8 +41,10 @@ export class RequestBodyDocumentLinkProvider implements DocumentLinkProvider {
4141 let resourcePath ;
4242 if ( ! uri . path ) {
4343 resourcePath = document . uri . path ;
44- } else if ( uri . path [ 0 ] === '/' ) {
45- resourcePath = path . join ( workspace . rootPath || '' , uri . path ) ;
44+ } else if ( path . isAbsolute ( uri . path ) ) {
45+ resourcePath = uri . path ;
46+ } else if ( workspace . rootPath ) {
47+ resourcePath = path . join ( workspace . rootPath , uri . path ) ;
4648 } else {
4749 resourcePath = path . join ( base , uri . path ) ;
4850 }
Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ export async function activate(context: ExtensionContext) {
4343 context . subscriptions . push ( commands . registerCommand ( 'rest-client.copy-request-as-curl' , ( ) => codeSnippetController . copyAsCurl ( ) ) ) ;
4444 context . subscriptions . push ( commands . registerCommand ( 'rest-client.switch-environment' , ( ) => environmentController . switchEnvironment ( ) ) ) ;
4545 context . subscriptions . push ( commands . registerCommand ( 'rest-client._openDocumentLink' , args => {
46- workspace . openTextDocument ( Uri . file ( args . path ) ) . then ( window . showTextDocument , window . showErrorMessage ) ;
46+ workspace . openTextDocument ( Uri . file ( args . path ) ) . then ( window . showTextDocument , error => {
47+ window . showErrorMessage ( error . message ) ;
48+ } ) ;
4749 } ) ) ;
4850 context . subscriptions . push ( languages . registerCompletionItemProvider ( 'http' , new HttpCompletionItemProvider ( ) ) ) ;
4951 context . subscriptions . push ( languages . registerHoverProvider ( 'http' , new CustomVariableHoverProvider ( ) ) ) ;
You can’t perform that action at this time.
0 commit comments