Skip to content

Commit 8402d65

Browse files
authored
Document order-dependence of isLocal flag (#49959)
1 parent 5a53e9b commit 8402d65

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/server/session.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ namespace ts.server {
344344
function getDefinitionLocation(defaultProject: Project, initialLocation: DocumentPosition, isForRename: boolean): DocumentPosition | undefined {
345345
const infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, /*stopAtAlias*/ isForRename);
346346
const info = infos && firstOrUndefined(infos);
347+
// Note that the value of `isLocal` may depend on whether or not the checker has run on the containing file
348+
// (implying that FAR cascading behavior may depend on request order)
347349
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
348350
}
349351

src/services/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,12 @@ namespace ts {
10451045
containerKind: ScriptElementKind;
10461046
containerName: string;
10471047
unverified?: boolean;
1048-
/* @internal */ isLocal?: boolean;
1048+
/** @internal
1049+
* Initially, this value is determined syntactically, but it is updated by the checker to cover
1050+
* cases like declarations that are exported in subsequent statements. As a result, the value
1051+
* may be "incomplete" if this span has yet to be checked.
1052+
*/
1053+
isLocal?: boolean;
10491054
/* @internal */ isAmbient?: boolean;
10501055
/* @internal */ failedAliasResolution?: boolean;
10511056
}

0 commit comments

Comments
 (0)