Allow extends to work without json suffix

Fixes #16905
This commit is contained in:
Matt Bierner
2018-08-02 10:35:54 +02:00
parent c86cab2211
commit 7c6c7ac5fe

View File

@@ -33,7 +33,16 @@ class TsconfigLinkProvider implements vscode.DocumentLinkProvider {
}
private getExendsLink(document: vscode.TextDocument, root: jsonc.Node): vscode.DocumentLink | undefined {
return this.pathNodeToLink(document, jsonc.findNodeAtLocation(root, ['extends']));
const extendsNode = jsonc.findNodeAtLocation(root, ['extends']);
if (!this.isPathValue(extendsNode)) {
return undefined;
}
return new vscode.DocumentLink(
this.getRange(document, extendsNode),
basename(extendsNode.value).match('.json$')
? this.getFileTarget(document, extendsNode)
: vscode.Uri.file(join(dirname(document.uri.fsPath), extendsNode!.value + '.json')));
}
private getFilesLinks(document: vscode.TextDocument, root: jsonc.Node) {