@@ -13,7 +13,7 @@ import { getLine, ITextDocument } from '../types/textDocument';
13
13
import { coalesce } from '../util/arrays' ;
14
14
import { noopToken } from '../util/cancellation' ;
15
15
import { Disposable } from '../util/dispose' ;
16
- import { getUriForLinkWithKnownExternalScheme , isOfScheme , Schemes } from '../util/schemes' ;
16
+ import { Schemes } from '../util/schemes' ;
17
17
import { MdDocumentInfoCache } from '../util/workspaceCache' ;
18
18
import { IMdWorkspace } from '../workspace' ;
19
19
@@ -43,14 +43,6 @@ function resolveLink(
43
43
link : string ,
44
44
) : ExternalHref | InternalHref | undefined {
45
45
const cleanLink = stripAngleBrackets ( link ) ;
46
- const externalSchemeUri = getUriForLinkWithKnownExternalScheme ( cleanLink ) ;
47
- if ( externalSchemeUri ) {
48
- // Normalize VS Code links to target currently running version
49
- if ( isOfScheme ( Schemes . vscode , link ) || isOfScheme ( Schemes [ 'vscode-insiders' ] , link ) ) {
50
- return { kind : 'external' , uri : vscode . Uri . parse ( link ) . with ( { scheme : vscode . env . uriScheme } ) } ;
51
- }
52
- return { kind : 'external' , uri : externalSchemeUri } ;
53
- }
54
46
55
47
if ( / ^ [ a - z \- ] [ a - z \- ] + : / i. test ( cleanLink ) ) {
56
48
// Looks like a uri
@@ -573,6 +565,11 @@ export class MdVsCodeLinkProvider implements vscode.DocumentLinkProvider {
573
565
private toValidDocumentLink ( link : MdLink , definitionSet : LinkDefinitionSet ) : vscode . DocumentLink | undefined {
574
566
switch ( link . href . kind ) {
575
567
case 'external' : {
568
+ let target = link . href . uri ;
569
+ // Normalize VS Code links to target currently running version
570
+ if ( link . href . uri . scheme === Schemes . vscode || link . href . uri . scheme === Schemes [ 'vscode-insiders' ] ) {
571
+ target = target . with ( { scheme : vscode . env . uriScheme } ) ;
572
+ }
576
573
return new vscode . DocumentLink ( link . source . hrefRange , link . href . uri ) ;
577
574
}
578
575
case 'internal' : {
0 commit comments