typescript 4.8.0-dev.20220518 → 4.8.0-dev.20220521
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2020.intl.d.ts +1 -0
- package/lib/tsc.js +11 -8
- package/lib/tsserver.js +505 -338
- package/lib/tsserverlibrary.js +505 -338
- package/lib/typescript.js +263 -195
- package/lib/typescriptServices.js +263 -195
- package/lib/typingsInstaller.js +11 -8
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220521";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -2432,6 +2432,7 @@ var ts;
|
|
|
2432
2432
|
startsWith(candidate, prefix) &&
|
|
2433
2433
|
endsWith(candidate, suffix);
|
|
2434
2434
|
}
|
|
2435
|
+
ts.isPatternMatch = isPatternMatch;
|
|
2435
2436
|
function and(f, g) {
|
|
2436
2437
|
return function (arg) { return f(arg) && g(arg); };
|
|
2437
2438
|
}
|
|
@@ -82810,7 +82811,7 @@ var ts;
|
|
|
82810
82811
|
var childSymbol = getSymbolAtLocation(childNode);
|
|
82811
82812
|
if (childSymbol && childSymbol === testedSymbol) {
|
|
82812
82813
|
// If the test was a simple identifier, the above check is sufficient
|
|
82813
|
-
if (ts.isIdentifier(expr)) {
|
|
82814
|
+
if (ts.isIdentifier(expr) || ts.isIdentifier(testedNode) && ts.isBinaryExpression(testedNode.parent)) {
|
|
82814
82815
|
return true;
|
|
82815
82816
|
}
|
|
82816
82817
|
// Otherwise we need to ensure the symbol is called on the same target
|
|
@@ -116024,7 +116025,7 @@ var ts;
|
|
|
116024
116025
|
};
|
|
116025
116026
|
}
|
|
116026
116027
|
// directoryExists
|
|
116027
|
-
if (originalDirectoryExists
|
|
116028
|
+
if (originalDirectoryExists) {
|
|
116028
116029
|
host.directoryExists = function (directory) {
|
|
116029
116030
|
var key = toPath(directory);
|
|
116030
116031
|
var value = directoryExistsCache.get(key);
|
|
@@ -116034,11 +116035,13 @@ var ts;
|
|
|
116034
116035
|
directoryExistsCache.set(key, !!newValue);
|
|
116035
116036
|
return newValue;
|
|
116036
116037
|
};
|
|
116037
|
-
|
|
116038
|
-
|
|
116039
|
-
|
|
116040
|
-
|
|
116041
|
-
|
|
116038
|
+
if (originalCreateDirectory) {
|
|
116039
|
+
host.createDirectory = function (directory) {
|
|
116040
|
+
var key = toPath(directory);
|
|
116041
|
+
directoryExistsCache.delete(key);
|
|
116042
|
+
originalCreateDirectory.call(host, directory);
|
|
116043
|
+
};
|
|
116044
|
+
}
|
|
116042
116045
|
}
|
|
116043
116046
|
return {
|
|
116044
116047
|
originalReadFile: originalReadFile,
|
|
@@ -128424,6 +128427,41 @@ var ts;
|
|
|
128424
128427
|
return true;
|
|
128425
128428
|
}
|
|
128426
128429
|
ts.isTextWhiteSpaceLike = isTextWhiteSpaceLike;
|
|
128430
|
+
function getMappedLocation(location, sourceMapper, fileExists) {
|
|
128431
|
+
var mapsTo = sourceMapper.tryGetSourcePosition(location);
|
|
128432
|
+
return mapsTo && (!fileExists || fileExists(ts.normalizePath(mapsTo.fileName)) ? mapsTo : undefined);
|
|
128433
|
+
}
|
|
128434
|
+
ts.getMappedLocation = getMappedLocation;
|
|
128435
|
+
function getMappedDocumentSpan(documentSpan, sourceMapper, fileExists) {
|
|
128436
|
+
var fileName = documentSpan.fileName, textSpan = documentSpan.textSpan;
|
|
128437
|
+
var newPosition = getMappedLocation({ fileName: fileName, pos: textSpan.start }, sourceMapper, fileExists);
|
|
128438
|
+
if (!newPosition)
|
|
128439
|
+
return undefined;
|
|
128440
|
+
var newEndPosition = getMappedLocation({ fileName: fileName, pos: textSpan.start + textSpan.length }, sourceMapper, fileExists);
|
|
128441
|
+
var newLength = newEndPosition
|
|
128442
|
+
? newEndPosition.pos - newPosition.pos
|
|
128443
|
+
: textSpan.length; // This shouldn't happen
|
|
128444
|
+
return {
|
|
128445
|
+
fileName: newPosition.fileName,
|
|
128446
|
+
textSpan: {
|
|
128447
|
+
start: newPosition.pos,
|
|
128448
|
+
length: newLength,
|
|
128449
|
+
},
|
|
128450
|
+
originalFileName: documentSpan.fileName,
|
|
128451
|
+
originalTextSpan: documentSpan.textSpan,
|
|
128452
|
+
contextSpan: getMappedContextSpan(documentSpan, sourceMapper, fileExists),
|
|
128453
|
+
originalContextSpan: documentSpan.contextSpan
|
|
128454
|
+
};
|
|
128455
|
+
}
|
|
128456
|
+
ts.getMappedDocumentSpan = getMappedDocumentSpan;
|
|
128457
|
+
function getMappedContextSpan(documentSpan, sourceMapper, fileExists) {
|
|
128458
|
+
var contextSpanStart = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start }, sourceMapper, fileExists);
|
|
128459
|
+
var contextSpanEnd = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start + documentSpan.contextSpan.length }, sourceMapper, fileExists);
|
|
128460
|
+
return contextSpanStart && contextSpanEnd ?
|
|
128461
|
+
{ start: contextSpanStart.pos, length: contextSpanEnd.pos - contextSpanStart.pos } :
|
|
128462
|
+
undefined;
|
|
128463
|
+
}
|
|
128464
|
+
ts.getMappedContextSpan = getMappedContextSpan;
|
|
128427
128465
|
// #endregion
|
|
128428
128466
|
// Display-part writer helpers
|
|
128429
128467
|
// #region
|
|
@@ -131620,6 +131658,7 @@ var ts;
|
|
|
131620
131658
|
* Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename.
|
|
131621
131659
|
*/
|
|
131622
131660
|
function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, _a, host, exclude, result) {
|
|
131661
|
+
var _b;
|
|
131623
131662
|
var extensions = _a.extensions, includeExtensionsOption = _a.includeExtensionsOption;
|
|
131624
131663
|
if (result === void 0) { result = []; }
|
|
131625
131664
|
if (fragment === undefined) {
|
|
@@ -131637,9 +131676,26 @@ var ts;
|
|
|
131637
131676
|
fragment = "." + ts.directorySeparator;
|
|
131638
131677
|
}
|
|
131639
131678
|
fragment = ts.ensureTrailingDirectorySeparator(fragment);
|
|
131640
|
-
// const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment)); // TODO(rbuckton): should use resolvePaths
|
|
131641
131679
|
var absolutePath = ts.resolvePath(scriptPath, fragment);
|
|
131642
131680
|
var baseDirectory = ts.hasTrailingDirectorySeparator(absolutePath) ? absolutePath : ts.getDirectoryPath(absolutePath);
|
|
131681
|
+
// check for a version redirect
|
|
131682
|
+
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
131683
|
+
if (packageJsonPath) {
|
|
131684
|
+
var packageJson = ts.readJson(packageJsonPath, host);
|
|
131685
|
+
var typesVersions = packageJson.typesVersions;
|
|
131686
|
+
if (typeof typesVersions === "object") {
|
|
131687
|
+
var versionPaths = (_b = ts.getPackageJsonTypesVersionsPaths(typesVersions)) === null || _b === void 0 ? void 0 : _b.paths;
|
|
131688
|
+
if (versionPaths) {
|
|
131689
|
+
var packageDirectory = ts.getDirectoryPath(packageJsonPath);
|
|
131690
|
+
var pathInPackage = absolutePath.slice(ts.ensureTrailingDirectorySeparator(packageDirectory).length);
|
|
131691
|
+
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensions, versionPaths, host)) {
|
|
131692
|
+
// A true result means one of the `versionPaths` was matched, which will block relative resolution
|
|
131693
|
+
// to files and folders from here. All reachable paths given the pattern match are already added.
|
|
131694
|
+
return result;
|
|
131695
|
+
}
|
|
131696
|
+
}
|
|
131697
|
+
}
|
|
131698
|
+
}
|
|
131643
131699
|
var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
131644
131700
|
if (!ts.tryDirectoryExists(host, baseDirectory))
|
|
131645
131701
|
return result;
|
|
@@ -131681,48 +131737,62 @@ var ts;
|
|
|
131681
131737
|
// If possible, get folder completion as well
|
|
131682
131738
|
var directories = ts.tryGetDirectories(host, baseDirectory);
|
|
131683
131739
|
if (directories) {
|
|
131684
|
-
for (var
|
|
131685
|
-
var directory = directories_1[
|
|
131740
|
+
for (var _c = 0, directories_1 = directories; _c < directories_1.length; _c++) {
|
|
131741
|
+
var directory = directories_1[_c];
|
|
131686
131742
|
var directoryName = ts.getBaseFileName(ts.normalizePath(directory));
|
|
131687
131743
|
if (directoryName !== "@types") {
|
|
131688
131744
|
result.push(directoryResult(directoryName));
|
|
131689
131745
|
}
|
|
131690
131746
|
}
|
|
131691
131747
|
}
|
|
131692
|
-
// check for a version redirect
|
|
131693
|
-
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
131694
|
-
if (packageJsonPath) {
|
|
131695
|
-
var packageJson = ts.readJson(packageJsonPath, host);
|
|
131696
|
-
var typesVersions = packageJson.typesVersions;
|
|
131697
|
-
if (typeof typesVersions === "object") {
|
|
131698
|
-
var versionResult = ts.getPackageJsonTypesVersionsPaths(typesVersions);
|
|
131699
|
-
var versionPaths = versionResult && versionResult.paths;
|
|
131700
|
-
var rest = absolutePath.slice(ts.ensureTrailingDirectorySeparator(baseDirectory).length);
|
|
131701
|
-
if (versionPaths) {
|
|
131702
|
-
addCompletionEntriesFromPaths(result, rest, baseDirectory, extensions, versionPaths, host);
|
|
131703
|
-
}
|
|
131704
|
-
}
|
|
131705
|
-
}
|
|
131706
131748
|
return result;
|
|
131707
131749
|
}
|
|
131750
|
+
/** @returns whether `fragment` was a match for any `paths` (which should indicate whether any other path completions should be offered) */
|
|
131708
131751
|
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, fileExtensions, paths, host) {
|
|
131752
|
+
var _a;
|
|
131753
|
+
var pathResults = [];
|
|
131754
|
+
var matchedPathPrefixLength = -1;
|
|
131709
131755
|
for (var path in paths) {
|
|
131710
131756
|
if (!ts.hasProperty(paths, path))
|
|
131711
131757
|
continue;
|
|
131712
131758
|
var patterns = paths[path];
|
|
131713
131759
|
if (patterns) {
|
|
131714
|
-
var
|
|
131715
|
-
|
|
131716
|
-
|
|
131717
|
-
|
|
131718
|
-
|
|
131719
|
-
|
|
131720
|
-
|
|
131721
|
-
|
|
131722
|
-
|
|
131760
|
+
var pathPattern = ts.tryParsePattern(path);
|
|
131761
|
+
if (!pathPattern)
|
|
131762
|
+
continue;
|
|
131763
|
+
var isMatch = typeof pathPattern === "object" && ts.isPatternMatch(pathPattern, fragment);
|
|
131764
|
+
var isLongestMatch = isMatch && (matchedPathPrefixLength === undefined || pathPattern.prefix.length > matchedPathPrefixLength);
|
|
131765
|
+
if (isLongestMatch) {
|
|
131766
|
+
// If this is a higher priority match than anything we've seen so far, previous results from matches are invalid, e.g.
|
|
131767
|
+
// for `import {} from "some-package/|"` with a typesVersions:
|
|
131768
|
+
// {
|
|
131769
|
+
// "bar/*": ["bar/*"], // <-- 1. We add 'bar', but 'bar/*' doesn't match yet.
|
|
131770
|
+
// "*": ["dist/*"], // <-- 2. We match here and add files from dist. 'bar' is still ok because it didn't come from a match.
|
|
131771
|
+
// "foo/*": ["foo/*"] // <-- 3. We matched '*' earlier and added results from dist, but if 'foo/*' also matched,
|
|
131772
|
+
// } results in dist would not be visible. 'bar' still stands because it didn't come from a match.
|
|
131773
|
+
// This is especially important if `dist/foo` is a folder, because if we fail to clear results
|
|
131774
|
+
// added by the '*' match, after typing `"some-package/foo/|"` we would get file results from both
|
|
131775
|
+
// ./dist/foo and ./foo, when only the latter will actually be resolvable.
|
|
131776
|
+
// See pathCompletionsTypesVersionsWildcard6.ts.
|
|
131777
|
+
matchedPathPrefixLength = pathPattern.prefix.length;
|
|
131778
|
+
pathResults = pathResults.filter(function (r) { return !r.matchedPattern; });
|
|
131779
|
+
}
|
|
131780
|
+
if (typeof pathPattern === "string" || matchedPathPrefixLength === undefined || pathPattern.prefix.length >= matchedPathPrefixLength) {
|
|
131781
|
+
pathResults.push({
|
|
131782
|
+
matchedPattern: isMatch,
|
|
131783
|
+
results: getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host)
|
|
131784
|
+
.map(function (_a) {
|
|
131785
|
+
var name = _a.name, kind = _a.kind, extension = _a.extension;
|
|
131786
|
+
return nameAndKind(name, kind, extension);
|
|
131787
|
+
}),
|
|
131788
|
+
});
|
|
131723
131789
|
}
|
|
131724
131790
|
}
|
|
131725
131791
|
}
|
|
131792
|
+
var equatePaths = ((_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host)) ? ts.equateStringsCaseSensitive : ts.equateStringsCaseInsensitive;
|
|
131793
|
+
var equateResults = function (a, b) { return equatePaths(a.name, b.name); };
|
|
131794
|
+
pathResults.forEach(function (pathResult) { return pathResult.results.forEach(function (pathResult) { return ts.pushIfUnique(result, pathResult, equateResults); }); });
|
|
131795
|
+
return matchedPathPrefixLength > -1;
|
|
131726
131796
|
}
|
|
131727
131797
|
/**
|
|
131728
131798
|
* Check all of the declared modules and those in node modules. Possible sources of modules:
|
|
@@ -131754,7 +131824,7 @@ var ts;
|
|
|
131754
131824
|
// (But do if we didn't find anything, e.g. 'package.json' missing.)
|
|
131755
131825
|
var foundGlobal = false;
|
|
131756
131826
|
if (fragmentDirectory === undefined) {
|
|
131757
|
-
var
|
|
131827
|
+
var _loop_3 = function (moduleName) {
|
|
131758
131828
|
if (!result.some(function (entry) { return entry.name === moduleName; })) {
|
|
131759
131829
|
foundGlobal = true;
|
|
131760
131830
|
result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
|
|
@@ -131762,7 +131832,7 @@ var ts;
|
|
|
131762
131832
|
};
|
|
131763
131833
|
for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
|
|
131764
131834
|
var moduleName = _c[_b];
|
|
131765
|
-
|
|
131835
|
+
_loop_3(moduleName);
|
|
131766
131836
|
}
|
|
131767
131837
|
}
|
|
131768
131838
|
if (!foundGlobal) {
|
|
@@ -131842,11 +131912,16 @@ var ts;
|
|
|
131842
131912
|
}
|
|
131843
131913
|
var pathPrefix = path.slice(0, path.length - 1);
|
|
131844
131914
|
var remainingFragment = ts.tryRemovePrefix(fragment, pathPrefix);
|
|
131845
|
-
|
|
131846
|
-
|
|
131847
|
-
|
|
131915
|
+
if (remainingFragment === undefined) {
|
|
131916
|
+
var starIsFullPathComponent = path[path.length - 2] === "/";
|
|
131917
|
+
return starIsFullPathComponent ? justPathMappingName(pathPrefix) : ts.flatMap(patterns, function (pattern) { var _a; return (_a = getModulesForPathsPattern("", baseUrl, pattern, fileExtensions, host)) === null || _a === void 0 ? void 0 : _a.map(function (_a) {
|
|
131918
|
+
var name = _a.name, rest = __rest(_a, ["name"]);
|
|
131919
|
+
return (__assign({ name: pathPrefix + name }, rest));
|
|
131920
|
+
}); });
|
|
131921
|
+
}
|
|
131922
|
+
return ts.flatMap(patterns, function (pattern) { return getModulesForPathsPattern(remainingFragment, baseUrl, pattern, fileExtensions, host); });
|
|
131848
131923
|
function justPathMappingName(name) {
|
|
131849
|
-
return ts.startsWith(name, fragment) ? [directoryResult(name)] : ts.emptyArray;
|
|
131924
|
+
return ts.startsWith(name, fragment) ? [directoryResult(ts.removeTrailingDirectorySeparator(name))] : ts.emptyArray;
|
|
131850
131925
|
}
|
|
131851
131926
|
}
|
|
131852
131927
|
function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) {
|
|
@@ -137345,6 +137420,7 @@ var ts;
|
|
|
137345
137420
|
var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined;
|
|
137346
137421
|
return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; })));
|
|
137347
137422
|
}
|
|
137423
|
+
FindAllReferences.isDeclarationOfSymbol = isDeclarationOfSymbol;
|
|
137348
137424
|
/**
|
|
137349
137425
|
* True if 'decl' provides a value, as in `function f() {}`;
|
|
137350
137426
|
* false if 'decl' is just a location for a future write, as in 'let x;'
|
|
@@ -137551,7 +137627,7 @@ var ts;
|
|
|
137551
137627
|
result = references;
|
|
137552
137628
|
continue;
|
|
137553
137629
|
}
|
|
137554
|
-
var
|
|
137630
|
+
var _loop_4 = function (entry) {
|
|
137555
137631
|
if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
|
|
137556
137632
|
result.push(entry);
|
|
137557
137633
|
return "continue";
|
|
@@ -137583,7 +137659,7 @@ var ts;
|
|
|
137583
137659
|
};
|
|
137584
137660
|
for (var _b = 0, references_2 = references; _b < references_2.length; _b++) {
|
|
137585
137661
|
var entry = references_2[_b];
|
|
137586
|
-
|
|
137662
|
+
_loop_4(entry);
|
|
137587
137663
|
}
|
|
137588
137664
|
}
|
|
137589
137665
|
return result;
|
|
@@ -139611,7 +139687,7 @@ var ts;
|
|
|
139611
139687
|
}
|
|
139612
139688
|
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
|
|
139613
139689
|
var allFiles = program.getSourceFiles();
|
|
139614
|
-
var
|
|
139690
|
+
var _loop_5 = function (sourceFile) {
|
|
139615
139691
|
var newFromOld = oldToNew(sourceFile.fileName);
|
|
139616
139692
|
var newImportFromPath = newFromOld !== null && newFromOld !== void 0 ? newFromOld : sourceFile.fileName;
|
|
139617
139693
|
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
|
|
@@ -139643,7 +139719,7 @@ var ts;
|
|
|
139643
139719
|
};
|
|
139644
139720
|
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
|
|
139645
139721
|
var sourceFile = allFiles_1[_i];
|
|
139646
|
-
|
|
139722
|
+
_loop_5(sourceFile);
|
|
139647
139723
|
}
|
|
139648
139724
|
}
|
|
139649
139725
|
function combineNormal(pathA, pathB) {
|
|
@@ -140667,7 +140743,7 @@ var ts;
|
|
|
140667
140743
|
if (!patternMatcher)
|
|
140668
140744
|
return ts.emptyArray;
|
|
140669
140745
|
var rawItems = [];
|
|
140670
|
-
var
|
|
140746
|
+
var _loop_6 = function (sourceFile) {
|
|
140671
140747
|
cancellationToken.throwIfCancellationRequested();
|
|
140672
140748
|
if (excludeDtsFiles && sourceFile.isDeclarationFile) {
|
|
140673
140749
|
return "continue";
|
|
@@ -140679,7 +140755,7 @@ var ts;
|
|
|
140679
140755
|
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
|
|
140680
140756
|
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
|
|
140681
140757
|
var sourceFile = sourceFiles_4[_i];
|
|
140682
|
-
|
|
140758
|
+
_loop_6(sourceFile);
|
|
140683
140759
|
}
|
|
140684
140760
|
rawItems.sort(compareNavigateToItems);
|
|
140685
140761
|
return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
|
|
@@ -142744,13 +142820,13 @@ var ts;
|
|
|
142744
142820
|
// Assumes 'value' is already lowercase.
|
|
142745
142821
|
function indexOfIgnoringCase(str, value) {
|
|
142746
142822
|
var n = str.length - value.length;
|
|
142747
|
-
var
|
|
142823
|
+
var _loop_7 = function (start) {
|
|
142748
142824
|
if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
|
|
142749
142825
|
return { value: start };
|
|
142750
142826
|
}
|
|
142751
142827
|
};
|
|
142752
142828
|
for (var start = 0; start <= n; start++) {
|
|
142753
|
-
var state_3 =
|
|
142829
|
+
var state_3 = _loop_7(start);
|
|
142754
142830
|
if (typeof state_3 === "object")
|
|
142755
142831
|
return state_3.value;
|
|
142756
142832
|
}
|
|
@@ -144169,7 +144245,7 @@ var ts;
|
|
|
144169
144245
|
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
|
|
144170
144246
|
}
|
|
144171
144247
|
function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
|
|
144172
|
-
var
|
|
144248
|
+
var _loop_8 = function (n) {
|
|
144173
144249
|
// If the node is not a subspan of its parent, this is a big problem.
|
|
144174
144250
|
// There have been crashes that might be caused by this violation.
|
|
144175
144251
|
ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.formatSyntaxKind(n.kind) + ", parent: " + ts.Debug.formatSyntaxKind(n.parent.kind); });
|
|
@@ -144179,7 +144255,7 @@ var ts;
|
|
|
144179
144255
|
}
|
|
144180
144256
|
};
|
|
144181
144257
|
for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
|
|
144182
|
-
var state_4 =
|
|
144258
|
+
var state_4 = _loop_8(n);
|
|
144183
144259
|
if (typeof state_4 === "object")
|
|
144184
144260
|
return state_4.value;
|
|
144185
144261
|
}
|
|
@@ -145778,7 +145854,7 @@ var ts;
|
|
|
145778
145854
|
commandLineOptionsStringToEnum = commandLineOptionsStringToEnum ||
|
|
145779
145855
|
ts.filter(ts.optionDeclarations, function (o) { return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); });
|
|
145780
145856
|
options = ts.cloneCompilerOptions(options);
|
|
145781
|
-
var
|
|
145857
|
+
var _loop_9 = function (opt) {
|
|
145782
145858
|
if (!ts.hasProperty(options, opt.name)) {
|
|
145783
145859
|
return "continue";
|
|
145784
145860
|
}
|
|
@@ -145797,7 +145873,7 @@ var ts;
|
|
|
145797
145873
|
};
|
|
145798
145874
|
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
|
|
145799
145875
|
var opt = commandLineOptionsStringToEnum_1[_i];
|
|
145800
|
-
|
|
145876
|
+
_loop_9(opt);
|
|
145801
145877
|
}
|
|
145802
145878
|
return options;
|
|
145803
145879
|
}
|
|
@@ -149545,7 +149621,7 @@ var ts;
|
|
|
149545
149621
|
ChangeTracker.prototype.finishDeleteDeclarations = function () {
|
|
149546
149622
|
var _this = this;
|
|
149547
149623
|
var deletedNodesInLists = new ts.Set(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
|
|
149548
|
-
var
|
|
149624
|
+
var _loop_10 = function (sourceFile, node) {
|
|
149549
149625
|
if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
|
|
149550
149626
|
if (ts.isArray(node)) {
|
|
149551
149627
|
this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(sourceFile, node));
|
|
@@ -149558,7 +149634,7 @@ var ts;
|
|
|
149558
149634
|
var this_1 = this;
|
|
149559
149635
|
for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
|
|
149560
149636
|
var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
|
|
149561
|
-
|
|
149637
|
+
_loop_10(sourceFile, node);
|
|
149562
149638
|
}
|
|
149563
149639
|
deletedNodesInLists.forEach(function (node) {
|
|
149564
149640
|
var sourceFile = node.getSourceFile();
|
|
@@ -149646,14 +149722,14 @@ var ts;
|
|
|
149646
149722
|
// order changes by start position
|
|
149647
149723
|
// If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa.
|
|
149648
149724
|
var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
|
|
149649
|
-
var
|
|
149725
|
+
var _loop_11 = function (i) {
|
|
149650
149726
|
ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
|
|
149651
149727
|
return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
|
|
149652
149728
|
});
|
|
149653
149729
|
};
|
|
149654
149730
|
// verify that change intervals do not overlap, except possibly at end points.
|
|
149655
149731
|
for (var i = 0; i < normalized.length - 1; i++) {
|
|
149656
|
-
|
|
149732
|
+
_loop_11(i);
|
|
149657
149733
|
}
|
|
149658
149734
|
var textChanges = ts.mapDefined(normalized, function (c) {
|
|
149659
149735
|
var span = ts.createTextSpanFromRange(c.range);
|
|
@@ -150562,7 +150638,7 @@ var ts;
|
|
|
150562
150638
|
}
|
|
150563
150639
|
var isCompleteFix = identifiers.isCompleteFix;
|
|
150564
150640
|
var initializers;
|
|
150565
|
-
var
|
|
150641
|
+
var _loop_12 = function (identifier) {
|
|
150566
150642
|
var symbol = checker.getSymbolAtLocation(identifier);
|
|
150567
150643
|
if (!symbol) {
|
|
150568
150644
|
return "continue";
|
|
@@ -150595,7 +150671,7 @@ var ts;
|
|
|
150595
150671
|
};
|
|
150596
150672
|
for (var _i = 0, _a = identifiers.identifiers; _i < _a.length; _i++) {
|
|
150597
150673
|
var identifier = _a[_i];
|
|
150598
|
-
|
|
150674
|
+
_loop_12(identifier);
|
|
150599
150675
|
}
|
|
150600
150676
|
return initializers && {
|
|
150601
150677
|
initializers: initializers,
|
|
@@ -151485,7 +151561,7 @@ var ts;
|
|
|
151485
151561
|
functionToConvert.getStart(sourceFile);
|
|
151486
151562
|
var options = functionToConvert.modifiers ? { prefix: " " } : { suffix: " " };
|
|
151487
151563
|
changes.insertModifierAt(sourceFile, pos, 131 /* AsyncKeyword */, options);
|
|
151488
|
-
var
|
|
151564
|
+
var _loop_13 = function (returnStatement) {
|
|
151489
151565
|
ts.forEachChild(returnStatement, function visit(node) {
|
|
151490
151566
|
if (ts.isCallExpression(node)) {
|
|
151491
151567
|
var newNodes = transformExpression(node, node, transformer, /*hasContinuation*/ false);
|
|
@@ -151507,7 +151583,7 @@ var ts;
|
|
|
151507
151583
|
};
|
|
151508
151584
|
for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
|
|
151509
151585
|
var returnStatement = returnStatements_1[_i];
|
|
151510
|
-
var state_5 =
|
|
151586
|
+
var state_5 = _loop_13(returnStatement);
|
|
151511
151587
|
if (typeof state_5 === "object")
|
|
151512
151588
|
return state_5.value;
|
|
151513
151589
|
}
|
|
@@ -154755,7 +154831,7 @@ var ts;
|
|
|
154755
154831
|
});
|
|
154756
154832
|
typeDeclToMembers.forEach(function (infos, declaration) {
|
|
154757
154833
|
var supers = ts.isTypeLiteralNode(declaration) ? undefined : codefix.getAllSupers(declaration, checker);
|
|
154758
|
-
var
|
|
154834
|
+
var _loop_14 = function (info) {
|
|
154759
154835
|
// If some superclass added this property, don't add it again.
|
|
154760
154836
|
if (supers === null || supers === void 0 ? void 0 : supers.some(function (superClassOrInterface) {
|
|
154761
154837
|
var superInfos = typeDeclToMembers.get(superClassOrInterface);
|
|
@@ -154782,7 +154858,7 @@ var ts;
|
|
|
154782
154858
|
};
|
|
154783
154859
|
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
|
|
154784
154860
|
var info = infos_1[_i];
|
|
154785
|
-
|
|
154861
|
+
_loop_14(info);
|
|
154786
154862
|
}
|
|
154787
154863
|
});
|
|
154788
154864
|
}));
|
|
@@ -157545,7 +157621,7 @@ var ts;
|
|
|
157545
157621
|
function getSignatureFromCalls(calls) {
|
|
157546
157622
|
var parameters = [];
|
|
157547
157623
|
var length = Math.max.apply(Math, calls.map(function (c) { return c.argumentTypes.length; }));
|
|
157548
|
-
var
|
|
157624
|
+
var _loop_15 = function (i) {
|
|
157549
157625
|
var symbol = checker.createSymbol(1 /* FunctionScopedVariable */, ts.escapeLeadingUnderscores("arg" + i));
|
|
157550
157626
|
symbol.type = combineTypes(calls.map(function (call) { return call.argumentTypes[i] || checker.getUndefinedType(); }));
|
|
157551
157627
|
if (calls.some(function (call) { return call.argumentTypes[i] === undefined; })) {
|
|
@@ -157554,7 +157630,7 @@ var ts;
|
|
|
157554
157630
|
parameters.push(symbol);
|
|
157555
157631
|
};
|
|
157556
157632
|
for (var i = 0; i < length; i++) {
|
|
157557
|
-
|
|
157633
|
+
_loop_15(i);
|
|
157558
157634
|
}
|
|
157559
157635
|
var returnType = combineFromUsage(combineUsages(calls.map(function (call) { return call.return_; })));
|
|
157560
157636
|
return checker.createSignature(/*declaration*/ undefined, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, 0 /* None */);
|
|
@@ -159527,7 +159603,7 @@ var ts;
|
|
|
159527
159603
|
// Imports that need to be kept as named imports in the refactored code, to avoid changing the semantics.
|
|
159528
159604
|
// More specifically, those are named imports that appear in named exports in the original code, e.g. `a` in `import { a } from "m"; export { a }`.
|
|
159529
159605
|
var neededNamedImports = new ts.Set();
|
|
159530
|
-
var
|
|
159606
|
+
var _loop_16 = function (element) {
|
|
159531
159607
|
var propertyName = (element.propertyName || element.name).text;
|
|
159532
159608
|
ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
|
|
159533
159609
|
var access = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(namespaceImportName), propertyName);
|
|
@@ -159544,7 +159620,7 @@ var ts;
|
|
|
159544
159620
|
};
|
|
159545
159621
|
for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
|
|
159546
159622
|
var element = _a[_i];
|
|
159547
|
-
|
|
159623
|
+
_loop_16(element);
|
|
159548
159624
|
}
|
|
159549
159625
|
changes.replaceNode(sourceFile, toConvert, shouldUseDefault
|
|
159550
159626
|
? ts.factory.createIdentifier(namespaceImportName)
|
|
@@ -161442,7 +161518,7 @@ var ts;
|
|
|
161442
161518
|
: ts.getEnclosingBlockScopeContainer(scopes[0]);
|
|
161443
161519
|
ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
|
|
161444
161520
|
}
|
|
161445
|
-
var
|
|
161521
|
+
var _loop_17 = function (i) {
|
|
161446
161522
|
var scopeUsages = usagesPerScope[i];
|
|
161447
161523
|
// Special case: in the innermost scope, all usages are available.
|
|
161448
161524
|
// (The computed value reflects the value at the top-level of the scope, but the
|
|
@@ -161485,7 +161561,7 @@ var ts;
|
|
|
161485
161561
|
}
|
|
161486
161562
|
};
|
|
161487
161563
|
for (var i = 0; i < scopes.length; i++) {
|
|
161488
|
-
|
|
161564
|
+
_loop_17(i);
|
|
161489
161565
|
}
|
|
161490
161566
|
return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
|
|
161491
161567
|
function isInGenericContext(node) {
|
|
@@ -162188,10 +162264,10 @@ var ts;
|
|
|
162188
162264
|
}
|
|
162189
162265
|
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
|
|
162190
162266
|
var checker = program.getTypeChecker();
|
|
162191
|
-
var
|
|
162267
|
+
var _loop_18 = function (sourceFile) {
|
|
162192
162268
|
if (sourceFile === oldFile)
|
|
162193
162269
|
return "continue";
|
|
162194
|
-
var
|
|
162270
|
+
var _loop_19 = function (statement) {
|
|
162195
162271
|
forEachImportInStatement(statement, function (importNode) {
|
|
162196
162272
|
if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
|
|
162197
162273
|
return;
|
|
@@ -162213,12 +162289,12 @@ var ts;
|
|
|
162213
162289
|
};
|
|
162214
162290
|
for (var _b = 0, _c = sourceFile.statements; _b < _c.length; _b++) {
|
|
162215
162291
|
var statement = _c[_b];
|
|
162216
|
-
|
|
162292
|
+
_loop_19(statement);
|
|
162217
162293
|
}
|
|
162218
162294
|
};
|
|
162219
162295
|
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
|
162220
162296
|
var sourceFile = _a[_i];
|
|
162221
|
-
|
|
162297
|
+
_loop_18(sourceFile);
|
|
162222
162298
|
}
|
|
162223
162299
|
}
|
|
162224
162300
|
function getNamespaceLikeImport(node) {
|
|
@@ -163582,7 +163658,7 @@ var ts;
|
|
|
163582
163658
|
var templateSpans = [];
|
|
163583
163659
|
var templateHead = ts.factory.createTemplateHead(headText, rawHeadText);
|
|
163584
163660
|
copyCommentFromStringLiterals(headIndexes, templateHead);
|
|
163585
|
-
var
|
|
163661
|
+
var _loop_20 = function (i) {
|
|
163586
163662
|
var currentNode = getExpressionFromParenthesesOrExpression(nodes[i]);
|
|
163587
163663
|
copyOperatorComments(i, currentNode);
|
|
163588
163664
|
var _c = concatConsecutiveString(i + 1, nodes), newIndex = _c[0], subsequentText = _c[1], rawSubsequentText = _c[2], stringIndexes = _c[3];
|
|
@@ -163611,7 +163687,7 @@ var ts;
|
|
|
163611
163687
|
};
|
|
163612
163688
|
var out_i_1;
|
|
163613
163689
|
for (var i = begin; i < nodes.length; i++) {
|
|
163614
|
-
|
|
163690
|
+
_loop_20(i);
|
|
163615
163691
|
i = out_i_1;
|
|
163616
163692
|
}
|
|
163617
163693
|
return ts.factory.createTemplateExpression(templateHead, templateSpans);
|
|
@@ -164447,7 +164523,7 @@ var ts;
|
|
|
164447
164523
|
var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
|
|
164448
164524
|
if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
164449
164525
|
var seenSymbols_1 = new ts.Set();
|
|
164450
|
-
var
|
|
164526
|
+
var _loop_21 = function (declaration) {
|
|
164451
164527
|
var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
164452
164528
|
var _a;
|
|
164453
164529
|
if (!seenSymbols_1.has(symbol)) {
|
|
@@ -164464,7 +164540,7 @@ var ts;
|
|
|
164464
164540
|
};
|
|
164465
164541
|
for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
|
|
164466
164542
|
var declaration = declarations_6[_i];
|
|
164467
|
-
|
|
164543
|
+
_loop_21(declaration);
|
|
164468
164544
|
}
|
|
164469
164545
|
}
|
|
164470
164546
|
return tags;
|
|
@@ -164475,7 +164551,7 @@ var ts;
|
|
|
164475
164551
|
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
|
|
164476
164552
|
if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
164477
164553
|
var seenSymbols_2 = new ts.Set();
|
|
164478
|
-
var
|
|
164554
|
+
var _loop_22 = function (declaration) {
|
|
164479
164555
|
var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
164480
164556
|
if (!seenSymbols_2.has(symbol)) {
|
|
164481
164557
|
seenSymbols_2.add(symbol);
|
|
@@ -164491,7 +164567,7 @@ var ts;
|
|
|
164491
164567
|
};
|
|
164492
164568
|
for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
|
|
164493
164569
|
var declaration = declarations_7[_i];
|
|
164494
|
-
|
|
164570
|
+
_loop_22(declaration);
|
|
164495
164571
|
}
|
|
164496
164572
|
}
|
|
164497
164573
|
return doc;
|
|
@@ -164748,70 +164824,6 @@ var ts;
|
|
|
164748
164824
|
return ts.codefix.getSupportedErrorCodes();
|
|
164749
164825
|
}
|
|
164750
164826
|
ts.getSupportedCodeFixes = getSupportedCodeFixes;
|
|
164751
|
-
// Cache host information about script Should be refreshed
|
|
164752
|
-
// at each language service public entry point, since we don't know when
|
|
164753
|
-
// the set of scripts handled by the host changes.
|
|
164754
|
-
var HostCache = /** @class */ (function () {
|
|
164755
|
-
function HostCache(host, getCanonicalFileName) {
|
|
164756
|
-
this.host = host;
|
|
164757
|
-
// script id => script index
|
|
164758
|
-
this.currentDirectory = host.getCurrentDirectory();
|
|
164759
|
-
this.fileNameToEntry = new ts.Map();
|
|
164760
|
-
// Initialize the list with the root file names
|
|
164761
|
-
var rootFileNames = host.getScriptFileNames();
|
|
164762
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "initializeHostCache", { count: rootFileNames.length });
|
|
164763
|
-
for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {
|
|
164764
|
-
var fileName = rootFileNames_1[_i];
|
|
164765
|
-
this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));
|
|
164766
|
-
}
|
|
164767
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
164768
|
-
}
|
|
164769
|
-
HostCache.prototype.createEntry = function (fileName, path) {
|
|
164770
|
-
var entry;
|
|
164771
|
-
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
|
164772
|
-
if (scriptSnapshot) {
|
|
164773
|
-
entry = {
|
|
164774
|
-
hostFileName: fileName,
|
|
164775
|
-
version: this.host.getScriptVersion(fileName),
|
|
164776
|
-
scriptSnapshot: scriptSnapshot,
|
|
164777
|
-
scriptKind: ts.getScriptKind(fileName, this.host)
|
|
164778
|
-
};
|
|
164779
|
-
}
|
|
164780
|
-
else {
|
|
164781
|
-
entry = fileName;
|
|
164782
|
-
}
|
|
164783
|
-
this.fileNameToEntry.set(path, entry);
|
|
164784
|
-
return entry;
|
|
164785
|
-
};
|
|
164786
|
-
HostCache.prototype.getEntryByPath = function (path) {
|
|
164787
|
-
return this.fileNameToEntry.get(path);
|
|
164788
|
-
};
|
|
164789
|
-
HostCache.prototype.getHostFileInformation = function (path) {
|
|
164790
|
-
var entry = this.fileNameToEntry.get(path);
|
|
164791
|
-
return !ts.isString(entry) ? entry : undefined;
|
|
164792
|
-
};
|
|
164793
|
-
HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) {
|
|
164794
|
-
var info = this.getEntryByPath(path) || this.createEntry(fileName, path);
|
|
164795
|
-
return ts.isString(info) ? undefined : info; // TODO: GH#18217
|
|
164796
|
-
};
|
|
164797
|
-
HostCache.prototype.getRootFileNames = function () {
|
|
164798
|
-
var names = [];
|
|
164799
|
-
this.fileNameToEntry.forEach(function (entry) {
|
|
164800
|
-
if (ts.isString(entry)) {
|
|
164801
|
-
names.push(entry);
|
|
164802
|
-
}
|
|
164803
|
-
else {
|
|
164804
|
-
names.push(entry.hostFileName);
|
|
164805
|
-
}
|
|
164806
|
-
});
|
|
164807
|
-
return names;
|
|
164808
|
-
};
|
|
164809
|
-
HostCache.prototype.getScriptSnapshot = function (path) {
|
|
164810
|
-
var file = this.getHostFileInformation(path);
|
|
164811
|
-
return (file && file.scriptSnapshot); // TODO: GH#18217
|
|
164812
|
-
};
|
|
164813
|
-
return HostCache;
|
|
164814
|
-
}());
|
|
164815
164827
|
var SyntaxTreeCache = /** @class */ (function () {
|
|
164816
164828
|
function SyntaxTreeCache(host) {
|
|
164817
164829
|
this.host = host;
|
|
@@ -165073,32 +165085,13 @@ var ts;
|
|
|
165073
165085
|
program = undefined; // TODO: GH#18217
|
|
165074
165086
|
lastTypesRootVersion = typeRootsVersion;
|
|
165075
165087
|
}
|
|
165088
|
+
var rootFileNames = host.getScriptFileNames();
|
|
165076
165089
|
// Get a fresh cache of the host information
|
|
165077
|
-
var hostCache = new HostCache(host, getCanonicalFileName);
|
|
165078
|
-
var rootFileNames = hostCache.getRootFileNames();
|
|
165079
165090
|
var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
|
|
165080
165091
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
165081
165092
|
var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames);
|
|
165082
165093
|
var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
165083
165094
|
var parsedCommandLines;
|
|
165084
|
-
var parseConfigHost = {
|
|
165085
|
-
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
|
165086
|
-
fileExists: fileExists,
|
|
165087
|
-
readFile: readFile,
|
|
165088
|
-
readDirectory: readDirectory,
|
|
165089
|
-
trace: ts.maybeBind(host, host.trace),
|
|
165090
|
-
getCurrentDirectory: function () { return currentDirectory; },
|
|
165091
|
-
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
165092
|
-
};
|
|
165093
|
-
// If the program is already up-to-date, we can reuse it
|
|
165094
|
-
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
165095
|
-
return;
|
|
165096
|
-
}
|
|
165097
|
-
// IMPORTANT - It is critical from this moment onward that we do not check
|
|
165098
|
-
// cancellation tokens. We are about to mutate source files from a previous program
|
|
165099
|
-
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
165100
|
-
// the program points to old source files that have been invalidated because of
|
|
165101
|
-
// incremental parsing.
|
|
165102
165095
|
// Now create a new compiler
|
|
165103
165096
|
var compilerHost = {
|
|
165104
165097
|
getSourceFile: getOrCreateSourceFile,
|
|
@@ -165110,8 +165103,8 @@ var ts;
|
|
|
165110
165103
|
getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
|
|
165111
165104
|
writeFile: ts.noop,
|
|
165112
165105
|
getCurrentDirectory: function () { return currentDirectory; },
|
|
165113
|
-
fileExists: fileExists,
|
|
165114
|
-
readFile: readFile,
|
|
165106
|
+
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
165107
|
+
readFile: function (fileName) { return host.readFile && host.readFile(fileName); },
|
|
165115
165108
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
|
|
165116
165109
|
realpath: ts.maybeBind(host, host.realpath),
|
|
165117
165110
|
directoryExists: function (directoryName) {
|
|
@@ -165120,19 +165113,56 @@ var ts;
|
|
|
165120
165113
|
getDirectories: function (path) {
|
|
165121
165114
|
return host.getDirectories ? host.getDirectories(path) : [];
|
|
165122
165115
|
},
|
|
165123
|
-
readDirectory:
|
|
165116
|
+
readDirectory: function (path, extensions, exclude, include, depth) {
|
|
165117
|
+
ts.Debug.checkDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'");
|
|
165118
|
+
return host.readDirectory(path, extensions, exclude, include, depth);
|
|
165119
|
+
},
|
|
165124
165120
|
onReleaseOldSourceFile: onReleaseOldSourceFile,
|
|
165125
165121
|
onReleaseParsedCommandLine: onReleaseParsedCommandLine,
|
|
165126
165122
|
hasInvalidatedResolution: hasInvalidatedResolution,
|
|
165127
165123
|
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
|
|
165128
|
-
trace:
|
|
165124
|
+
trace: ts.maybeBind(host, host.trace),
|
|
165129
165125
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
165130
165126
|
getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
|
|
165131
165127
|
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
165132
165128
|
useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
165133
165129
|
getParsedCommandLine: getParsedCommandLine,
|
|
165134
165130
|
};
|
|
165131
|
+
var originalGetSourceFile = compilerHost.getSourceFile;
|
|
165132
|
+
var getSourceFileWithCache = ts.changeCompilerHostLikeToUseCache(compilerHost, function (fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); }, function () {
|
|
165133
|
+
var args = [];
|
|
165134
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
165135
|
+
args[_i] = arguments[_i];
|
|
165136
|
+
}
|
|
165137
|
+
return originalGetSourceFile.call.apply(originalGetSourceFile, __spreadArray([compilerHost], args, false));
|
|
165138
|
+
}).getSourceFileWithCache;
|
|
165139
|
+
compilerHost.getSourceFile = getSourceFileWithCache;
|
|
165135
165140
|
(_c = host.setCompilerHost) === null || _c === void 0 ? void 0 : _c.call(host, compilerHost);
|
|
165141
|
+
var parseConfigHost = {
|
|
165142
|
+
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
|
165143
|
+
fileExists: function (fileName) { return compilerHost.fileExists(fileName); },
|
|
165144
|
+
readFile: function (fileName) { return compilerHost.readFile(fileName); },
|
|
165145
|
+
readDirectory: function () {
|
|
165146
|
+
var _a;
|
|
165147
|
+
var args = [];
|
|
165148
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
165149
|
+
args[_i] = arguments[_i];
|
|
165150
|
+
}
|
|
165151
|
+
return (_a = compilerHost).readDirectory.apply(_a, args);
|
|
165152
|
+
},
|
|
165153
|
+
trace: compilerHost.trace,
|
|
165154
|
+
getCurrentDirectory: compilerHost.getCurrentDirectory,
|
|
165155
|
+
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
165156
|
+
};
|
|
165157
|
+
// If the program is already up-to-date, we can reuse it
|
|
165158
|
+
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
165159
|
+
return;
|
|
165160
|
+
}
|
|
165161
|
+
// IMPORTANT - It is critical from this moment onward that we do not check
|
|
165162
|
+
// cancellation tokens. We are about to mutate source files from a previous program
|
|
165163
|
+
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
165164
|
+
// the program points to old source files that have been invalidated because of
|
|
165165
|
+
// incremental parsing.
|
|
165136
165166
|
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
165137
165167
|
var options = {
|
|
165138
165168
|
rootNames: rootFileNames,
|
|
@@ -165142,9 +165172,9 @@ var ts;
|
|
|
165142
165172
|
projectReferences: projectReferences
|
|
165143
165173
|
};
|
|
165144
165174
|
program = ts.createProgram(options);
|
|
165145
|
-
//
|
|
165146
|
-
//
|
|
165147
|
-
|
|
165175
|
+
// 'getOrCreateSourceFile' depends on caching but should be used past this point.
|
|
165176
|
+
// After this point, the cache needs to be cleared to allow all collected snapshots to be released
|
|
165177
|
+
compilerHost = undefined;
|
|
165148
165178
|
parsedCommandLines = undefined;
|
|
165149
165179
|
// We reset this cache on structure invalidation so we don't hold on to outdated files for long; however we can't use the `compilerHost` above,
|
|
165150
165180
|
// Because it only functions until `hostCache` is cleared, while we'll potentially need the functionality to lazily read sourcemap files during
|
|
@@ -165184,26 +165214,6 @@ var ts;
|
|
|
165184
165214
|
onReleaseOldSourceFile(oldResolvedRef.sourceFile, oldOptions);
|
|
165185
165215
|
}
|
|
165186
165216
|
}
|
|
165187
|
-
function fileExists(fileName) {
|
|
165188
|
-
var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
165189
|
-
var entry = hostCache && hostCache.getEntryByPath(path);
|
|
165190
|
-
return entry ?
|
|
165191
|
-
!ts.isString(entry) :
|
|
165192
|
-
(!!host.fileExists && host.fileExists(fileName));
|
|
165193
|
-
}
|
|
165194
|
-
function readFile(fileName) {
|
|
165195
|
-
// stub missing host functionality
|
|
165196
|
-
var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
165197
|
-
var entry = hostCache && hostCache.getEntryByPath(path);
|
|
165198
|
-
if (entry) {
|
|
165199
|
-
return ts.isString(entry) ? undefined : ts.getSnapshotText(entry.scriptSnapshot);
|
|
165200
|
-
}
|
|
165201
|
-
return host.readFile && host.readFile(fileName);
|
|
165202
|
-
}
|
|
165203
|
-
function readDirectory(path, extensions, exclude, include, depth) {
|
|
165204
|
-
ts.Debug.checkDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'");
|
|
165205
|
-
return host.readDirectory(path, extensions, exclude, include, depth);
|
|
165206
|
-
}
|
|
165207
165217
|
// Release any files we have acquired in the old program but are
|
|
165208
165218
|
// not part of the new program.
|
|
165209
165219
|
function onReleaseOldSourceFile(oldSourceFile, oldOptions) {
|
|
@@ -165214,14 +165224,16 @@ var ts;
|
|
|
165214
165224
|
return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), languageVersion, onError, shouldCreateNewSourceFile);
|
|
165215
165225
|
}
|
|
165216
165226
|
function getOrCreateSourceFileByPath(fileName, path, _languageVersion, _onError, shouldCreateNewSourceFile) {
|
|
165217
|
-
ts.Debug.assert(
|
|
165227
|
+
ts.Debug.assert(compilerHost, "getOrCreateSourceFileByPath called after typical CompilerHost lifetime, check the callstack something with a reference to an old host.");
|
|
165218
165228
|
// The program is asking for this file, check first if the host can locate it.
|
|
165219
165229
|
// If the host can not locate the file, then it does not exist. return undefined
|
|
165220
165230
|
// to the program to allow reporting of errors for missing files.
|
|
165221
|
-
var
|
|
165222
|
-
if (!
|
|
165231
|
+
var scriptSnapshot = host.getScriptSnapshot(fileName);
|
|
165232
|
+
if (!scriptSnapshot) {
|
|
165223
165233
|
return undefined;
|
|
165224
165234
|
}
|
|
165235
|
+
var scriptKind = ts.getScriptKind(fileName, host);
|
|
165236
|
+
var scriptVersion = host.getScriptVersion(fileName);
|
|
165225
165237
|
// Check if the language version has changed since we last created a program; if they are the same,
|
|
165226
165238
|
// it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile
|
|
165227
165239
|
// can not be reused. we have to dump all syntax trees and create new ones.
|
|
@@ -165253,8 +165265,8 @@ var ts;
|
|
|
165253
165265
|
// We do not support the scenario where a host can modify a registered
|
|
165254
165266
|
// file's script kind, i.e. in one project some file is treated as ".ts"
|
|
165255
165267
|
// and in another as ".js"
|
|
165256
|
-
if (
|
|
165257
|
-
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey,
|
|
165268
|
+
if (scriptKind === oldSourceFile.scriptKind) {
|
|
165269
|
+
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind);
|
|
165258
165270
|
}
|
|
165259
165271
|
else {
|
|
165260
165272
|
// Release old source file and fall through to aquire new file with new script kind
|
|
@@ -165264,7 +165276,7 @@ var ts;
|
|
|
165264
165276
|
// We didn't already have the file. Fall through and acquire it from the registry.
|
|
165265
165277
|
}
|
|
165266
165278
|
// Could not find this file in the old program, create a new SourceFile for it.
|
|
165267
|
-
return documentRegistry.acquireDocumentWithKey(fileName, path, host, documentRegistryBucketKey,
|
|
165279
|
+
return documentRegistry.acquireDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind);
|
|
165268
165280
|
}
|
|
165269
165281
|
}
|
|
165270
165282
|
// TODO: GH#18217 frequently asserted as defined
|
|
@@ -165280,6 +165292,61 @@ var ts;
|
|
|
165280
165292
|
var _a;
|
|
165281
165293
|
return (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
165282
165294
|
}
|
|
165295
|
+
function updateIsDefinitionOfReferencedSymbols(referencedSymbols, knownSymbolSpans) {
|
|
165296
|
+
var checker = program.getTypeChecker();
|
|
165297
|
+
var symbol = getSymbolForProgram();
|
|
165298
|
+
if (!symbol)
|
|
165299
|
+
return false;
|
|
165300
|
+
for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) {
|
|
165301
|
+
var referencedSymbol = referencedSymbols_1[_i];
|
|
165302
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
165303
|
+
var ref = _b[_a];
|
|
165304
|
+
var refNode = getNodeForSpan(ref);
|
|
165305
|
+
ts.Debug.assertIsDefined(refNode);
|
|
165306
|
+
if (knownSymbolSpans.has(ref) || ts.FindAllReferences.isDeclarationOfSymbol(refNode, symbol)) {
|
|
165307
|
+
knownSymbolSpans.add(ref);
|
|
165308
|
+
ref.isDefinition = true;
|
|
165309
|
+
var mappedSpan = ts.getMappedDocumentSpan(ref, sourceMapper, ts.maybeBind(host, host.fileExists));
|
|
165310
|
+
if (mappedSpan) {
|
|
165311
|
+
knownSymbolSpans.add(mappedSpan);
|
|
165312
|
+
}
|
|
165313
|
+
}
|
|
165314
|
+
else {
|
|
165315
|
+
ref.isDefinition = false;
|
|
165316
|
+
}
|
|
165317
|
+
}
|
|
165318
|
+
}
|
|
165319
|
+
return true;
|
|
165320
|
+
function getSymbolForProgram() {
|
|
165321
|
+
for (var _i = 0, referencedSymbols_2 = referencedSymbols; _i < referencedSymbols_2.length; _i++) {
|
|
165322
|
+
var referencedSymbol = referencedSymbols_2[_i];
|
|
165323
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
165324
|
+
var ref = _b[_a];
|
|
165325
|
+
if (knownSymbolSpans.has(ref)) {
|
|
165326
|
+
var refNode = getNodeForSpan(ref);
|
|
165327
|
+
ts.Debug.assertIsDefined(refNode);
|
|
165328
|
+
return checker.getSymbolAtLocation(refNode);
|
|
165329
|
+
}
|
|
165330
|
+
var mappedSpan = ts.getMappedDocumentSpan(ref, sourceMapper, ts.maybeBind(host, host.fileExists));
|
|
165331
|
+
if (mappedSpan && knownSymbolSpans.has(mappedSpan)) {
|
|
165332
|
+
var refNode = getNodeForSpan(mappedSpan);
|
|
165333
|
+
if (refNode) {
|
|
165334
|
+
return checker.getSymbolAtLocation(refNode);
|
|
165335
|
+
}
|
|
165336
|
+
}
|
|
165337
|
+
}
|
|
165338
|
+
}
|
|
165339
|
+
return undefined;
|
|
165340
|
+
}
|
|
165341
|
+
function getNodeForSpan(docSpan) {
|
|
165342
|
+
var sourceFile = program.getSourceFile(docSpan.fileName);
|
|
165343
|
+
if (!sourceFile)
|
|
165344
|
+
return undefined;
|
|
165345
|
+
var rawNode = ts.getTouchingPropertyName(sourceFile, docSpan.textSpan.start);
|
|
165346
|
+
var adjustedNode = ts.FindAllReferences.Core.getAdjustedNode(rawNode, { use: 1 /* References */ });
|
|
165347
|
+
return adjustedNode;
|
|
165348
|
+
}
|
|
165349
|
+
}
|
|
165283
165350
|
function cleanupSemanticCache() {
|
|
165284
165351
|
program = undefined; // TODO: GH#18217
|
|
165285
165352
|
}
|
|
@@ -166206,6 +166273,7 @@ var ts;
|
|
|
166206
166273
|
getNonBoundSourceFile: getNonBoundSourceFile,
|
|
166207
166274
|
getProgram: getProgram,
|
|
166208
166275
|
getAutoImportProvider: getAutoImportProvider,
|
|
166276
|
+
updateIsDefinitionOfReferencedSymbols: updateIsDefinitionOfReferencedSymbols,
|
|
166209
166277
|
getApplicableRefactors: getApplicableRefactors,
|
|
166210
166278
|
getEditsForRefactor: getEditsForRefactor,
|
|
166211
166279
|
toLineColumnOffset: toLineColumnOffset,
|
|
@@ -174929,66 +174997,142 @@ var ts;
|
|
|
174929
174997
|
return textSpan.start + 100003 * textSpan.length;
|
|
174930
174998
|
}, ts.documentSpansEqual);
|
|
174931
174999
|
}
|
|
174932
|
-
function
|
|
175000
|
+
function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, _a) {
|
|
174933
175001
|
var providePrefixAndSuffixTextForRename = _a.providePrefixAndSuffixTextForRename;
|
|
174934
|
-
var
|
|
175002
|
+
var perProjectResults = getPerProjectReferences(projects, defaultProject, initialLocation,
|
|
175003
|
+
/*isForRename*/ true, function (project, position) { return project.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments, providePrefixAndSuffixTextForRename); }, function (renameLocation, cb) { return cb(documentSpanLocation(renameLocation)); });
|
|
175004
|
+
// No filtering or dedup'ing is required if there's exactly one project
|
|
175005
|
+
if (ts.isArray(perProjectResults)) {
|
|
175006
|
+
return perProjectResults;
|
|
175007
|
+
}
|
|
175008
|
+
var results = [];
|
|
174935
175009
|
var seen = createDocumentSpanSet();
|
|
174936
|
-
|
|
174937
|
-
|
|
174938
|
-
|
|
174939
|
-
|
|
174940
|
-
|
|
174941
|
-
|
|
174942
|
-
|
|
174943
|
-
seen.add(output);
|
|
174944
|
-
outputs.push(output);
|
|
174945
|
-
}
|
|
175010
|
+
perProjectResults.forEach(function (projectResults, project) {
|
|
175011
|
+
for (var _i = 0, projectResults_1 = projectResults; _i < projectResults_1.length; _i++) {
|
|
175012
|
+
var result = projectResults_1[_i];
|
|
175013
|
+
// If there's a mapped location, it'll appear in the results for another project
|
|
175014
|
+
if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
|
|
175015
|
+
results.push(result);
|
|
175016
|
+
seen.add(result);
|
|
174946
175017
|
}
|
|
174947
175018
|
}
|
|
174948
175019
|
});
|
|
174949
|
-
return
|
|
175020
|
+
return results;
|
|
174950
175021
|
}
|
|
174951
175022
|
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
174952
|
-
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, isForRename);
|
|
175023
|
+
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, /*stopAtAlias*/ isForRename);
|
|
174953
175024
|
var info = infos && ts.firstOrUndefined(infos);
|
|
174954
175025
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
174955
175026
|
}
|
|
174956
|
-
function
|
|
174957
|
-
var
|
|
174958
|
-
|
|
174959
|
-
|
|
174960
|
-
|
|
174961
|
-
|
|
174962
|
-
|
|
174963
|
-
|
|
174964
|
-
var
|
|
174965
|
-
|
|
174966
|
-
|
|
174967
|
-
|
|
174968
|
-
|
|
174969
|
-
|
|
174970
|
-
|
|
174971
|
-
|
|
174972
|
-
|
|
174973
|
-
|
|
174974
|
-
|
|
174975
|
-
|
|
174976
|
-
|
|
174977
|
-
|
|
174978
|
-
|
|
174979
|
-
|
|
174980
|
-
|
|
174981
|
-
|
|
174982
|
-
|
|
175027
|
+
function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
|
|
175028
|
+
var perProjectResults = getPerProjectReferences(projects, defaultProject, initialLocation,
|
|
175029
|
+
/*isForRename*/ false, function (project, position) {
|
|
175030
|
+
logger.info("Finding references to " + position.fileName + " position " + position.pos + " in project " + project.getProjectName());
|
|
175031
|
+
return project.getLanguageService().findReferences(position.fileName, position.pos);
|
|
175032
|
+
}, function (referencedSymbol, cb) {
|
|
175033
|
+
cb(documentSpanLocation(referencedSymbol.definition));
|
|
175034
|
+
for (var _i = 0, _a = referencedSymbol.references; _i < _a.length; _i++) {
|
|
175035
|
+
var ref = _a[_i];
|
|
175036
|
+
cb(documentSpanLocation(ref));
|
|
175037
|
+
}
|
|
175038
|
+
});
|
|
175039
|
+
// No re-mapping or isDefinition updatses are required if there's exactly one project
|
|
175040
|
+
if (ts.isArray(perProjectResults)) {
|
|
175041
|
+
return perProjectResults;
|
|
175042
|
+
}
|
|
175043
|
+
// `isDefinition` is only (definitely) correct in `defaultProject` because we might
|
|
175044
|
+
// have started the other project searches from related symbols. Propagate the
|
|
175045
|
+
// correct results to all other projects.
|
|
175046
|
+
var defaultProjectResults = perProjectResults.get(defaultProject);
|
|
175047
|
+
if (defaultProjectResults[0].references[0].isDefinition === undefined) {
|
|
175048
|
+
// Clear all isDefinition properties
|
|
175049
|
+
perProjectResults.forEach(function (projectResults) {
|
|
175050
|
+
for (var _i = 0, projectResults_2 = projectResults; _i < projectResults_2.length; _i++) {
|
|
175051
|
+
var referencedSymbol = projectResults_2[_i];
|
|
175052
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
175053
|
+
var ref = _b[_a];
|
|
175054
|
+
delete ref.isDefinition;
|
|
174983
175055
|
}
|
|
174984
|
-
};
|
|
174985
|
-
for (var _i = 0, projectOutputs_2 = projectOutputs; _i < projectOutputs_2.length; _i++) {
|
|
174986
|
-
var referencedSymbol = projectOutputs_2[_i];
|
|
174987
|
-
_loop_9(referencedSymbol);
|
|
174988
175056
|
}
|
|
175057
|
+
});
|
|
175058
|
+
}
|
|
175059
|
+
else {
|
|
175060
|
+
// Correct isDefinition properties from projects other than defaultProject
|
|
175061
|
+
var knownSymbolSpans_1 = createDocumentSpanSet();
|
|
175062
|
+
for (var _i = 0, defaultProjectResults_1 = defaultProjectResults; _i < defaultProjectResults_1.length; _i++) {
|
|
175063
|
+
var referencedSymbol = defaultProjectResults_1[_i];
|
|
175064
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
175065
|
+
var ref = _b[_a];
|
|
175066
|
+
if (ref.isDefinition) {
|
|
175067
|
+
knownSymbolSpans_1.add(ref);
|
|
175068
|
+
// One is enough - updateIsDefinitionOfReferencedSymbols will fill out the set based on symbols
|
|
175069
|
+
break;
|
|
175070
|
+
}
|
|
175071
|
+
}
|
|
175072
|
+
}
|
|
175073
|
+
var updatedProjects_1 = new ts.Set();
|
|
175074
|
+
var _loop_9 = function () {
|
|
175075
|
+
var progress = false;
|
|
175076
|
+
perProjectResults.forEach(function (referencedSymbols, project) {
|
|
175077
|
+
if (updatedProjects_1.has(project))
|
|
175078
|
+
return;
|
|
175079
|
+
var updated = project.getLanguageService().updateIsDefinitionOfReferencedSymbols(referencedSymbols, knownSymbolSpans_1);
|
|
175080
|
+
if (updated) {
|
|
175081
|
+
updatedProjects_1.add(project);
|
|
175082
|
+
progress = true;
|
|
175083
|
+
}
|
|
175084
|
+
});
|
|
175085
|
+
if (!progress)
|
|
175086
|
+
return "break";
|
|
175087
|
+
};
|
|
175088
|
+
while (true) {
|
|
175089
|
+
var state_2 = _loop_9();
|
|
175090
|
+
if (state_2 === "break")
|
|
175091
|
+
break;
|
|
175092
|
+
}
|
|
175093
|
+
perProjectResults.forEach(function (referencedSymbols, project) {
|
|
175094
|
+
if (updatedProjects_1.has(project))
|
|
175095
|
+
return;
|
|
175096
|
+
for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) {
|
|
175097
|
+
var referencedSymbol = referencedSymbols_1[_i];
|
|
175098
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
175099
|
+
var ref = _b[_a];
|
|
175100
|
+
ref.isDefinition = false;
|
|
175101
|
+
}
|
|
175102
|
+
}
|
|
175103
|
+
});
|
|
175104
|
+
}
|
|
175105
|
+
// We need to de-duplicate and aggregate the results by choosing an authoritative version
|
|
175106
|
+
// of each definition and merging references from all the projects where they appear.
|
|
175107
|
+
var results = [];
|
|
175108
|
+
var seenRefs = createDocumentSpanSet(); // It doesn't make sense to have a reference in two definition lists, so we de-dup globally
|
|
175109
|
+
// TODO: We might end up with a more logical allocation of refs to defs if we pre-sorted the defs by descending ref-count.
|
|
175110
|
+
// Otherwise, it just ends up attached to the first corresponding def we happen to process. The others may or may not be
|
|
175111
|
+
// dropped later when we check for defs with ref-count 0.
|
|
175112
|
+
perProjectResults.forEach(function (projectResults, project) {
|
|
175113
|
+
var _loop_10 = function (referencedSymbol) {
|
|
175114
|
+
var mappedDefinitionFile = getMappedLocationForProject(documentSpanLocation(referencedSymbol.definition), project);
|
|
175115
|
+
var definition = mappedDefinitionFile === undefined ?
|
|
175116
|
+
referencedSymbol.definition : __assign(__assign({}, referencedSymbol.definition), { textSpan: ts.createTextSpan(mappedDefinitionFile.pos, referencedSymbol.definition.textSpan.length), fileName: mappedDefinitionFile.fileName, contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project) });
|
|
175117
|
+
var symbolToAddTo = ts.find(results, function (o) { return ts.documentSpansEqual(o.definition, definition); });
|
|
175118
|
+
if (!symbolToAddTo) {
|
|
175119
|
+
symbolToAddTo = { definition: definition, references: [] };
|
|
175120
|
+
results.push(symbolToAddTo);
|
|
175121
|
+
}
|
|
175122
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
175123
|
+
var ref = _b[_a];
|
|
175124
|
+
if (!seenRefs.has(ref) && !getMappedLocationForProject(documentSpanLocation(ref), project)) {
|
|
175125
|
+
seenRefs.add(ref);
|
|
175126
|
+
symbolToAddTo.references.push(ref);
|
|
175127
|
+
}
|
|
175128
|
+
}
|
|
175129
|
+
};
|
|
175130
|
+
for (var _i = 0, projectResults_3 = projectResults; _i < projectResults_3.length; _i++) {
|
|
175131
|
+
var referencedSymbol = projectResults_3[_i];
|
|
175132
|
+
_loop_10(referencedSymbol);
|
|
174989
175133
|
}
|
|
174990
175134
|
});
|
|
174991
|
-
return
|
|
175135
|
+
return results.filter(function (o) { return o.references.length !== 0; });
|
|
174992
175136
|
}
|
|
174993
175137
|
function forEachProjectInProjects(projects, path, cb) {
|
|
174994
175138
|
for (var _i = 0, _a = ts.isArray(projects) ? projects : projects.projects; _i < _a.length; _i++) {
|
|
@@ -175004,40 +175148,117 @@ var ts;
|
|
|
175004
175148
|
});
|
|
175005
175149
|
}
|
|
175006
175150
|
}
|
|
175007
|
-
|
|
175008
|
-
|
|
175009
|
-
|
|
175010
|
-
|
|
175011
|
-
|
|
175012
|
-
|
|
175013
|
-
|
|
175014
|
-
|
|
175151
|
+
/**
|
|
175152
|
+
* @param projects Projects initially known to contain {@link initialLocation}
|
|
175153
|
+
* @param defaultProject The default project containing {@link initialLocation}
|
|
175154
|
+
* @param initialLocation Where the search operation was triggered
|
|
175155
|
+
* @param getResultsForPosition This is where you plug in `findReferences`, `renameLocation`, etc
|
|
175156
|
+
* @param forPositionInResult Given an item returned by {@link getResultsForPosition} enumerate the positions referred to by that result
|
|
175157
|
+
* @returns In the common case where there's only one project, returns an array of results from {@link getResultsForPosition}.
|
|
175158
|
+
* If multiple projects were searched - even if they didn't return results - the result will be a map from project to per-project results.
|
|
175159
|
+
*/
|
|
175160
|
+
function getPerProjectReferences(projects, defaultProject, initialLocation, isForRename, getResultsForPosition, forPositionInResult) {
|
|
175161
|
+
// If `getResultsForPosition` returns results for a project, they go in here
|
|
175162
|
+
var resultsMap = new ts.Map();
|
|
175163
|
+
var queue = [];
|
|
175164
|
+
// In order to get accurate isDefinition values for `defaultProject`,
|
|
175165
|
+
// we need to ensure that it is searched from `initialLocation`.
|
|
175166
|
+
// The easiest way to do this is to search it first.
|
|
175167
|
+
queue.push({ project: defaultProject, location: initialLocation });
|
|
175168
|
+
// This will queue `defaultProject` a second time, but it will be dropped
|
|
175169
|
+
// as a dup when it is dequeued.
|
|
175170
|
+
forEachProjectInProjects(projects, initialLocation.fileName, function (project, path) {
|
|
175171
|
+
var location = { fileName: path, pos: initialLocation.pos };
|
|
175172
|
+
queue.push({ project: project, location: location });
|
|
175015
175173
|
});
|
|
175016
|
-
|
|
175017
|
-
|
|
175018
|
-
|
|
175019
|
-
|
|
175020
|
-
|
|
175021
|
-
|
|
175022
|
-
|
|
175023
|
-
|
|
175024
|
-
|
|
175025
|
-
|
|
175026
|
-
|
|
175174
|
+
var projectService = defaultProject.projectService;
|
|
175175
|
+
var cancellationToken = defaultProject.getCancellationToken();
|
|
175176
|
+
var defaultDefinition = getDefinitionLocation(defaultProject, initialLocation, isForRename);
|
|
175177
|
+
// Don't call these unless !!defaultDefinition
|
|
175178
|
+
var getGeneratedDefinition = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition.fileName) ?
|
|
175179
|
+
defaultDefinition :
|
|
175180
|
+
defaultProject.getLanguageService().getSourceMapper().tryGetGeneratedPosition(defaultDefinition); });
|
|
175181
|
+
var getSourceDefinition = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition.fileName) ?
|
|
175182
|
+
defaultDefinition :
|
|
175183
|
+
defaultProject.getLanguageService().getSourceMapper().tryGetSourcePosition(defaultDefinition); });
|
|
175184
|
+
// Track which projects we have already searched so that we don't repeat searches.
|
|
175185
|
+
// We store the project key, rather than the project, because that's what `loadAncestorProjectTree` wants.
|
|
175186
|
+
// (For that same reason, we don't use `resultsMap` for this check.)
|
|
175187
|
+
var searchedProjects = new ts.Set();
|
|
175188
|
+
onCancellation: while (queue.length) {
|
|
175189
|
+
while (queue.length) {
|
|
175190
|
+
if (cancellationToken.isCancellationRequested())
|
|
175191
|
+
break onCancellation;
|
|
175192
|
+
var _a = queue.shift(), project = _a.project, location = _a.location;
|
|
175193
|
+
if (isLocationProjectReferenceRedirect(project, location))
|
|
175194
|
+
continue;
|
|
175195
|
+
if (!ts.tryAddToSet(searchedProjects, getProjectKey(project)))
|
|
175196
|
+
continue;
|
|
175197
|
+
var projectResults = searchPosition(project, location);
|
|
175198
|
+
if (projectResults) {
|
|
175199
|
+
resultsMap.set(project, projectResults);
|
|
175200
|
+
}
|
|
175201
|
+
}
|
|
175202
|
+
// At this point, we know about all projects passed in as arguments and any projects in which
|
|
175203
|
+
// `getResultsForPosition` has returned results. We expand that set to include any projects
|
|
175204
|
+
// downstream from any of these and then queue new initial-position searches for any new project
|
|
175205
|
+
// containing `initialLocation`.
|
|
175206
|
+
if (defaultDefinition) {
|
|
175207
|
+
// This seems to mean "load all projects downstream from any member of `seenProjects`".
|
|
175208
|
+
projectService.loadAncestorProjectTree(searchedProjects);
|
|
175027
175209
|
projectService.forEachEnabledProject(function (project) {
|
|
175028
|
-
if (
|
|
175029
|
-
return;
|
|
175030
|
-
|
|
175031
|
-
|
|
175032
|
-
|
|
175210
|
+
if (cancellationToken.isCancellationRequested())
|
|
175211
|
+
return; // There's no mechanism for skipping the remaining projects
|
|
175212
|
+
if (searchedProjects.has(getProjectKey(project)))
|
|
175213
|
+
return; // Can loop forever without this (enqueue here, dequeue above, repeat)
|
|
175214
|
+
var location = mapDefinitionInProject(defaultDefinition, project, getGeneratedDefinition, getSourceDefinition);
|
|
175215
|
+
if (location) {
|
|
175216
|
+
queue.push({ project: project, location: location });
|
|
175033
175217
|
}
|
|
175034
175218
|
});
|
|
175035
175219
|
}
|
|
175036
175220
|
}
|
|
175037
|
-
|
|
175038
|
-
|
|
175039
|
-
|
|
175040
|
-
|
|
175221
|
+
// In the common case where there's only one project, return a simpler result to make
|
|
175222
|
+
// it easier for the caller to skip post-processing.
|
|
175223
|
+
if (searchedProjects.size === 1) {
|
|
175224
|
+
var it = resultsMap.values().next();
|
|
175225
|
+
ts.Debug.assert(!it.done);
|
|
175226
|
+
return it.value;
|
|
175227
|
+
}
|
|
175228
|
+
return resultsMap;
|
|
175229
|
+
// May enqueue to otherPositionQueue
|
|
175230
|
+
function searchPosition(project, location) {
|
|
175231
|
+
var projectResults = getResultsForPosition(project, location);
|
|
175232
|
+
if (!projectResults)
|
|
175233
|
+
return undefined;
|
|
175234
|
+
for (var _i = 0, projectResults_4 = projectResults; _i < projectResults_4.length; _i++) {
|
|
175235
|
+
var result = projectResults_4[_i];
|
|
175236
|
+
forPositionInResult(result, function (position) {
|
|
175237
|
+
// This may trigger a search for a tsconfig, but there are several layers of caching that make it inexpensive
|
|
175238
|
+
var originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(project, position);
|
|
175239
|
+
if (!originalLocation)
|
|
175240
|
+
return;
|
|
175241
|
+
var originalScriptInfo = projectService.getScriptInfo(originalLocation.fileName);
|
|
175242
|
+
for (var _i = 0, _a = originalScriptInfo.containingProjects; _i < _a.length; _i++) {
|
|
175243
|
+
var project_1 = _a[_i];
|
|
175244
|
+
if (!project_1.isOrphan()) {
|
|
175245
|
+
queue.push({ project: project_1, location: originalLocation });
|
|
175246
|
+
}
|
|
175247
|
+
}
|
|
175248
|
+
var symlinkedProjectsMap = projectService.getSymlinkedProjects(originalScriptInfo);
|
|
175249
|
+
if (symlinkedProjectsMap) {
|
|
175250
|
+
symlinkedProjectsMap.forEach(function (symlinkedProjects, symlinkedPath) {
|
|
175251
|
+
for (var _i = 0, symlinkedProjects_2 = symlinkedProjects; _i < symlinkedProjects_2.length; _i++) {
|
|
175252
|
+
var symlinkedProject = symlinkedProjects_2[_i];
|
|
175253
|
+
if (!symlinkedProject.isOrphan()) {
|
|
175254
|
+
queue.push({ project: symlinkedProject, location: { fileName: symlinkedPath, pos: originalLocation.pos } });
|
|
175255
|
+
}
|
|
175256
|
+
}
|
|
175257
|
+
});
|
|
175258
|
+
}
|
|
175259
|
+
});
|
|
175260
|
+
}
|
|
175261
|
+
return projectResults;
|
|
175041
175262
|
}
|
|
175042
175263
|
}
|
|
175043
175264
|
function mapDefinitionInProject(definition, project, getGeneratedDefinition, getSourceDefinition) {
|
|
@@ -175068,43 +175289,6 @@ var ts;
|
|
|
175068
175289
|
sourceFile.resolvedPath !== sourceFile.path &&
|
|
175069
175290
|
sourceFile.resolvedPath !== project.toPath(location.fileName);
|
|
175070
175291
|
}
|
|
175071
|
-
function callbackProjectAndLocation(project, location, projectService, toDo, seenProjects, cb) {
|
|
175072
|
-
if (project.getCancellationToken().isCancellationRequested())
|
|
175073
|
-
return undefined; // Skip rest of toDo if cancelled
|
|
175074
|
-
// If this is not the file we were actually looking, return rest of the toDo
|
|
175075
|
-
if (isLocationProjectReferenceRedirect(project, location))
|
|
175076
|
-
return toDo;
|
|
175077
|
-
cb(project, location, function (innerProject, location) {
|
|
175078
|
-
addToSeen(seenProjects, project);
|
|
175079
|
-
var originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(innerProject, location);
|
|
175080
|
-
if (!originalLocation)
|
|
175081
|
-
return undefined;
|
|
175082
|
-
var originalScriptInfo = projectService.getScriptInfo(originalLocation.fileName);
|
|
175083
|
-
toDo = toDo || [];
|
|
175084
|
-
for (var _i = 0, _a = originalScriptInfo.containingProjects; _i < _a.length; _i++) {
|
|
175085
|
-
var project_1 = _a[_i];
|
|
175086
|
-
addToTodo(project_1, originalLocation, toDo, seenProjects);
|
|
175087
|
-
}
|
|
175088
|
-
var symlinkedProjectsMap = projectService.getSymlinkedProjects(originalScriptInfo);
|
|
175089
|
-
if (symlinkedProjectsMap) {
|
|
175090
|
-
symlinkedProjectsMap.forEach(function (symlinkedProjects, symlinkedPath) {
|
|
175091
|
-
for (var _i = 0, symlinkedProjects_2 = symlinkedProjects; _i < symlinkedProjects_2.length; _i++) {
|
|
175092
|
-
var symlinkedProject = symlinkedProjects_2[_i];
|
|
175093
|
-
addToTodo(symlinkedProject, { fileName: symlinkedPath, pos: originalLocation.pos }, toDo, seenProjects);
|
|
175094
|
-
}
|
|
175095
|
-
});
|
|
175096
|
-
}
|
|
175097
|
-
return originalLocation === location ? undefined : originalLocation;
|
|
175098
|
-
});
|
|
175099
|
-
return toDo;
|
|
175100
|
-
}
|
|
175101
|
-
function addToTodo(project, location, toDo, seenProjects) {
|
|
175102
|
-
if (!project.isOrphan() && addToSeen(seenProjects, project))
|
|
175103
|
-
toDo.push({ project: project, location: location });
|
|
175104
|
-
}
|
|
175105
|
-
function addToSeen(seenProjects, project) {
|
|
175106
|
-
return ts.tryAddToSet(seenProjects, getProjectKey(project));
|
|
175107
|
-
}
|
|
175108
175292
|
function getProjectKey(project) {
|
|
175109
175293
|
return server.isConfiguredProject(project) ? project.canonicalConfigFilePath : project.getProjectName();
|
|
175110
175294
|
}
|
|
@@ -175112,32 +175296,14 @@ var ts;
|
|
|
175112
175296
|
var fileName = _a.fileName, textSpan = _a.textSpan;
|
|
175113
175297
|
return { fileName: fileName, pos: textSpan.start };
|
|
175114
175298
|
}
|
|
175115
|
-
function
|
|
175116
|
-
|
|
175117
|
-
return mapsTo && project.projectService.fileExists(server.toNormalizedPath(mapsTo.fileName)) ? mapsTo : undefined;
|
|
175299
|
+
function getMappedLocationForProject(location, project) {
|
|
175300
|
+
return ts.getMappedLocation(location, project.getSourceMapper(), function (p) { return project.projectService.fileExists(p); });
|
|
175118
175301
|
}
|
|
175119
|
-
function
|
|
175120
|
-
|
|
175121
|
-
if (!newPosition)
|
|
175122
|
-
return undefined;
|
|
175123
|
-
return {
|
|
175124
|
-
fileName: newPosition.fileName,
|
|
175125
|
-
textSpan: {
|
|
175126
|
-
start: newPosition.pos,
|
|
175127
|
-
length: documentSpan.textSpan.length
|
|
175128
|
-
},
|
|
175129
|
-
originalFileName: documentSpan.fileName,
|
|
175130
|
-
originalTextSpan: documentSpan.textSpan,
|
|
175131
|
-
contextSpan: getMappedContextSpan(documentSpan, project),
|
|
175132
|
-
originalContextSpan: documentSpan.contextSpan
|
|
175133
|
-
};
|
|
175302
|
+
function getMappedDocumentSpanForProject(documentSpan, project) {
|
|
175303
|
+
return ts.getMappedDocumentSpan(documentSpan, project.getSourceMapper(), function (p) { return project.projectService.fileExists(p); });
|
|
175134
175304
|
}
|
|
175135
|
-
function
|
|
175136
|
-
|
|
175137
|
-
var contextSpanEnd = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start + documentSpan.contextSpan.length }, project);
|
|
175138
|
-
return contextSpanStart && contextSpanEnd ?
|
|
175139
|
-
{ start: contextSpanStart.pos, length: contextSpanEnd.pos - contextSpanStart.pos } :
|
|
175140
|
-
undefined;
|
|
175305
|
+
function getMappedContextSpanForProject(documentSpan, project) {
|
|
175306
|
+
return ts.getMappedContextSpan(documentSpan, project.getSourceMapper(), function (p) { return project.projectService.fileExists(p); });
|
|
175141
175307
|
}
|
|
175142
175308
|
var invalidPartialSemanticModeCommands = [
|
|
175143
175309
|
server.CommandNames.OpenExternalProject,
|
|
@@ -176030,7 +176196,7 @@ var ts;
|
|
|
176030
176196
|
};
|
|
176031
176197
|
Session.prototype.mapDefinitionInfoLocations = function (definitions, project) {
|
|
176032
176198
|
return definitions.map(function (info) {
|
|
176033
|
-
var newDocumentSpan =
|
|
176199
|
+
var newDocumentSpan = getMappedDocumentSpanForProject(info, project);
|
|
176034
176200
|
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name, failedAliasResolution: info.failedAliasResolution }), info.unverified && { unverified: info.unverified });
|
|
176035
176201
|
});
|
|
176036
176202
|
};
|
|
@@ -176275,7 +176441,7 @@ var ts;
|
|
|
176275
176441
|
};
|
|
176276
176442
|
Session.prototype.mapImplementationLocations = function (implementations, project) {
|
|
176277
176443
|
return implementations.map(function (info) {
|
|
176278
|
-
var newDocumentSpan =
|
|
176444
|
+
var newDocumentSpan = getMappedDocumentSpanForProject(info, project);
|
|
176279
176445
|
return !newDocumentSpan ? info : __assign(__assign({}, newDocumentSpan), { kind: info.kind, displayParts: info.displayParts });
|
|
176280
176446
|
});
|
|
176281
176447
|
};
|
|
@@ -176432,7 +176598,7 @@ var ts;
|
|
|
176432
176598
|
var renameInfo = this.mapRenameInfo(defaultProject.getLanguageService().getRenameInfo(file, position, { allowRenameOfImportPath: this.getPreferences(file).allowRenameOfImportPath }), ts.Debug.checkDefined(this.projectService.getScriptInfo(file)));
|
|
176433
176599
|
if (!renameInfo.canRename)
|
|
176434
176600
|
return simplifiedResult ? { info: renameInfo, locs: [] } : [];
|
|
176435
|
-
var locations =
|
|
176601
|
+
var locations = getRenameLocationsWorker(projects, defaultProject, { fileName: args.file, pos: position }, !!args.findInStrings, !!args.findInComments, this.getPreferences(file));
|
|
176436
176602
|
if (!simplifiedResult)
|
|
176437
176603
|
return locations;
|
|
176438
176604
|
return { info: renameInfo, locs: this.toSpanGroups(locations) };
|
|
@@ -176464,7 +176630,7 @@ var ts;
|
|
|
176464
176630
|
var file = server.toNormalizedPath(args.file);
|
|
176465
176631
|
var projects = this.getProjects(args);
|
|
176466
176632
|
var position = this.getPositionInFile(args, file);
|
|
176467
|
-
var references =
|
|
176633
|
+
var references = getReferencesWorker(projects, this.getDefaultProject(args), { fileName: args.file, pos: position }, this.logger);
|
|
176468
176634
|
if (!simplifiedResult)
|
|
176469
176635
|
return references;
|
|
176470
176636
|
var defaultProject = this.getDefaultProject(args);
|
|
@@ -176490,8 +176656,8 @@ var ts;
|
|
|
176490
176656
|
return;
|
|
176491
176657
|
var projectOutputs = project.getLanguageService().getFileReferences(fileName);
|
|
176492
176658
|
if (projectOutputs) {
|
|
176493
|
-
for (var _i = 0,
|
|
176494
|
-
var referenceEntry =
|
|
176659
|
+
for (var _i = 0, projectOutputs_1 = projectOutputs; _i < projectOutputs_1.length; _i++) {
|
|
176660
|
+
var referenceEntry = projectOutputs_1[_i];
|
|
176495
176661
|
if (!seen.has(referenceEntry)) {
|
|
176496
176662
|
references.push(referenceEntry);
|
|
176497
176663
|
seen.add(referenceEntry);
|
|
@@ -176956,7 +177122,8 @@ var ts;
|
|
|
176956
177122
|
// `name` is a very cheap hash function, but we could incorporate other properties to reduce collisions.
|
|
176957
177123
|
var seenItems = new ts.Map(); // name to items with that name
|
|
176958
177124
|
if (!args.file && !projectFileName) {
|
|
176959
|
-
// VS Code's `Go to symbol in workspaces` sends request like this
|
|
177125
|
+
// VS Code's `Go to symbol in workspaces` sends request like this by default.
|
|
177126
|
+
// There's a setting to have it send a file name (reverting to older behavior).
|
|
176960
177127
|
// TODO (https://github.com/microsoft/TypeScript/issues/47839)
|
|
176961
177128
|
// This appears to have been intended to search all projects but, in practice, it seems to only search
|
|
176962
177129
|
// those that are downstream from already-loaded projects.
|
|
@@ -176977,7 +177144,7 @@ var ts;
|
|
|
176977
177144
|
// Mutates `outputs`
|
|
176978
177145
|
function addItemsForProject(project) {
|
|
176979
177146
|
var projectItems = project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, /*filename*/ undefined, /*excludeDts*/ project.isNonTsProject());
|
|
176980
|
-
var unseenItems = ts.filter(projectItems, function (item) { return tryAddSeenItem(item) && !
|
|
177147
|
+
var unseenItems = ts.filter(projectItems, function (item) { return tryAddSeenItem(item) && !getMappedLocationForProject(documentSpanLocation(item), project); });
|
|
176981
177148
|
if (unseenItems.length) {
|
|
176982
177149
|
outputs.push({ project: project, navigateToItems: unseenItems });
|
|
176983
177150
|
}
|