Added triple slash support

This commit is contained in:
Armando Aguirre 2017-10-24 14:02:02 -07:00
parent f8ccde5218
commit 7f577dcef3
5 changed files with 14 additions and 8 deletions

View file

@ -156,10 +156,16 @@ namespace ts.GoToDefinition {
return undefined;
}
// TODO: Add textSpan for triple slash references (file and type).
const comment = findReferenceInPosition(sourceFile.referencedFiles, position);
if (comment && tryResolveScriptReference(program, sourceFile, comment) || findReferenceInPosition(sourceFile.typeReferenceDirectives, position)) {
return { definitions, textSpan: undefined };
let comment = findReferenceInPosition(sourceFile.referencedFiles, position);
if (!comment || !tryResolveScriptReference(program, sourceFile, comment)) {
comment = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
}
if (comment) {
return {
definitions,
textSpan: createTextSpanFromBounds(comment.pos, comment.end)
};
}
const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);

View file

@ -4,7 +4,7 @@
//// //MyFile Comments
//// //more comments
//// /// <reference path="so/*unknownFile*/mePath.ts" />
//// /// <reference path="b/*knownFile*/.ts" />
//// /// <reference path="[|b/*knownFile*/.ts|]" />
////
//// class clsInOverload {
//// static fnOverload();

View file

@ -5,7 +5,7 @@
/////*0*/declare let $: {x: number};
// @Filename: src/app.ts
//// /// <reference types="lib/*1*/"/>
//// /// <reference types="[|lib/*1*/|]"/>
//// $.x;
verify.goToDefinition("1", "0");

View file

@ -5,7 +5,7 @@
/////*0*/declare let $: {x: number};
// @Filename: src/app.ts
//// /// <reference types="lib/*1*/"/>
//// /// <reference types="[|lib/*1*/|]"/>
//// $.x;
verify.goToDefinition("1", "0");

View file

@ -5,7 +5,7 @@
/////*0*/declare let $: {x: number};
// @Filename: src/app.ts
//// /// <reference types="lib/*1*/"/>
//// /// <reference types="[|lib/*1*/|]"/>
//// $.x;
verify.goToDefinition("1", "0");