diff --git a/src/server/session.ts b/src/server/session.ts index 0fe57694d1a..d0aaf189214 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -344,6 +344,8 @@ namespace ts.server { function getDefinitionLocation(defaultProject: Project, initialLocation: DocumentPosition, isForRename: boolean): DocumentPosition | undefined { const infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, /*stopAtAlias*/ isForRename); const info = infos && firstOrUndefined(infos); + // Note that the value of `isLocal` may depend on whether or not the checker has run on the containing file + // (implying that FAR cascading behavior may depend on request order) return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined; } diff --git a/src/services/types.ts b/src/services/types.ts index 27c7616bf34..b9015a736d4 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1045,7 +1045,12 @@ namespace ts { containerKind: ScriptElementKind; containerName: string; unverified?: boolean; - /* @internal */ isLocal?: boolean; + /** @internal + * Initially, this value is determined syntactically, but it is updated by the checker to cover + * cases like declarations that are exported in subsequent statements. As a result, the value + * may be "incomplete" if this span has yet to be checked. + */ + isLocal?: boolean; /* @internal */ isAmbient?: boolean; /* @internal */ failedAliasResolution?: boolean; }