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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220521";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -2238,6 +2238,7 @@ var ts;
|
|
|
2238
2238
|
startsWith(candidate, prefix) &&
|
|
2239
2239
|
endsWith(candidate, suffix);
|
|
2240
2240
|
}
|
|
2241
|
+
ts.isPatternMatch = isPatternMatch;
|
|
2241
2242
|
function and(f, g) {
|
|
2242
2243
|
return function (arg) { return f(arg) && g(arg); };
|
|
2243
2244
|
}
|
|
@@ -82616,7 +82617,7 @@ var ts;
|
|
|
82616
82617
|
var childSymbol = getSymbolAtLocation(childNode);
|
|
82617
82618
|
if (childSymbol && childSymbol === testedSymbol) {
|
|
82618
82619
|
// If the test was a simple identifier, the above check is sufficient
|
|
82619
|
-
if (ts.isIdentifier(expr)) {
|
|
82620
|
+
if (ts.isIdentifier(expr) || ts.isIdentifier(testedNode) && ts.isBinaryExpression(testedNode.parent)) {
|
|
82620
82621
|
return true;
|
|
82621
82622
|
}
|
|
82622
82623
|
// Otherwise we need to ensure the symbol is called on the same target
|
|
@@ -115830,7 +115831,7 @@ var ts;
|
|
|
115830
115831
|
};
|
|
115831
115832
|
}
|
|
115832
115833
|
// directoryExists
|
|
115833
|
-
if (originalDirectoryExists
|
|
115834
|
+
if (originalDirectoryExists) {
|
|
115834
115835
|
host.directoryExists = function (directory) {
|
|
115835
115836
|
var key = toPath(directory);
|
|
115836
115837
|
var value = directoryExistsCache.get(key);
|
|
@@ -115840,11 +115841,13 @@ var ts;
|
|
|
115840
115841
|
directoryExistsCache.set(key, !!newValue);
|
|
115841
115842
|
return newValue;
|
|
115842
115843
|
};
|
|
115843
|
-
|
|
115844
|
-
|
|
115845
|
-
|
|
115846
|
-
|
|
115847
|
-
|
|
115844
|
+
if (originalCreateDirectory) {
|
|
115845
|
+
host.createDirectory = function (directory) {
|
|
115846
|
+
var key = toPath(directory);
|
|
115847
|
+
directoryExistsCache.delete(key);
|
|
115848
|
+
originalCreateDirectory.call(host, directory);
|
|
115849
|
+
};
|
|
115850
|
+
}
|
|
115848
115851
|
}
|
|
115849
115852
|
return {
|
|
115850
115853
|
originalReadFile: originalReadFile,
|
|
@@ -127813,6 +127816,41 @@ var ts;
|
|
|
127813
127816
|
return true;
|
|
127814
127817
|
}
|
|
127815
127818
|
ts.isTextWhiteSpaceLike = isTextWhiteSpaceLike;
|
|
127819
|
+
function getMappedLocation(location, sourceMapper, fileExists) {
|
|
127820
|
+
var mapsTo = sourceMapper.tryGetSourcePosition(location);
|
|
127821
|
+
return mapsTo && (!fileExists || fileExists(ts.normalizePath(mapsTo.fileName)) ? mapsTo : undefined);
|
|
127822
|
+
}
|
|
127823
|
+
ts.getMappedLocation = getMappedLocation;
|
|
127824
|
+
function getMappedDocumentSpan(documentSpan, sourceMapper, fileExists) {
|
|
127825
|
+
var fileName = documentSpan.fileName, textSpan = documentSpan.textSpan;
|
|
127826
|
+
var newPosition = getMappedLocation({ fileName: fileName, pos: textSpan.start }, sourceMapper, fileExists);
|
|
127827
|
+
if (!newPosition)
|
|
127828
|
+
return undefined;
|
|
127829
|
+
var newEndPosition = getMappedLocation({ fileName: fileName, pos: textSpan.start + textSpan.length }, sourceMapper, fileExists);
|
|
127830
|
+
var newLength = newEndPosition
|
|
127831
|
+
? newEndPosition.pos - newPosition.pos
|
|
127832
|
+
: textSpan.length; // This shouldn't happen
|
|
127833
|
+
return {
|
|
127834
|
+
fileName: newPosition.fileName,
|
|
127835
|
+
textSpan: {
|
|
127836
|
+
start: newPosition.pos,
|
|
127837
|
+
length: newLength,
|
|
127838
|
+
},
|
|
127839
|
+
originalFileName: documentSpan.fileName,
|
|
127840
|
+
originalTextSpan: documentSpan.textSpan,
|
|
127841
|
+
contextSpan: getMappedContextSpan(documentSpan, sourceMapper, fileExists),
|
|
127842
|
+
originalContextSpan: documentSpan.contextSpan
|
|
127843
|
+
};
|
|
127844
|
+
}
|
|
127845
|
+
ts.getMappedDocumentSpan = getMappedDocumentSpan;
|
|
127846
|
+
function getMappedContextSpan(documentSpan, sourceMapper, fileExists) {
|
|
127847
|
+
var contextSpanStart = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start }, sourceMapper, fileExists);
|
|
127848
|
+
var contextSpanEnd = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start + documentSpan.contextSpan.length }, sourceMapper, fileExists);
|
|
127849
|
+
return contextSpanStart && contextSpanEnd ?
|
|
127850
|
+
{ start: contextSpanStart.pos, length: contextSpanEnd.pos - contextSpanStart.pos } :
|
|
127851
|
+
undefined;
|
|
127852
|
+
}
|
|
127853
|
+
ts.getMappedContextSpan = getMappedContextSpan;
|
|
127816
127854
|
// #endregion
|
|
127817
127855
|
// Display-part writer helpers
|
|
127818
127856
|
// #region
|
|
@@ -131009,6 +131047,7 @@ var ts;
|
|
|
131009
131047
|
* Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename.
|
|
131010
131048
|
*/
|
|
131011
131049
|
function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, _a, host, exclude, result) {
|
|
131050
|
+
var _b;
|
|
131012
131051
|
var extensions = _a.extensions, includeExtensionsOption = _a.includeExtensionsOption;
|
|
131013
131052
|
if (result === void 0) { result = []; }
|
|
131014
131053
|
if (fragment === undefined) {
|
|
@@ -131026,9 +131065,26 @@ var ts;
|
|
|
131026
131065
|
fragment = "." + ts.directorySeparator;
|
|
131027
131066
|
}
|
|
131028
131067
|
fragment = ts.ensureTrailingDirectorySeparator(fragment);
|
|
131029
|
-
// const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment)); // TODO(rbuckton): should use resolvePaths
|
|
131030
131068
|
var absolutePath = ts.resolvePath(scriptPath, fragment);
|
|
131031
131069
|
var baseDirectory = ts.hasTrailingDirectorySeparator(absolutePath) ? absolutePath : ts.getDirectoryPath(absolutePath);
|
|
131070
|
+
// check for a version redirect
|
|
131071
|
+
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
131072
|
+
if (packageJsonPath) {
|
|
131073
|
+
var packageJson = ts.readJson(packageJsonPath, host);
|
|
131074
|
+
var typesVersions = packageJson.typesVersions;
|
|
131075
|
+
if (typeof typesVersions === "object") {
|
|
131076
|
+
var versionPaths = (_b = ts.getPackageJsonTypesVersionsPaths(typesVersions)) === null || _b === void 0 ? void 0 : _b.paths;
|
|
131077
|
+
if (versionPaths) {
|
|
131078
|
+
var packageDirectory = ts.getDirectoryPath(packageJsonPath);
|
|
131079
|
+
var pathInPackage = absolutePath.slice(ts.ensureTrailingDirectorySeparator(packageDirectory).length);
|
|
131080
|
+
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensions, versionPaths, host)) {
|
|
131081
|
+
// A true result means one of the `versionPaths` was matched, which will block relative resolution
|
|
131082
|
+
// to files and folders from here. All reachable paths given the pattern match are already added.
|
|
131083
|
+
return result;
|
|
131084
|
+
}
|
|
131085
|
+
}
|
|
131086
|
+
}
|
|
131087
|
+
}
|
|
131032
131088
|
var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
131033
131089
|
if (!ts.tryDirectoryExists(host, baseDirectory))
|
|
131034
131090
|
return result;
|
|
@@ -131070,48 +131126,62 @@ var ts;
|
|
|
131070
131126
|
// If possible, get folder completion as well
|
|
131071
131127
|
var directories = ts.tryGetDirectories(host, baseDirectory);
|
|
131072
131128
|
if (directories) {
|
|
131073
|
-
for (var
|
|
131074
|
-
var directory = directories_1[
|
|
131129
|
+
for (var _c = 0, directories_1 = directories; _c < directories_1.length; _c++) {
|
|
131130
|
+
var directory = directories_1[_c];
|
|
131075
131131
|
var directoryName = ts.getBaseFileName(ts.normalizePath(directory));
|
|
131076
131132
|
if (directoryName !== "@types") {
|
|
131077
131133
|
result.push(directoryResult(directoryName));
|
|
131078
131134
|
}
|
|
131079
131135
|
}
|
|
131080
131136
|
}
|
|
131081
|
-
// check for a version redirect
|
|
131082
|
-
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
131083
|
-
if (packageJsonPath) {
|
|
131084
|
-
var packageJson = ts.readJson(packageJsonPath, host);
|
|
131085
|
-
var typesVersions = packageJson.typesVersions;
|
|
131086
|
-
if (typeof typesVersions === "object") {
|
|
131087
|
-
var versionResult = ts.getPackageJsonTypesVersionsPaths(typesVersions);
|
|
131088
|
-
var versionPaths = versionResult && versionResult.paths;
|
|
131089
|
-
var rest = absolutePath.slice(ts.ensureTrailingDirectorySeparator(baseDirectory).length);
|
|
131090
|
-
if (versionPaths) {
|
|
131091
|
-
addCompletionEntriesFromPaths(result, rest, baseDirectory, extensions, versionPaths, host);
|
|
131092
|
-
}
|
|
131093
|
-
}
|
|
131094
|
-
}
|
|
131095
131137
|
return result;
|
|
131096
131138
|
}
|
|
131139
|
+
/** @returns whether `fragment` was a match for any `paths` (which should indicate whether any other path completions should be offered) */
|
|
131097
131140
|
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, fileExtensions, paths, host) {
|
|
131141
|
+
var _a;
|
|
131142
|
+
var pathResults = [];
|
|
131143
|
+
var matchedPathPrefixLength = -1;
|
|
131098
131144
|
for (var path in paths) {
|
|
131099
131145
|
if (!ts.hasProperty(paths, path))
|
|
131100
131146
|
continue;
|
|
131101
131147
|
var patterns = paths[path];
|
|
131102
131148
|
if (patterns) {
|
|
131103
|
-
var
|
|
131104
|
-
|
|
131105
|
-
|
|
131106
|
-
|
|
131107
|
-
|
|
131108
|
-
|
|
131109
|
-
|
|
131110
|
-
|
|
131111
|
-
|
|
131149
|
+
var pathPattern = ts.tryParsePattern(path);
|
|
131150
|
+
if (!pathPattern)
|
|
131151
|
+
continue;
|
|
131152
|
+
var isMatch = typeof pathPattern === "object" && ts.isPatternMatch(pathPattern, fragment);
|
|
131153
|
+
var isLongestMatch = isMatch && (matchedPathPrefixLength === undefined || pathPattern.prefix.length > matchedPathPrefixLength);
|
|
131154
|
+
if (isLongestMatch) {
|
|
131155
|
+
// If this is a higher priority match than anything we've seen so far, previous results from matches are invalid, e.g.
|
|
131156
|
+
// for `import {} from "some-package/|"` with a typesVersions:
|
|
131157
|
+
// {
|
|
131158
|
+
// "bar/*": ["bar/*"], // <-- 1. We add 'bar', but 'bar/*' doesn't match yet.
|
|
131159
|
+
// "*": ["dist/*"], // <-- 2. We match here and add files from dist. 'bar' is still ok because it didn't come from a match.
|
|
131160
|
+
// "foo/*": ["foo/*"] // <-- 3. We matched '*' earlier and added results from dist, but if 'foo/*' also matched,
|
|
131161
|
+
// } results in dist would not be visible. 'bar' still stands because it didn't come from a match.
|
|
131162
|
+
// This is especially important if `dist/foo` is a folder, because if we fail to clear results
|
|
131163
|
+
// added by the '*' match, after typing `"some-package/foo/|"` we would get file results from both
|
|
131164
|
+
// ./dist/foo and ./foo, when only the latter will actually be resolvable.
|
|
131165
|
+
// See pathCompletionsTypesVersionsWildcard6.ts.
|
|
131166
|
+
matchedPathPrefixLength = pathPattern.prefix.length;
|
|
131167
|
+
pathResults = pathResults.filter(function (r) { return !r.matchedPattern; });
|
|
131168
|
+
}
|
|
131169
|
+
if (typeof pathPattern === "string" || matchedPathPrefixLength === undefined || pathPattern.prefix.length >= matchedPathPrefixLength) {
|
|
131170
|
+
pathResults.push({
|
|
131171
|
+
matchedPattern: isMatch,
|
|
131172
|
+
results: getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host)
|
|
131173
|
+
.map(function (_a) {
|
|
131174
|
+
var name = _a.name, kind = _a.kind, extension = _a.extension;
|
|
131175
|
+
return nameAndKind(name, kind, extension);
|
|
131176
|
+
}),
|
|
131177
|
+
});
|
|
131112
131178
|
}
|
|
131113
131179
|
}
|
|
131114
131180
|
}
|
|
131181
|
+
var equatePaths = ((_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host)) ? ts.equateStringsCaseSensitive : ts.equateStringsCaseInsensitive;
|
|
131182
|
+
var equateResults = function (a, b) { return equatePaths(a.name, b.name); };
|
|
131183
|
+
pathResults.forEach(function (pathResult) { return pathResult.results.forEach(function (pathResult) { return ts.pushIfUnique(result, pathResult, equateResults); }); });
|
|
131184
|
+
return matchedPathPrefixLength > -1;
|
|
131115
131185
|
}
|
|
131116
131186
|
/**
|
|
131117
131187
|
* Check all of the declared modules and those in node modules. Possible sources of modules:
|
|
@@ -131143,7 +131213,7 @@ var ts;
|
|
|
131143
131213
|
// (But do if we didn't find anything, e.g. 'package.json' missing.)
|
|
131144
131214
|
var foundGlobal = false;
|
|
131145
131215
|
if (fragmentDirectory === undefined) {
|
|
131146
|
-
var
|
|
131216
|
+
var _loop_3 = function (moduleName) {
|
|
131147
131217
|
if (!result.some(function (entry) { return entry.name === moduleName; })) {
|
|
131148
131218
|
foundGlobal = true;
|
|
131149
131219
|
result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
|
|
@@ -131151,7 +131221,7 @@ var ts;
|
|
|
131151
131221
|
};
|
|
131152
131222
|
for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
|
|
131153
131223
|
var moduleName = _c[_b];
|
|
131154
|
-
|
|
131224
|
+
_loop_3(moduleName);
|
|
131155
131225
|
}
|
|
131156
131226
|
}
|
|
131157
131227
|
if (!foundGlobal) {
|
|
@@ -131231,11 +131301,16 @@ var ts;
|
|
|
131231
131301
|
}
|
|
131232
131302
|
var pathPrefix = path.slice(0, path.length - 1);
|
|
131233
131303
|
var remainingFragment = ts.tryRemovePrefix(fragment, pathPrefix);
|
|
131234
|
-
|
|
131235
|
-
|
|
131236
|
-
|
|
131304
|
+
if (remainingFragment === undefined) {
|
|
131305
|
+
var starIsFullPathComponent = path[path.length - 2] === "/";
|
|
131306
|
+
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) {
|
|
131307
|
+
var name = _a.name, rest = __rest(_a, ["name"]);
|
|
131308
|
+
return (__assign({ name: pathPrefix + name }, rest));
|
|
131309
|
+
}); });
|
|
131310
|
+
}
|
|
131311
|
+
return ts.flatMap(patterns, function (pattern) { return getModulesForPathsPattern(remainingFragment, baseUrl, pattern, fileExtensions, host); });
|
|
131237
131312
|
function justPathMappingName(name) {
|
|
131238
|
-
return ts.startsWith(name, fragment) ? [directoryResult(name)] : ts.emptyArray;
|
|
131313
|
+
return ts.startsWith(name, fragment) ? [directoryResult(ts.removeTrailingDirectorySeparator(name))] : ts.emptyArray;
|
|
131239
131314
|
}
|
|
131240
131315
|
}
|
|
131241
131316
|
function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) {
|
|
@@ -136734,6 +136809,7 @@ var ts;
|
|
|
136734
136809
|
var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined;
|
|
136735
136810
|
return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; })));
|
|
136736
136811
|
}
|
|
136812
|
+
FindAllReferences.isDeclarationOfSymbol = isDeclarationOfSymbol;
|
|
136737
136813
|
/**
|
|
136738
136814
|
* True if 'decl' provides a value, as in `function f() {}`;
|
|
136739
136815
|
* false if 'decl' is just a location for a future write, as in 'let x;'
|
|
@@ -136940,7 +137016,7 @@ var ts;
|
|
|
136940
137016
|
result = references;
|
|
136941
137017
|
continue;
|
|
136942
137018
|
}
|
|
136943
|
-
var
|
|
137019
|
+
var _loop_4 = function (entry) {
|
|
136944
137020
|
if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
|
|
136945
137021
|
result.push(entry);
|
|
136946
137022
|
return "continue";
|
|
@@ -136972,7 +137048,7 @@ var ts;
|
|
|
136972
137048
|
};
|
|
136973
137049
|
for (var _b = 0, references_2 = references; _b < references_2.length; _b++) {
|
|
136974
137050
|
var entry = references_2[_b];
|
|
136975
|
-
|
|
137051
|
+
_loop_4(entry);
|
|
136976
137052
|
}
|
|
136977
137053
|
}
|
|
136978
137054
|
return result;
|
|
@@ -139000,7 +139076,7 @@ var ts;
|
|
|
139000
139076
|
}
|
|
139001
139077
|
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
|
|
139002
139078
|
var allFiles = program.getSourceFiles();
|
|
139003
|
-
var
|
|
139079
|
+
var _loop_5 = function (sourceFile) {
|
|
139004
139080
|
var newFromOld = oldToNew(sourceFile.fileName);
|
|
139005
139081
|
var newImportFromPath = newFromOld !== null && newFromOld !== void 0 ? newFromOld : sourceFile.fileName;
|
|
139006
139082
|
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
|
|
@@ -139032,7 +139108,7 @@ var ts;
|
|
|
139032
139108
|
};
|
|
139033
139109
|
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
|
|
139034
139110
|
var sourceFile = allFiles_1[_i];
|
|
139035
|
-
|
|
139111
|
+
_loop_5(sourceFile);
|
|
139036
139112
|
}
|
|
139037
139113
|
}
|
|
139038
139114
|
function combineNormal(pathA, pathB) {
|
|
@@ -140056,7 +140132,7 @@ var ts;
|
|
|
140056
140132
|
if (!patternMatcher)
|
|
140057
140133
|
return ts.emptyArray;
|
|
140058
140134
|
var rawItems = [];
|
|
140059
|
-
var
|
|
140135
|
+
var _loop_6 = function (sourceFile) {
|
|
140060
140136
|
cancellationToken.throwIfCancellationRequested();
|
|
140061
140137
|
if (excludeDtsFiles && sourceFile.isDeclarationFile) {
|
|
140062
140138
|
return "continue";
|
|
@@ -140068,7 +140144,7 @@ var ts;
|
|
|
140068
140144
|
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
|
|
140069
140145
|
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
|
|
140070
140146
|
var sourceFile = sourceFiles_4[_i];
|
|
140071
|
-
|
|
140147
|
+
_loop_6(sourceFile);
|
|
140072
140148
|
}
|
|
140073
140149
|
rawItems.sort(compareNavigateToItems);
|
|
140074
140150
|
return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
|
|
@@ -142133,13 +142209,13 @@ var ts;
|
|
|
142133
142209
|
// Assumes 'value' is already lowercase.
|
|
142134
142210
|
function indexOfIgnoringCase(str, value) {
|
|
142135
142211
|
var n = str.length - value.length;
|
|
142136
|
-
var
|
|
142212
|
+
var _loop_7 = function (start) {
|
|
142137
142213
|
if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
|
|
142138
142214
|
return { value: start };
|
|
142139
142215
|
}
|
|
142140
142216
|
};
|
|
142141
142217
|
for (var start = 0; start <= n; start++) {
|
|
142142
|
-
var state_3 =
|
|
142218
|
+
var state_3 = _loop_7(start);
|
|
142143
142219
|
if (typeof state_3 === "object")
|
|
142144
142220
|
return state_3.value;
|
|
142145
142221
|
}
|
|
@@ -143558,7 +143634,7 @@ var ts;
|
|
|
143558
143634
|
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
|
|
143559
143635
|
}
|
|
143560
143636
|
function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
|
|
143561
|
-
var
|
|
143637
|
+
var _loop_8 = function (n) {
|
|
143562
143638
|
// If the node is not a subspan of its parent, this is a big problem.
|
|
143563
143639
|
// There have been crashes that might be caused by this violation.
|
|
143564
143640
|
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); });
|
|
@@ -143568,7 +143644,7 @@ var ts;
|
|
|
143568
143644
|
}
|
|
143569
143645
|
};
|
|
143570
143646
|
for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
|
|
143571
|
-
var state_4 =
|
|
143647
|
+
var state_4 = _loop_8(n);
|
|
143572
143648
|
if (typeof state_4 === "object")
|
|
143573
143649
|
return state_4.value;
|
|
143574
143650
|
}
|
|
@@ -145167,7 +145243,7 @@ var ts;
|
|
|
145167
145243
|
commandLineOptionsStringToEnum = commandLineOptionsStringToEnum ||
|
|
145168
145244
|
ts.filter(ts.optionDeclarations, function (o) { return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); });
|
|
145169
145245
|
options = ts.cloneCompilerOptions(options);
|
|
145170
|
-
var
|
|
145246
|
+
var _loop_9 = function (opt) {
|
|
145171
145247
|
if (!ts.hasProperty(options, opt.name)) {
|
|
145172
145248
|
return "continue";
|
|
145173
145249
|
}
|
|
@@ -145186,7 +145262,7 @@ var ts;
|
|
|
145186
145262
|
};
|
|
145187
145263
|
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
|
|
145188
145264
|
var opt = commandLineOptionsStringToEnum_1[_i];
|
|
145189
|
-
|
|
145265
|
+
_loop_9(opt);
|
|
145190
145266
|
}
|
|
145191
145267
|
return options;
|
|
145192
145268
|
}
|
|
@@ -148934,7 +149010,7 @@ var ts;
|
|
|
148934
149010
|
ChangeTracker.prototype.finishDeleteDeclarations = function () {
|
|
148935
149011
|
var _this = this;
|
|
148936
149012
|
var deletedNodesInLists = new ts.Set(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
|
|
148937
|
-
var
|
|
149013
|
+
var _loop_10 = function (sourceFile, node) {
|
|
148938
149014
|
if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
|
|
148939
149015
|
if (ts.isArray(node)) {
|
|
148940
149016
|
this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(sourceFile, node));
|
|
@@ -148947,7 +149023,7 @@ var ts;
|
|
|
148947
149023
|
var this_1 = this;
|
|
148948
149024
|
for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
|
|
148949
149025
|
var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
|
|
148950
|
-
|
|
149026
|
+
_loop_10(sourceFile, node);
|
|
148951
149027
|
}
|
|
148952
149028
|
deletedNodesInLists.forEach(function (node) {
|
|
148953
149029
|
var sourceFile = node.getSourceFile();
|
|
@@ -149035,14 +149111,14 @@ var ts;
|
|
|
149035
149111
|
// order changes by start position
|
|
149036
149112
|
// 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.
|
|
149037
149113
|
var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
|
|
149038
|
-
var
|
|
149114
|
+
var _loop_11 = function (i) {
|
|
149039
149115
|
ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
|
|
149040
149116
|
return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
|
|
149041
149117
|
});
|
|
149042
149118
|
};
|
|
149043
149119
|
// verify that change intervals do not overlap, except possibly at end points.
|
|
149044
149120
|
for (var i = 0; i < normalized.length - 1; i++) {
|
|
149045
|
-
|
|
149121
|
+
_loop_11(i);
|
|
149046
149122
|
}
|
|
149047
149123
|
var textChanges = ts.mapDefined(normalized, function (c) {
|
|
149048
149124
|
var span = ts.createTextSpanFromRange(c.range);
|
|
@@ -149951,7 +150027,7 @@ var ts;
|
|
|
149951
150027
|
}
|
|
149952
150028
|
var isCompleteFix = identifiers.isCompleteFix;
|
|
149953
150029
|
var initializers;
|
|
149954
|
-
var
|
|
150030
|
+
var _loop_12 = function (identifier) {
|
|
149955
150031
|
var symbol = checker.getSymbolAtLocation(identifier);
|
|
149956
150032
|
if (!symbol) {
|
|
149957
150033
|
return "continue";
|
|
@@ -149984,7 +150060,7 @@ var ts;
|
|
|
149984
150060
|
};
|
|
149985
150061
|
for (var _i = 0, _a = identifiers.identifiers; _i < _a.length; _i++) {
|
|
149986
150062
|
var identifier = _a[_i];
|
|
149987
|
-
|
|
150063
|
+
_loop_12(identifier);
|
|
149988
150064
|
}
|
|
149989
150065
|
return initializers && {
|
|
149990
150066
|
initializers: initializers,
|
|
@@ -150874,7 +150950,7 @@ var ts;
|
|
|
150874
150950
|
functionToConvert.getStart(sourceFile);
|
|
150875
150951
|
var options = functionToConvert.modifiers ? { prefix: " " } : { suffix: " " };
|
|
150876
150952
|
changes.insertModifierAt(sourceFile, pos, 131 /* AsyncKeyword */, options);
|
|
150877
|
-
var
|
|
150953
|
+
var _loop_13 = function (returnStatement) {
|
|
150878
150954
|
ts.forEachChild(returnStatement, function visit(node) {
|
|
150879
150955
|
if (ts.isCallExpression(node)) {
|
|
150880
150956
|
var newNodes = transformExpression(node, node, transformer, /*hasContinuation*/ false);
|
|
@@ -150896,7 +150972,7 @@ var ts;
|
|
|
150896
150972
|
};
|
|
150897
150973
|
for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
|
|
150898
150974
|
var returnStatement = returnStatements_1[_i];
|
|
150899
|
-
var state_5 =
|
|
150975
|
+
var state_5 = _loop_13(returnStatement);
|
|
150900
150976
|
if (typeof state_5 === "object")
|
|
150901
150977
|
return state_5.value;
|
|
150902
150978
|
}
|
|
@@ -154144,7 +154220,7 @@ var ts;
|
|
|
154144
154220
|
});
|
|
154145
154221
|
typeDeclToMembers.forEach(function (infos, declaration) {
|
|
154146
154222
|
var supers = ts.isTypeLiteralNode(declaration) ? undefined : codefix.getAllSupers(declaration, checker);
|
|
154147
|
-
var
|
|
154223
|
+
var _loop_14 = function (info) {
|
|
154148
154224
|
// If some superclass added this property, don't add it again.
|
|
154149
154225
|
if (supers === null || supers === void 0 ? void 0 : supers.some(function (superClassOrInterface) {
|
|
154150
154226
|
var superInfos = typeDeclToMembers.get(superClassOrInterface);
|
|
@@ -154171,7 +154247,7 @@ var ts;
|
|
|
154171
154247
|
};
|
|
154172
154248
|
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
|
|
154173
154249
|
var info = infos_1[_i];
|
|
154174
|
-
|
|
154250
|
+
_loop_14(info);
|
|
154175
154251
|
}
|
|
154176
154252
|
});
|
|
154177
154253
|
}));
|
|
@@ -156934,7 +157010,7 @@ var ts;
|
|
|
156934
157010
|
function getSignatureFromCalls(calls) {
|
|
156935
157011
|
var parameters = [];
|
|
156936
157012
|
var length = Math.max.apply(Math, calls.map(function (c) { return c.argumentTypes.length; }));
|
|
156937
|
-
var
|
|
157013
|
+
var _loop_15 = function (i) {
|
|
156938
157014
|
var symbol = checker.createSymbol(1 /* FunctionScopedVariable */, ts.escapeLeadingUnderscores("arg" + i));
|
|
156939
157015
|
symbol.type = combineTypes(calls.map(function (call) { return call.argumentTypes[i] || checker.getUndefinedType(); }));
|
|
156940
157016
|
if (calls.some(function (call) { return call.argumentTypes[i] === undefined; })) {
|
|
@@ -156943,7 +157019,7 @@ var ts;
|
|
|
156943
157019
|
parameters.push(symbol);
|
|
156944
157020
|
};
|
|
156945
157021
|
for (var i = 0; i < length; i++) {
|
|
156946
|
-
|
|
157022
|
+
_loop_15(i);
|
|
156947
157023
|
}
|
|
156948
157024
|
var returnType = combineFromUsage(combineUsages(calls.map(function (call) { return call.return_; })));
|
|
156949
157025
|
return checker.createSignature(/*declaration*/ undefined, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, 0 /* None */);
|
|
@@ -158916,7 +158992,7 @@ var ts;
|
|
|
158916
158992
|
// Imports that need to be kept as named imports in the refactored code, to avoid changing the semantics.
|
|
158917
158993
|
// 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 }`.
|
|
158918
158994
|
var neededNamedImports = new ts.Set();
|
|
158919
|
-
var
|
|
158995
|
+
var _loop_16 = function (element) {
|
|
158920
158996
|
var propertyName = (element.propertyName || element.name).text;
|
|
158921
158997
|
ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
|
|
158922
158998
|
var access = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(namespaceImportName), propertyName);
|
|
@@ -158933,7 +159009,7 @@ var ts;
|
|
|
158933
159009
|
};
|
|
158934
159010
|
for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
|
|
158935
159011
|
var element = _a[_i];
|
|
158936
|
-
|
|
159012
|
+
_loop_16(element);
|
|
158937
159013
|
}
|
|
158938
159014
|
changes.replaceNode(sourceFile, toConvert, shouldUseDefault
|
|
158939
159015
|
? ts.factory.createIdentifier(namespaceImportName)
|
|
@@ -160831,7 +160907,7 @@ var ts;
|
|
|
160831
160907
|
: ts.getEnclosingBlockScopeContainer(scopes[0]);
|
|
160832
160908
|
ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
|
|
160833
160909
|
}
|
|
160834
|
-
var
|
|
160910
|
+
var _loop_17 = function (i) {
|
|
160835
160911
|
var scopeUsages = usagesPerScope[i];
|
|
160836
160912
|
// Special case: in the innermost scope, all usages are available.
|
|
160837
160913
|
// (The computed value reflects the value at the top-level of the scope, but the
|
|
@@ -160874,7 +160950,7 @@ var ts;
|
|
|
160874
160950
|
}
|
|
160875
160951
|
};
|
|
160876
160952
|
for (var i = 0; i < scopes.length; i++) {
|
|
160877
|
-
|
|
160953
|
+
_loop_17(i);
|
|
160878
160954
|
}
|
|
160879
160955
|
return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
|
|
160880
160956
|
function isInGenericContext(node) {
|
|
@@ -161577,10 +161653,10 @@ var ts;
|
|
|
161577
161653
|
}
|
|
161578
161654
|
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
|
|
161579
161655
|
var checker = program.getTypeChecker();
|
|
161580
|
-
var
|
|
161656
|
+
var _loop_18 = function (sourceFile) {
|
|
161581
161657
|
if (sourceFile === oldFile)
|
|
161582
161658
|
return "continue";
|
|
161583
|
-
var
|
|
161659
|
+
var _loop_19 = function (statement) {
|
|
161584
161660
|
forEachImportInStatement(statement, function (importNode) {
|
|
161585
161661
|
if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
|
|
161586
161662
|
return;
|
|
@@ -161602,12 +161678,12 @@ var ts;
|
|
|
161602
161678
|
};
|
|
161603
161679
|
for (var _b = 0, _c = sourceFile.statements; _b < _c.length; _b++) {
|
|
161604
161680
|
var statement = _c[_b];
|
|
161605
|
-
|
|
161681
|
+
_loop_19(statement);
|
|
161606
161682
|
}
|
|
161607
161683
|
};
|
|
161608
161684
|
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
|
161609
161685
|
var sourceFile = _a[_i];
|
|
161610
|
-
|
|
161686
|
+
_loop_18(sourceFile);
|
|
161611
161687
|
}
|
|
161612
161688
|
}
|
|
161613
161689
|
function getNamespaceLikeImport(node) {
|
|
@@ -162971,7 +163047,7 @@ var ts;
|
|
|
162971
163047
|
var templateSpans = [];
|
|
162972
163048
|
var templateHead = ts.factory.createTemplateHead(headText, rawHeadText);
|
|
162973
163049
|
copyCommentFromStringLiterals(headIndexes, templateHead);
|
|
162974
|
-
var
|
|
163050
|
+
var _loop_20 = function (i) {
|
|
162975
163051
|
var currentNode = getExpressionFromParenthesesOrExpression(nodes[i]);
|
|
162976
163052
|
copyOperatorComments(i, currentNode);
|
|
162977
163053
|
var _c = concatConsecutiveString(i + 1, nodes), newIndex = _c[0], subsequentText = _c[1], rawSubsequentText = _c[2], stringIndexes = _c[3];
|
|
@@ -163000,7 +163076,7 @@ var ts;
|
|
|
163000
163076
|
};
|
|
163001
163077
|
var out_i_1;
|
|
163002
163078
|
for (var i = begin; i < nodes.length; i++) {
|
|
163003
|
-
|
|
163079
|
+
_loop_20(i);
|
|
163004
163080
|
i = out_i_1;
|
|
163005
163081
|
}
|
|
163006
163082
|
return ts.factory.createTemplateExpression(templateHead, templateSpans);
|
|
@@ -163836,7 +163912,7 @@ var ts;
|
|
|
163836
163912
|
var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
|
|
163837
163913
|
if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
163838
163914
|
var seenSymbols_1 = new ts.Set();
|
|
163839
|
-
var
|
|
163915
|
+
var _loop_21 = function (declaration) {
|
|
163840
163916
|
var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
163841
163917
|
var _a;
|
|
163842
163918
|
if (!seenSymbols_1.has(symbol)) {
|
|
@@ -163853,7 +163929,7 @@ var ts;
|
|
|
163853
163929
|
};
|
|
163854
163930
|
for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
|
|
163855
163931
|
var declaration = declarations_6[_i];
|
|
163856
|
-
|
|
163932
|
+
_loop_21(declaration);
|
|
163857
163933
|
}
|
|
163858
163934
|
}
|
|
163859
163935
|
return tags;
|
|
@@ -163864,7 +163940,7 @@ var ts;
|
|
|
163864
163940
|
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
|
|
163865
163941
|
if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
163866
163942
|
var seenSymbols_2 = new ts.Set();
|
|
163867
|
-
var
|
|
163943
|
+
var _loop_22 = function (declaration) {
|
|
163868
163944
|
var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
163869
163945
|
if (!seenSymbols_2.has(symbol)) {
|
|
163870
163946
|
seenSymbols_2.add(symbol);
|
|
@@ -163880,7 +163956,7 @@ var ts;
|
|
|
163880
163956
|
};
|
|
163881
163957
|
for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
|
|
163882
163958
|
var declaration = declarations_7[_i];
|
|
163883
|
-
|
|
163959
|
+
_loop_22(declaration);
|
|
163884
163960
|
}
|
|
163885
163961
|
}
|
|
163886
163962
|
return doc;
|
|
@@ -164137,70 +164213,6 @@ var ts;
|
|
|
164137
164213
|
return ts.codefix.getSupportedErrorCodes();
|
|
164138
164214
|
}
|
|
164139
164215
|
ts.getSupportedCodeFixes = getSupportedCodeFixes;
|
|
164140
|
-
// Cache host information about script Should be refreshed
|
|
164141
|
-
// at each language service public entry point, since we don't know when
|
|
164142
|
-
// the set of scripts handled by the host changes.
|
|
164143
|
-
var HostCache = /** @class */ (function () {
|
|
164144
|
-
function HostCache(host, getCanonicalFileName) {
|
|
164145
|
-
this.host = host;
|
|
164146
|
-
// script id => script index
|
|
164147
|
-
this.currentDirectory = host.getCurrentDirectory();
|
|
164148
|
-
this.fileNameToEntry = new ts.Map();
|
|
164149
|
-
// Initialize the list with the root file names
|
|
164150
|
-
var rootFileNames = host.getScriptFileNames();
|
|
164151
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "initializeHostCache", { count: rootFileNames.length });
|
|
164152
|
-
for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {
|
|
164153
|
-
var fileName = rootFileNames_1[_i];
|
|
164154
|
-
this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));
|
|
164155
|
-
}
|
|
164156
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
164157
|
-
}
|
|
164158
|
-
HostCache.prototype.createEntry = function (fileName, path) {
|
|
164159
|
-
var entry;
|
|
164160
|
-
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
|
164161
|
-
if (scriptSnapshot) {
|
|
164162
|
-
entry = {
|
|
164163
|
-
hostFileName: fileName,
|
|
164164
|
-
version: this.host.getScriptVersion(fileName),
|
|
164165
|
-
scriptSnapshot: scriptSnapshot,
|
|
164166
|
-
scriptKind: ts.getScriptKind(fileName, this.host)
|
|
164167
|
-
};
|
|
164168
|
-
}
|
|
164169
|
-
else {
|
|
164170
|
-
entry = fileName;
|
|
164171
|
-
}
|
|
164172
|
-
this.fileNameToEntry.set(path, entry);
|
|
164173
|
-
return entry;
|
|
164174
|
-
};
|
|
164175
|
-
HostCache.prototype.getEntryByPath = function (path) {
|
|
164176
|
-
return this.fileNameToEntry.get(path);
|
|
164177
|
-
};
|
|
164178
|
-
HostCache.prototype.getHostFileInformation = function (path) {
|
|
164179
|
-
var entry = this.fileNameToEntry.get(path);
|
|
164180
|
-
return !ts.isString(entry) ? entry : undefined;
|
|
164181
|
-
};
|
|
164182
|
-
HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) {
|
|
164183
|
-
var info = this.getEntryByPath(path) || this.createEntry(fileName, path);
|
|
164184
|
-
return ts.isString(info) ? undefined : info; // TODO: GH#18217
|
|
164185
|
-
};
|
|
164186
|
-
HostCache.prototype.getRootFileNames = function () {
|
|
164187
|
-
var names = [];
|
|
164188
|
-
this.fileNameToEntry.forEach(function (entry) {
|
|
164189
|
-
if (ts.isString(entry)) {
|
|
164190
|
-
names.push(entry);
|
|
164191
|
-
}
|
|
164192
|
-
else {
|
|
164193
|
-
names.push(entry.hostFileName);
|
|
164194
|
-
}
|
|
164195
|
-
});
|
|
164196
|
-
return names;
|
|
164197
|
-
};
|
|
164198
|
-
HostCache.prototype.getScriptSnapshot = function (path) {
|
|
164199
|
-
var file = this.getHostFileInformation(path);
|
|
164200
|
-
return (file && file.scriptSnapshot); // TODO: GH#18217
|
|
164201
|
-
};
|
|
164202
|
-
return HostCache;
|
|
164203
|
-
}());
|
|
164204
164216
|
var SyntaxTreeCache = /** @class */ (function () {
|
|
164205
164217
|
function SyntaxTreeCache(host) {
|
|
164206
164218
|
this.host = host;
|
|
@@ -164462,32 +164474,13 @@ var ts;
|
|
|
164462
164474
|
program = undefined; // TODO: GH#18217
|
|
164463
164475
|
lastTypesRootVersion = typeRootsVersion;
|
|
164464
164476
|
}
|
|
164477
|
+
var rootFileNames = host.getScriptFileNames();
|
|
164465
164478
|
// Get a fresh cache of the host information
|
|
164466
|
-
var hostCache = new HostCache(host, getCanonicalFileName);
|
|
164467
|
-
var rootFileNames = hostCache.getRootFileNames();
|
|
164468
164479
|
var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
|
|
164469
164480
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
164470
164481
|
var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames);
|
|
164471
164482
|
var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
164472
164483
|
var parsedCommandLines;
|
|
164473
|
-
var parseConfigHost = {
|
|
164474
|
-
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
|
164475
|
-
fileExists: fileExists,
|
|
164476
|
-
readFile: readFile,
|
|
164477
|
-
readDirectory: readDirectory,
|
|
164478
|
-
trace: ts.maybeBind(host, host.trace),
|
|
164479
|
-
getCurrentDirectory: function () { return currentDirectory; },
|
|
164480
|
-
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
164481
|
-
};
|
|
164482
|
-
// If the program is already up-to-date, we can reuse it
|
|
164483
|
-
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
164484
|
-
return;
|
|
164485
|
-
}
|
|
164486
|
-
// IMPORTANT - It is critical from this moment onward that we do not check
|
|
164487
|
-
// cancellation tokens. We are about to mutate source files from a previous program
|
|
164488
|
-
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
164489
|
-
// the program points to old source files that have been invalidated because of
|
|
164490
|
-
// incremental parsing.
|
|
164491
164484
|
// Now create a new compiler
|
|
164492
164485
|
var compilerHost = {
|
|
164493
164486
|
getSourceFile: getOrCreateSourceFile,
|
|
@@ -164499,8 +164492,8 @@ var ts;
|
|
|
164499
164492
|
getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
|
|
164500
164493
|
writeFile: ts.noop,
|
|
164501
164494
|
getCurrentDirectory: function () { return currentDirectory; },
|
|
164502
|
-
fileExists: fileExists,
|
|
164503
|
-
readFile: readFile,
|
|
164495
|
+
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
164496
|
+
readFile: function (fileName) { return host.readFile && host.readFile(fileName); },
|
|
164504
164497
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
|
|
164505
164498
|
realpath: ts.maybeBind(host, host.realpath),
|
|
164506
164499
|
directoryExists: function (directoryName) {
|
|
@@ -164509,19 +164502,56 @@ var ts;
|
|
|
164509
164502
|
getDirectories: function (path) {
|
|
164510
164503
|
return host.getDirectories ? host.getDirectories(path) : [];
|
|
164511
164504
|
},
|
|
164512
|
-
readDirectory:
|
|
164505
|
+
readDirectory: function (path, extensions, exclude, include, depth) {
|
|
164506
|
+
ts.Debug.checkDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'");
|
|
164507
|
+
return host.readDirectory(path, extensions, exclude, include, depth);
|
|
164508
|
+
},
|
|
164513
164509
|
onReleaseOldSourceFile: onReleaseOldSourceFile,
|
|
164514
164510
|
onReleaseParsedCommandLine: onReleaseParsedCommandLine,
|
|
164515
164511
|
hasInvalidatedResolution: hasInvalidatedResolution,
|
|
164516
164512
|
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
|
|
164517
|
-
trace:
|
|
164513
|
+
trace: ts.maybeBind(host, host.trace),
|
|
164518
164514
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
164519
164515
|
getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
|
|
164520
164516
|
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
164521
164517
|
useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
164522
164518
|
getParsedCommandLine: getParsedCommandLine,
|
|
164523
164519
|
};
|
|
164520
|
+
var originalGetSourceFile = compilerHost.getSourceFile;
|
|
164521
|
+
var getSourceFileWithCache = ts.changeCompilerHostLikeToUseCache(compilerHost, function (fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); }, function () {
|
|
164522
|
+
var args = [];
|
|
164523
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
164524
|
+
args[_i] = arguments[_i];
|
|
164525
|
+
}
|
|
164526
|
+
return originalGetSourceFile.call.apply(originalGetSourceFile, __spreadArray([compilerHost], args, false));
|
|
164527
|
+
}).getSourceFileWithCache;
|
|
164528
|
+
compilerHost.getSourceFile = getSourceFileWithCache;
|
|
164524
164529
|
(_c = host.setCompilerHost) === null || _c === void 0 ? void 0 : _c.call(host, compilerHost);
|
|
164530
|
+
var parseConfigHost = {
|
|
164531
|
+
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
|
164532
|
+
fileExists: function (fileName) { return compilerHost.fileExists(fileName); },
|
|
164533
|
+
readFile: function (fileName) { return compilerHost.readFile(fileName); },
|
|
164534
|
+
readDirectory: function () {
|
|
164535
|
+
var _a;
|
|
164536
|
+
var args = [];
|
|
164537
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
164538
|
+
args[_i] = arguments[_i];
|
|
164539
|
+
}
|
|
164540
|
+
return (_a = compilerHost).readDirectory.apply(_a, args);
|
|
164541
|
+
},
|
|
164542
|
+
trace: compilerHost.trace,
|
|
164543
|
+
getCurrentDirectory: compilerHost.getCurrentDirectory,
|
|
164544
|
+
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
164545
|
+
};
|
|
164546
|
+
// If the program is already up-to-date, we can reuse it
|
|
164547
|
+
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
164548
|
+
return;
|
|
164549
|
+
}
|
|
164550
|
+
// IMPORTANT - It is critical from this moment onward that we do not check
|
|
164551
|
+
// cancellation tokens. We are about to mutate source files from a previous program
|
|
164552
|
+
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
164553
|
+
// the program points to old source files that have been invalidated because of
|
|
164554
|
+
// incremental parsing.
|
|
164525
164555
|
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
164526
164556
|
var options = {
|
|
164527
164557
|
rootNames: rootFileNames,
|
|
@@ -164531,9 +164561,9 @@ var ts;
|
|
|
164531
164561
|
projectReferences: projectReferences
|
|
164532
164562
|
};
|
|
164533
164563
|
program = ts.createProgram(options);
|
|
164534
|
-
//
|
|
164535
|
-
//
|
|
164536
|
-
|
|
164564
|
+
// 'getOrCreateSourceFile' depends on caching but should be used past this point.
|
|
164565
|
+
// After this point, the cache needs to be cleared to allow all collected snapshots to be released
|
|
164566
|
+
compilerHost = undefined;
|
|
164537
164567
|
parsedCommandLines = undefined;
|
|
164538
164568
|
// 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,
|
|
164539
164569
|
// Because it only functions until `hostCache` is cleared, while we'll potentially need the functionality to lazily read sourcemap files during
|
|
@@ -164573,26 +164603,6 @@ var ts;
|
|
|
164573
164603
|
onReleaseOldSourceFile(oldResolvedRef.sourceFile, oldOptions);
|
|
164574
164604
|
}
|
|
164575
164605
|
}
|
|
164576
|
-
function fileExists(fileName) {
|
|
164577
|
-
var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
164578
|
-
var entry = hostCache && hostCache.getEntryByPath(path);
|
|
164579
|
-
return entry ?
|
|
164580
|
-
!ts.isString(entry) :
|
|
164581
|
-
(!!host.fileExists && host.fileExists(fileName));
|
|
164582
|
-
}
|
|
164583
|
-
function readFile(fileName) {
|
|
164584
|
-
// stub missing host functionality
|
|
164585
|
-
var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
164586
|
-
var entry = hostCache && hostCache.getEntryByPath(path);
|
|
164587
|
-
if (entry) {
|
|
164588
|
-
return ts.isString(entry) ? undefined : ts.getSnapshotText(entry.scriptSnapshot);
|
|
164589
|
-
}
|
|
164590
|
-
return host.readFile && host.readFile(fileName);
|
|
164591
|
-
}
|
|
164592
|
-
function readDirectory(path, extensions, exclude, include, depth) {
|
|
164593
|
-
ts.Debug.checkDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'");
|
|
164594
|
-
return host.readDirectory(path, extensions, exclude, include, depth);
|
|
164595
|
-
}
|
|
164596
164606
|
// Release any files we have acquired in the old program but are
|
|
164597
164607
|
// not part of the new program.
|
|
164598
164608
|
function onReleaseOldSourceFile(oldSourceFile, oldOptions) {
|
|
@@ -164603,14 +164613,16 @@ var ts;
|
|
|
164603
164613
|
return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), languageVersion, onError, shouldCreateNewSourceFile);
|
|
164604
164614
|
}
|
|
164605
164615
|
function getOrCreateSourceFileByPath(fileName, path, _languageVersion, _onError, shouldCreateNewSourceFile) {
|
|
164606
|
-
ts.Debug.assert(
|
|
164616
|
+
ts.Debug.assert(compilerHost, "getOrCreateSourceFileByPath called after typical CompilerHost lifetime, check the callstack something with a reference to an old host.");
|
|
164607
164617
|
// The program is asking for this file, check first if the host can locate it.
|
|
164608
164618
|
// If the host can not locate the file, then it does not exist. return undefined
|
|
164609
164619
|
// to the program to allow reporting of errors for missing files.
|
|
164610
|
-
var
|
|
164611
|
-
if (!
|
|
164620
|
+
var scriptSnapshot = host.getScriptSnapshot(fileName);
|
|
164621
|
+
if (!scriptSnapshot) {
|
|
164612
164622
|
return undefined;
|
|
164613
164623
|
}
|
|
164624
|
+
var scriptKind = ts.getScriptKind(fileName, host);
|
|
164625
|
+
var scriptVersion = host.getScriptVersion(fileName);
|
|
164614
164626
|
// Check if the language version has changed since we last created a program; if they are the same,
|
|
164615
164627
|
// it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile
|
|
164616
164628
|
// can not be reused. we have to dump all syntax trees and create new ones.
|
|
@@ -164642,8 +164654,8 @@ var ts;
|
|
|
164642
164654
|
// We do not support the scenario where a host can modify a registered
|
|
164643
164655
|
// file's script kind, i.e. in one project some file is treated as ".ts"
|
|
164644
164656
|
// and in another as ".js"
|
|
164645
|
-
if (
|
|
164646
|
-
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey,
|
|
164657
|
+
if (scriptKind === oldSourceFile.scriptKind) {
|
|
164658
|
+
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind);
|
|
164647
164659
|
}
|
|
164648
164660
|
else {
|
|
164649
164661
|
// Release old source file and fall through to aquire new file with new script kind
|
|
@@ -164653,7 +164665,7 @@ var ts;
|
|
|
164653
164665
|
// We didn't already have the file. Fall through and acquire it from the registry.
|
|
164654
164666
|
}
|
|
164655
164667
|
// Could not find this file in the old program, create a new SourceFile for it.
|
|
164656
|
-
return documentRegistry.acquireDocumentWithKey(fileName, path, host, documentRegistryBucketKey,
|
|
164668
|
+
return documentRegistry.acquireDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind);
|
|
164657
164669
|
}
|
|
164658
164670
|
}
|
|
164659
164671
|
// TODO: GH#18217 frequently asserted as defined
|
|
@@ -164669,6 +164681,61 @@ var ts;
|
|
|
164669
164681
|
var _a;
|
|
164670
164682
|
return (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
164671
164683
|
}
|
|
164684
|
+
function updateIsDefinitionOfReferencedSymbols(referencedSymbols, knownSymbolSpans) {
|
|
164685
|
+
var checker = program.getTypeChecker();
|
|
164686
|
+
var symbol = getSymbolForProgram();
|
|
164687
|
+
if (!symbol)
|
|
164688
|
+
return false;
|
|
164689
|
+
for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) {
|
|
164690
|
+
var referencedSymbol = referencedSymbols_1[_i];
|
|
164691
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
164692
|
+
var ref = _b[_a];
|
|
164693
|
+
var refNode = getNodeForSpan(ref);
|
|
164694
|
+
ts.Debug.assertIsDefined(refNode);
|
|
164695
|
+
if (knownSymbolSpans.has(ref) || ts.FindAllReferences.isDeclarationOfSymbol(refNode, symbol)) {
|
|
164696
|
+
knownSymbolSpans.add(ref);
|
|
164697
|
+
ref.isDefinition = true;
|
|
164698
|
+
var mappedSpan = ts.getMappedDocumentSpan(ref, sourceMapper, ts.maybeBind(host, host.fileExists));
|
|
164699
|
+
if (mappedSpan) {
|
|
164700
|
+
knownSymbolSpans.add(mappedSpan);
|
|
164701
|
+
}
|
|
164702
|
+
}
|
|
164703
|
+
else {
|
|
164704
|
+
ref.isDefinition = false;
|
|
164705
|
+
}
|
|
164706
|
+
}
|
|
164707
|
+
}
|
|
164708
|
+
return true;
|
|
164709
|
+
function getSymbolForProgram() {
|
|
164710
|
+
for (var _i = 0, referencedSymbols_2 = referencedSymbols; _i < referencedSymbols_2.length; _i++) {
|
|
164711
|
+
var referencedSymbol = referencedSymbols_2[_i];
|
|
164712
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
164713
|
+
var ref = _b[_a];
|
|
164714
|
+
if (knownSymbolSpans.has(ref)) {
|
|
164715
|
+
var refNode = getNodeForSpan(ref);
|
|
164716
|
+
ts.Debug.assertIsDefined(refNode);
|
|
164717
|
+
return checker.getSymbolAtLocation(refNode);
|
|
164718
|
+
}
|
|
164719
|
+
var mappedSpan = ts.getMappedDocumentSpan(ref, sourceMapper, ts.maybeBind(host, host.fileExists));
|
|
164720
|
+
if (mappedSpan && knownSymbolSpans.has(mappedSpan)) {
|
|
164721
|
+
var refNode = getNodeForSpan(mappedSpan);
|
|
164722
|
+
if (refNode) {
|
|
164723
|
+
return checker.getSymbolAtLocation(refNode);
|
|
164724
|
+
}
|
|
164725
|
+
}
|
|
164726
|
+
}
|
|
164727
|
+
}
|
|
164728
|
+
return undefined;
|
|
164729
|
+
}
|
|
164730
|
+
function getNodeForSpan(docSpan) {
|
|
164731
|
+
var sourceFile = program.getSourceFile(docSpan.fileName);
|
|
164732
|
+
if (!sourceFile)
|
|
164733
|
+
return undefined;
|
|
164734
|
+
var rawNode = ts.getTouchingPropertyName(sourceFile, docSpan.textSpan.start);
|
|
164735
|
+
var adjustedNode = ts.FindAllReferences.Core.getAdjustedNode(rawNode, { use: 1 /* References */ });
|
|
164736
|
+
return adjustedNode;
|
|
164737
|
+
}
|
|
164738
|
+
}
|
|
164672
164739
|
function cleanupSemanticCache() {
|
|
164673
164740
|
program = undefined; // TODO: GH#18217
|
|
164674
164741
|
}
|
|
@@ -165595,6 +165662,7 @@ var ts;
|
|
|
165595
165662
|
getNonBoundSourceFile: getNonBoundSourceFile,
|
|
165596
165663
|
getProgram: getProgram,
|
|
165597
165664
|
getAutoImportProvider: getAutoImportProvider,
|
|
165665
|
+
updateIsDefinitionOfReferencedSymbols: updateIsDefinitionOfReferencedSymbols,
|
|
165598
165666
|
getApplicableRefactors: getApplicableRefactors,
|
|
165599
165667
|
getEditsForRefactor: getEditsForRefactor,
|
|
165600
165668
|
toLineColumnOffset: toLineColumnOffset,
|
|
@@ -174735,66 +174803,142 @@ var ts;
|
|
|
174735
174803
|
return textSpan.start + 100003 * textSpan.length;
|
|
174736
174804
|
}, ts.documentSpansEqual);
|
|
174737
174805
|
}
|
|
174738
|
-
function
|
|
174806
|
+
function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, _a) {
|
|
174739
174807
|
var providePrefixAndSuffixTextForRename = _a.providePrefixAndSuffixTextForRename;
|
|
174740
|
-
var
|
|
174808
|
+
var perProjectResults = getPerProjectReferences(projects, defaultProject, initialLocation,
|
|
174809
|
+
/*isForRename*/ true, function (project, position) { return project.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments, providePrefixAndSuffixTextForRename); }, function (renameLocation, cb) { return cb(documentSpanLocation(renameLocation)); });
|
|
174810
|
+
// No filtering or dedup'ing is required if there's exactly one project
|
|
174811
|
+
if (ts.isArray(perProjectResults)) {
|
|
174812
|
+
return perProjectResults;
|
|
174813
|
+
}
|
|
174814
|
+
var results = [];
|
|
174741
174815
|
var seen = createDocumentSpanSet();
|
|
174742
|
-
|
|
174743
|
-
|
|
174744
|
-
|
|
174745
|
-
|
|
174746
|
-
|
|
174747
|
-
|
|
174748
|
-
|
|
174749
|
-
seen.add(output);
|
|
174750
|
-
outputs.push(output);
|
|
174751
|
-
}
|
|
174816
|
+
perProjectResults.forEach(function (projectResults, project) {
|
|
174817
|
+
for (var _i = 0, projectResults_1 = projectResults; _i < projectResults_1.length; _i++) {
|
|
174818
|
+
var result = projectResults_1[_i];
|
|
174819
|
+
// If there's a mapped location, it'll appear in the results for another project
|
|
174820
|
+
if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
|
|
174821
|
+
results.push(result);
|
|
174822
|
+
seen.add(result);
|
|
174752
174823
|
}
|
|
174753
174824
|
}
|
|
174754
174825
|
});
|
|
174755
|
-
return
|
|
174826
|
+
return results;
|
|
174756
174827
|
}
|
|
174757
174828
|
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
174758
|
-
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, isForRename);
|
|
174829
|
+
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, /*stopAtAlias*/ isForRename);
|
|
174759
174830
|
var info = infos && ts.firstOrUndefined(infos);
|
|
174760
174831
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
174761
174832
|
}
|
|
174762
|
-
function
|
|
174763
|
-
var
|
|
174764
|
-
|
|
174765
|
-
|
|
174766
|
-
|
|
174767
|
-
|
|
174768
|
-
|
|
174769
|
-
|
|
174770
|
-
var
|
|
174771
|
-
|
|
174772
|
-
|
|
174773
|
-
|
|
174774
|
-
|
|
174775
|
-
|
|
174776
|
-
|
|
174777
|
-
|
|
174778
|
-
|
|
174779
|
-
|
|
174780
|
-
|
|
174781
|
-
|
|
174782
|
-
|
|
174783
|
-
|
|
174784
|
-
|
|
174785
|
-
|
|
174786
|
-
|
|
174787
|
-
|
|
174788
|
-
|
|
174833
|
+
function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
|
|
174834
|
+
var perProjectResults = getPerProjectReferences(projects, defaultProject, initialLocation,
|
|
174835
|
+
/*isForRename*/ false, function (project, position) {
|
|
174836
|
+
logger.info("Finding references to " + position.fileName + " position " + position.pos + " in project " + project.getProjectName());
|
|
174837
|
+
return project.getLanguageService().findReferences(position.fileName, position.pos);
|
|
174838
|
+
}, function (referencedSymbol, cb) {
|
|
174839
|
+
cb(documentSpanLocation(referencedSymbol.definition));
|
|
174840
|
+
for (var _i = 0, _a = referencedSymbol.references; _i < _a.length; _i++) {
|
|
174841
|
+
var ref = _a[_i];
|
|
174842
|
+
cb(documentSpanLocation(ref));
|
|
174843
|
+
}
|
|
174844
|
+
});
|
|
174845
|
+
// No re-mapping or isDefinition updatses are required if there's exactly one project
|
|
174846
|
+
if (ts.isArray(perProjectResults)) {
|
|
174847
|
+
return perProjectResults;
|
|
174848
|
+
}
|
|
174849
|
+
// `isDefinition` is only (definitely) correct in `defaultProject` because we might
|
|
174850
|
+
// have started the other project searches from related symbols. Propagate the
|
|
174851
|
+
// correct results to all other projects.
|
|
174852
|
+
var defaultProjectResults = perProjectResults.get(defaultProject);
|
|
174853
|
+
if (defaultProjectResults[0].references[0].isDefinition === undefined) {
|
|
174854
|
+
// Clear all isDefinition properties
|
|
174855
|
+
perProjectResults.forEach(function (projectResults) {
|
|
174856
|
+
for (var _i = 0, projectResults_2 = projectResults; _i < projectResults_2.length; _i++) {
|
|
174857
|
+
var referencedSymbol = projectResults_2[_i];
|
|
174858
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
174859
|
+
var ref = _b[_a];
|
|
174860
|
+
delete ref.isDefinition;
|
|
174789
174861
|
}
|
|
174790
|
-
};
|
|
174791
|
-
for (var _i = 0, projectOutputs_2 = projectOutputs; _i < projectOutputs_2.length; _i++) {
|
|
174792
|
-
var referencedSymbol = projectOutputs_2[_i];
|
|
174793
|
-
_loop_9(referencedSymbol);
|
|
174794
174862
|
}
|
|
174863
|
+
});
|
|
174864
|
+
}
|
|
174865
|
+
else {
|
|
174866
|
+
// Correct isDefinition properties from projects other than defaultProject
|
|
174867
|
+
var knownSymbolSpans_1 = createDocumentSpanSet();
|
|
174868
|
+
for (var _i = 0, defaultProjectResults_1 = defaultProjectResults; _i < defaultProjectResults_1.length; _i++) {
|
|
174869
|
+
var referencedSymbol = defaultProjectResults_1[_i];
|
|
174870
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
174871
|
+
var ref = _b[_a];
|
|
174872
|
+
if (ref.isDefinition) {
|
|
174873
|
+
knownSymbolSpans_1.add(ref);
|
|
174874
|
+
// One is enough - updateIsDefinitionOfReferencedSymbols will fill out the set based on symbols
|
|
174875
|
+
break;
|
|
174876
|
+
}
|
|
174877
|
+
}
|
|
174878
|
+
}
|
|
174879
|
+
var updatedProjects_1 = new ts.Set();
|
|
174880
|
+
var _loop_9 = function () {
|
|
174881
|
+
var progress = false;
|
|
174882
|
+
perProjectResults.forEach(function (referencedSymbols, project) {
|
|
174883
|
+
if (updatedProjects_1.has(project))
|
|
174884
|
+
return;
|
|
174885
|
+
var updated = project.getLanguageService().updateIsDefinitionOfReferencedSymbols(referencedSymbols, knownSymbolSpans_1);
|
|
174886
|
+
if (updated) {
|
|
174887
|
+
updatedProjects_1.add(project);
|
|
174888
|
+
progress = true;
|
|
174889
|
+
}
|
|
174890
|
+
});
|
|
174891
|
+
if (!progress)
|
|
174892
|
+
return "break";
|
|
174893
|
+
};
|
|
174894
|
+
while (true) {
|
|
174895
|
+
var state_2 = _loop_9();
|
|
174896
|
+
if (state_2 === "break")
|
|
174897
|
+
break;
|
|
174898
|
+
}
|
|
174899
|
+
perProjectResults.forEach(function (referencedSymbols, project) {
|
|
174900
|
+
if (updatedProjects_1.has(project))
|
|
174901
|
+
return;
|
|
174902
|
+
for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) {
|
|
174903
|
+
var referencedSymbol = referencedSymbols_1[_i];
|
|
174904
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
174905
|
+
var ref = _b[_a];
|
|
174906
|
+
ref.isDefinition = false;
|
|
174907
|
+
}
|
|
174908
|
+
}
|
|
174909
|
+
});
|
|
174910
|
+
}
|
|
174911
|
+
// We need to de-duplicate and aggregate the results by choosing an authoritative version
|
|
174912
|
+
// of each definition and merging references from all the projects where they appear.
|
|
174913
|
+
var results = [];
|
|
174914
|
+
var seenRefs = createDocumentSpanSet(); // It doesn't make sense to have a reference in two definition lists, so we de-dup globally
|
|
174915
|
+
// TODO: We might end up with a more logical allocation of refs to defs if we pre-sorted the defs by descending ref-count.
|
|
174916
|
+
// Otherwise, it just ends up attached to the first corresponding def we happen to process. The others may or may not be
|
|
174917
|
+
// dropped later when we check for defs with ref-count 0.
|
|
174918
|
+
perProjectResults.forEach(function (projectResults, project) {
|
|
174919
|
+
var _loop_10 = function (referencedSymbol) {
|
|
174920
|
+
var mappedDefinitionFile = getMappedLocationForProject(documentSpanLocation(referencedSymbol.definition), project);
|
|
174921
|
+
var definition = mappedDefinitionFile === undefined ?
|
|
174922
|
+
referencedSymbol.definition : __assign(__assign({}, referencedSymbol.definition), { textSpan: ts.createTextSpan(mappedDefinitionFile.pos, referencedSymbol.definition.textSpan.length), fileName: mappedDefinitionFile.fileName, contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project) });
|
|
174923
|
+
var symbolToAddTo = ts.find(results, function (o) { return ts.documentSpansEqual(o.definition, definition); });
|
|
174924
|
+
if (!symbolToAddTo) {
|
|
174925
|
+
symbolToAddTo = { definition: definition, references: [] };
|
|
174926
|
+
results.push(symbolToAddTo);
|
|
174927
|
+
}
|
|
174928
|
+
for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
|
|
174929
|
+
var ref = _b[_a];
|
|
174930
|
+
if (!seenRefs.has(ref) && !getMappedLocationForProject(documentSpanLocation(ref), project)) {
|
|
174931
|
+
seenRefs.add(ref);
|
|
174932
|
+
symbolToAddTo.references.push(ref);
|
|
174933
|
+
}
|
|
174934
|
+
}
|
|
174935
|
+
};
|
|
174936
|
+
for (var _i = 0, projectResults_3 = projectResults; _i < projectResults_3.length; _i++) {
|
|
174937
|
+
var referencedSymbol = projectResults_3[_i];
|
|
174938
|
+
_loop_10(referencedSymbol);
|
|
174795
174939
|
}
|
|
174796
174940
|
});
|
|
174797
|
-
return
|
|
174941
|
+
return results.filter(function (o) { return o.references.length !== 0; });
|
|
174798
174942
|
}
|
|
174799
174943
|
function forEachProjectInProjects(projects, path, cb) {
|
|
174800
174944
|
for (var _i = 0, _a = ts.isArray(projects) ? projects : projects.projects; _i < _a.length; _i++) {
|
|
@@ -174810,40 +174954,117 @@ var ts;
|
|
|
174810
174954
|
});
|
|
174811
174955
|
}
|
|
174812
174956
|
}
|
|
174813
|
-
|
|
174814
|
-
|
|
174815
|
-
|
|
174816
|
-
|
|
174817
|
-
|
|
174818
|
-
|
|
174819
|
-
|
|
174820
|
-
|
|
174957
|
+
/**
|
|
174958
|
+
* @param projects Projects initially known to contain {@link initialLocation}
|
|
174959
|
+
* @param defaultProject The default project containing {@link initialLocation}
|
|
174960
|
+
* @param initialLocation Where the search operation was triggered
|
|
174961
|
+
* @param getResultsForPosition This is where you plug in `findReferences`, `renameLocation`, etc
|
|
174962
|
+
* @param forPositionInResult Given an item returned by {@link getResultsForPosition} enumerate the positions referred to by that result
|
|
174963
|
+
* @returns In the common case where there's only one project, returns an array of results from {@link getResultsForPosition}.
|
|
174964
|
+
* If multiple projects were searched - even if they didn't return results - the result will be a map from project to per-project results.
|
|
174965
|
+
*/
|
|
174966
|
+
function getPerProjectReferences(projects, defaultProject, initialLocation, isForRename, getResultsForPosition, forPositionInResult) {
|
|
174967
|
+
// If `getResultsForPosition` returns results for a project, they go in here
|
|
174968
|
+
var resultsMap = new ts.Map();
|
|
174969
|
+
var queue = [];
|
|
174970
|
+
// In order to get accurate isDefinition values for `defaultProject`,
|
|
174971
|
+
// we need to ensure that it is searched from `initialLocation`.
|
|
174972
|
+
// The easiest way to do this is to search it first.
|
|
174973
|
+
queue.push({ project: defaultProject, location: initialLocation });
|
|
174974
|
+
// This will queue `defaultProject` a second time, but it will be dropped
|
|
174975
|
+
// as a dup when it is dequeued.
|
|
174976
|
+
forEachProjectInProjects(projects, initialLocation.fileName, function (project, path) {
|
|
174977
|
+
var location = { fileName: path, pos: initialLocation.pos };
|
|
174978
|
+
queue.push({ project: project, location: location });
|
|
174821
174979
|
});
|
|
174822
|
-
|
|
174823
|
-
|
|
174824
|
-
|
|
174825
|
-
|
|
174826
|
-
|
|
174827
|
-
|
|
174828
|
-
|
|
174829
|
-
|
|
174830
|
-
|
|
174831
|
-
|
|
174832
|
-
|
|
174980
|
+
var projectService = defaultProject.projectService;
|
|
174981
|
+
var cancellationToken = defaultProject.getCancellationToken();
|
|
174982
|
+
var defaultDefinition = getDefinitionLocation(defaultProject, initialLocation, isForRename);
|
|
174983
|
+
// Don't call these unless !!defaultDefinition
|
|
174984
|
+
var getGeneratedDefinition = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition.fileName) ?
|
|
174985
|
+
defaultDefinition :
|
|
174986
|
+
defaultProject.getLanguageService().getSourceMapper().tryGetGeneratedPosition(defaultDefinition); });
|
|
174987
|
+
var getSourceDefinition = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition.fileName) ?
|
|
174988
|
+
defaultDefinition :
|
|
174989
|
+
defaultProject.getLanguageService().getSourceMapper().tryGetSourcePosition(defaultDefinition); });
|
|
174990
|
+
// Track which projects we have already searched so that we don't repeat searches.
|
|
174991
|
+
// We store the project key, rather than the project, because that's what `loadAncestorProjectTree` wants.
|
|
174992
|
+
// (For that same reason, we don't use `resultsMap` for this check.)
|
|
174993
|
+
var searchedProjects = new ts.Set();
|
|
174994
|
+
onCancellation: while (queue.length) {
|
|
174995
|
+
while (queue.length) {
|
|
174996
|
+
if (cancellationToken.isCancellationRequested())
|
|
174997
|
+
break onCancellation;
|
|
174998
|
+
var _a = queue.shift(), project = _a.project, location = _a.location;
|
|
174999
|
+
if (isLocationProjectReferenceRedirect(project, location))
|
|
175000
|
+
continue;
|
|
175001
|
+
if (!ts.tryAddToSet(searchedProjects, getProjectKey(project)))
|
|
175002
|
+
continue;
|
|
175003
|
+
var projectResults = searchPosition(project, location);
|
|
175004
|
+
if (projectResults) {
|
|
175005
|
+
resultsMap.set(project, projectResults);
|
|
175006
|
+
}
|
|
175007
|
+
}
|
|
175008
|
+
// At this point, we know about all projects passed in as arguments and any projects in which
|
|
175009
|
+
// `getResultsForPosition` has returned results. We expand that set to include any projects
|
|
175010
|
+
// downstream from any of these and then queue new initial-position searches for any new project
|
|
175011
|
+
// containing `initialLocation`.
|
|
175012
|
+
if (defaultDefinition) {
|
|
175013
|
+
// This seems to mean "load all projects downstream from any member of `seenProjects`".
|
|
175014
|
+
projectService.loadAncestorProjectTree(searchedProjects);
|
|
174833
175015
|
projectService.forEachEnabledProject(function (project) {
|
|
174834
|
-
if (
|
|
174835
|
-
return;
|
|
174836
|
-
|
|
174837
|
-
|
|
174838
|
-
|
|
175016
|
+
if (cancellationToken.isCancellationRequested())
|
|
175017
|
+
return; // There's no mechanism for skipping the remaining projects
|
|
175018
|
+
if (searchedProjects.has(getProjectKey(project)))
|
|
175019
|
+
return; // Can loop forever without this (enqueue here, dequeue above, repeat)
|
|
175020
|
+
var location = mapDefinitionInProject(defaultDefinition, project, getGeneratedDefinition, getSourceDefinition);
|
|
175021
|
+
if (location) {
|
|
175022
|
+
queue.push({ project: project, location: location });
|
|
174839
175023
|
}
|
|
174840
175024
|
});
|
|
174841
175025
|
}
|
|
174842
175026
|
}
|
|
174843
|
-
|
|
174844
|
-
|
|
174845
|
-
|
|
174846
|
-
|
|
175027
|
+
// In the common case where there's only one project, return a simpler result to make
|
|
175028
|
+
// it easier for the caller to skip post-processing.
|
|
175029
|
+
if (searchedProjects.size === 1) {
|
|
175030
|
+
var it = resultsMap.values().next();
|
|
175031
|
+
ts.Debug.assert(!it.done);
|
|
175032
|
+
return it.value;
|
|
175033
|
+
}
|
|
175034
|
+
return resultsMap;
|
|
175035
|
+
// May enqueue to otherPositionQueue
|
|
175036
|
+
function searchPosition(project, location) {
|
|
175037
|
+
var projectResults = getResultsForPosition(project, location);
|
|
175038
|
+
if (!projectResults)
|
|
175039
|
+
return undefined;
|
|
175040
|
+
for (var _i = 0, projectResults_4 = projectResults; _i < projectResults_4.length; _i++) {
|
|
175041
|
+
var result = projectResults_4[_i];
|
|
175042
|
+
forPositionInResult(result, function (position) {
|
|
175043
|
+
// This may trigger a search for a tsconfig, but there are several layers of caching that make it inexpensive
|
|
175044
|
+
var originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(project, position);
|
|
175045
|
+
if (!originalLocation)
|
|
175046
|
+
return;
|
|
175047
|
+
var originalScriptInfo = projectService.getScriptInfo(originalLocation.fileName);
|
|
175048
|
+
for (var _i = 0, _a = originalScriptInfo.containingProjects; _i < _a.length; _i++) {
|
|
175049
|
+
var project_1 = _a[_i];
|
|
175050
|
+
if (!project_1.isOrphan()) {
|
|
175051
|
+
queue.push({ project: project_1, location: originalLocation });
|
|
175052
|
+
}
|
|
175053
|
+
}
|
|
175054
|
+
var symlinkedProjectsMap = projectService.getSymlinkedProjects(originalScriptInfo);
|
|
175055
|
+
if (symlinkedProjectsMap) {
|
|
175056
|
+
symlinkedProjectsMap.forEach(function (symlinkedProjects, symlinkedPath) {
|
|
175057
|
+
for (var _i = 0, symlinkedProjects_2 = symlinkedProjects; _i < symlinkedProjects_2.length; _i++) {
|
|
175058
|
+
var symlinkedProject = symlinkedProjects_2[_i];
|
|
175059
|
+
if (!symlinkedProject.isOrphan()) {
|
|
175060
|
+
queue.push({ project: symlinkedProject, location: { fileName: symlinkedPath, pos: originalLocation.pos } });
|
|
175061
|
+
}
|
|
175062
|
+
}
|
|
175063
|
+
});
|
|
175064
|
+
}
|
|
175065
|
+
});
|
|
175066
|
+
}
|
|
175067
|
+
return projectResults;
|
|
174847
175068
|
}
|
|
174848
175069
|
}
|
|
174849
175070
|
function mapDefinitionInProject(definition, project, getGeneratedDefinition, getSourceDefinition) {
|
|
@@ -174874,43 +175095,6 @@ var ts;
|
|
|
174874
175095
|
sourceFile.resolvedPath !== sourceFile.path &&
|
|
174875
175096
|
sourceFile.resolvedPath !== project.toPath(location.fileName);
|
|
174876
175097
|
}
|
|
174877
|
-
function callbackProjectAndLocation(project, location, projectService, toDo, seenProjects, cb) {
|
|
174878
|
-
if (project.getCancellationToken().isCancellationRequested())
|
|
174879
|
-
return undefined; // Skip rest of toDo if cancelled
|
|
174880
|
-
// If this is not the file we were actually looking, return rest of the toDo
|
|
174881
|
-
if (isLocationProjectReferenceRedirect(project, location))
|
|
174882
|
-
return toDo;
|
|
174883
|
-
cb(project, location, function (innerProject, location) {
|
|
174884
|
-
addToSeen(seenProjects, project);
|
|
174885
|
-
var originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(innerProject, location);
|
|
174886
|
-
if (!originalLocation)
|
|
174887
|
-
return undefined;
|
|
174888
|
-
var originalScriptInfo = projectService.getScriptInfo(originalLocation.fileName);
|
|
174889
|
-
toDo = toDo || [];
|
|
174890
|
-
for (var _i = 0, _a = originalScriptInfo.containingProjects; _i < _a.length; _i++) {
|
|
174891
|
-
var project_1 = _a[_i];
|
|
174892
|
-
addToTodo(project_1, originalLocation, toDo, seenProjects);
|
|
174893
|
-
}
|
|
174894
|
-
var symlinkedProjectsMap = projectService.getSymlinkedProjects(originalScriptInfo);
|
|
174895
|
-
if (symlinkedProjectsMap) {
|
|
174896
|
-
symlinkedProjectsMap.forEach(function (symlinkedProjects, symlinkedPath) {
|
|
174897
|
-
for (var _i = 0, symlinkedProjects_2 = symlinkedProjects; _i < symlinkedProjects_2.length; _i++) {
|
|
174898
|
-
var symlinkedProject = symlinkedProjects_2[_i];
|
|
174899
|
-
addToTodo(symlinkedProject, { fileName: symlinkedPath, pos: originalLocation.pos }, toDo, seenProjects);
|
|
174900
|
-
}
|
|
174901
|
-
});
|
|
174902
|
-
}
|
|
174903
|
-
return originalLocation === location ? undefined : originalLocation;
|
|
174904
|
-
});
|
|
174905
|
-
return toDo;
|
|
174906
|
-
}
|
|
174907
|
-
function addToTodo(project, location, toDo, seenProjects) {
|
|
174908
|
-
if (!project.isOrphan() && addToSeen(seenProjects, project))
|
|
174909
|
-
toDo.push({ project: project, location: location });
|
|
174910
|
-
}
|
|
174911
|
-
function addToSeen(seenProjects, project) {
|
|
174912
|
-
return ts.tryAddToSet(seenProjects, getProjectKey(project));
|
|
174913
|
-
}
|
|
174914
175098
|
function getProjectKey(project) {
|
|
174915
175099
|
return server.isConfiguredProject(project) ? project.canonicalConfigFilePath : project.getProjectName();
|
|
174916
175100
|
}
|
|
@@ -174918,32 +175102,14 @@ var ts;
|
|
|
174918
175102
|
var fileName = _a.fileName, textSpan = _a.textSpan;
|
|
174919
175103
|
return { fileName: fileName, pos: textSpan.start };
|
|
174920
175104
|
}
|
|
174921
|
-
function
|
|
174922
|
-
|
|
174923
|
-
return mapsTo && project.projectService.fileExists(server.toNormalizedPath(mapsTo.fileName)) ? mapsTo : undefined;
|
|
175105
|
+
function getMappedLocationForProject(location, project) {
|
|
175106
|
+
return ts.getMappedLocation(location, project.getSourceMapper(), function (p) { return project.projectService.fileExists(p); });
|
|
174924
175107
|
}
|
|
174925
|
-
function
|
|
174926
|
-
|
|
174927
|
-
if (!newPosition)
|
|
174928
|
-
return undefined;
|
|
174929
|
-
return {
|
|
174930
|
-
fileName: newPosition.fileName,
|
|
174931
|
-
textSpan: {
|
|
174932
|
-
start: newPosition.pos,
|
|
174933
|
-
length: documentSpan.textSpan.length
|
|
174934
|
-
},
|
|
174935
|
-
originalFileName: documentSpan.fileName,
|
|
174936
|
-
originalTextSpan: documentSpan.textSpan,
|
|
174937
|
-
contextSpan: getMappedContextSpan(documentSpan, project),
|
|
174938
|
-
originalContextSpan: documentSpan.contextSpan
|
|
174939
|
-
};
|
|
175108
|
+
function getMappedDocumentSpanForProject(documentSpan, project) {
|
|
175109
|
+
return ts.getMappedDocumentSpan(documentSpan, project.getSourceMapper(), function (p) { return project.projectService.fileExists(p); });
|
|
174940
175110
|
}
|
|
174941
|
-
function
|
|
174942
|
-
|
|
174943
|
-
var contextSpanEnd = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start + documentSpan.contextSpan.length }, project);
|
|
174944
|
-
return contextSpanStart && contextSpanEnd ?
|
|
174945
|
-
{ start: contextSpanStart.pos, length: contextSpanEnd.pos - contextSpanStart.pos } :
|
|
174946
|
-
undefined;
|
|
175111
|
+
function getMappedContextSpanForProject(documentSpan, project) {
|
|
175112
|
+
return ts.getMappedContextSpan(documentSpan, project.getSourceMapper(), function (p) { return project.projectService.fileExists(p); });
|
|
174947
175113
|
}
|
|
174948
175114
|
var invalidPartialSemanticModeCommands = [
|
|
174949
175115
|
server.CommandNames.OpenExternalProject,
|
|
@@ -175836,7 +176002,7 @@ var ts;
|
|
|
175836
176002
|
};
|
|
175837
176003
|
Session.prototype.mapDefinitionInfoLocations = function (definitions, project) {
|
|
175838
176004
|
return definitions.map(function (info) {
|
|
175839
|
-
var newDocumentSpan =
|
|
176005
|
+
var newDocumentSpan = getMappedDocumentSpanForProject(info, project);
|
|
175840
176006
|
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 });
|
|
175841
176007
|
});
|
|
175842
176008
|
};
|
|
@@ -176081,7 +176247,7 @@ var ts;
|
|
|
176081
176247
|
};
|
|
176082
176248
|
Session.prototype.mapImplementationLocations = function (implementations, project) {
|
|
176083
176249
|
return implementations.map(function (info) {
|
|
176084
|
-
var newDocumentSpan =
|
|
176250
|
+
var newDocumentSpan = getMappedDocumentSpanForProject(info, project);
|
|
176085
176251
|
return !newDocumentSpan ? info : __assign(__assign({}, newDocumentSpan), { kind: info.kind, displayParts: info.displayParts });
|
|
176086
176252
|
});
|
|
176087
176253
|
};
|
|
@@ -176238,7 +176404,7 @@ var ts;
|
|
|
176238
176404
|
var renameInfo = this.mapRenameInfo(defaultProject.getLanguageService().getRenameInfo(file, position, { allowRenameOfImportPath: this.getPreferences(file).allowRenameOfImportPath }), ts.Debug.checkDefined(this.projectService.getScriptInfo(file)));
|
|
176239
176405
|
if (!renameInfo.canRename)
|
|
176240
176406
|
return simplifiedResult ? { info: renameInfo, locs: [] } : [];
|
|
176241
|
-
var locations =
|
|
176407
|
+
var locations = getRenameLocationsWorker(projects, defaultProject, { fileName: args.file, pos: position }, !!args.findInStrings, !!args.findInComments, this.getPreferences(file));
|
|
176242
176408
|
if (!simplifiedResult)
|
|
176243
176409
|
return locations;
|
|
176244
176410
|
return { info: renameInfo, locs: this.toSpanGroups(locations) };
|
|
@@ -176270,7 +176436,7 @@ var ts;
|
|
|
176270
176436
|
var file = server.toNormalizedPath(args.file);
|
|
176271
176437
|
var projects = this.getProjects(args);
|
|
176272
176438
|
var position = this.getPositionInFile(args, file);
|
|
176273
|
-
var references =
|
|
176439
|
+
var references = getReferencesWorker(projects, this.getDefaultProject(args), { fileName: args.file, pos: position }, this.logger);
|
|
176274
176440
|
if (!simplifiedResult)
|
|
176275
176441
|
return references;
|
|
176276
176442
|
var defaultProject = this.getDefaultProject(args);
|
|
@@ -176296,8 +176462,8 @@ var ts;
|
|
|
176296
176462
|
return;
|
|
176297
176463
|
var projectOutputs = project.getLanguageService().getFileReferences(fileName);
|
|
176298
176464
|
if (projectOutputs) {
|
|
176299
|
-
for (var _i = 0,
|
|
176300
|
-
var referenceEntry =
|
|
176465
|
+
for (var _i = 0, projectOutputs_1 = projectOutputs; _i < projectOutputs_1.length; _i++) {
|
|
176466
|
+
var referenceEntry = projectOutputs_1[_i];
|
|
176301
176467
|
if (!seen.has(referenceEntry)) {
|
|
176302
176468
|
references.push(referenceEntry);
|
|
176303
176469
|
seen.add(referenceEntry);
|
|
@@ -176762,7 +176928,8 @@ var ts;
|
|
|
176762
176928
|
// `name` is a very cheap hash function, but we could incorporate other properties to reduce collisions.
|
|
176763
176929
|
var seenItems = new ts.Map(); // name to items with that name
|
|
176764
176930
|
if (!args.file && !projectFileName) {
|
|
176765
|
-
// VS Code's `Go to symbol in workspaces` sends request like this
|
|
176931
|
+
// VS Code's `Go to symbol in workspaces` sends request like this by default.
|
|
176932
|
+
// There's a setting to have it send a file name (reverting to older behavior).
|
|
176766
176933
|
// TODO (https://github.com/microsoft/TypeScript/issues/47839)
|
|
176767
176934
|
// This appears to have been intended to search all projects but, in practice, it seems to only search
|
|
176768
176935
|
// those that are downstream from already-loaded projects.
|
|
@@ -176783,7 +176950,7 @@ var ts;
|
|
|
176783
176950
|
// Mutates `outputs`
|
|
176784
176951
|
function addItemsForProject(project) {
|
|
176785
176952
|
var projectItems = project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, /*filename*/ undefined, /*excludeDts*/ project.isNonTsProject());
|
|
176786
|
-
var unseenItems = ts.filter(projectItems, function (item) { return tryAddSeenItem(item) && !
|
|
176953
|
+
var unseenItems = ts.filter(projectItems, function (item) { return tryAddSeenItem(item) && !getMappedLocationForProject(documentSpanLocation(item), project); });
|
|
176787
176954
|
if (unseenItems.length) {
|
|
176788
176955
|
outputs.push({ project: project, navigateToItems: unseenItems });
|
|
176789
176956
|
}
|