typescript 4.2.0-dev.20210209 → 4.2.3
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 +2 -235
- package/lib/protocol.d.ts +63 -0
- package/lib/tsc.js +38 -18
- package/lib/tsserver.js +141 -30
- package/lib/tsserverlibrary.d.ts +62 -0
- package/lib/tsserverlibrary.js +141 -30
- package/lib/typescript.js +109 -30
- package/lib/typescriptServices.js +109 -30
- package/lib/typingsInstaller.js +44 -21
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -96,7 +96,7 @@ var ts;
|
|
|
96
96
|
// The following is baselined as a literal template type without intervention
|
|
97
97
|
/** The version of the TypeScript compiler release */
|
|
98
98
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
99
|
-
ts.version =
|
|
99
|
+
ts.version = "4.2.3";
|
|
100
100
|
/* @internal */
|
|
101
101
|
var Comparison;
|
|
102
102
|
(function (Comparison) {
|
|
@@ -47044,13 +47044,17 @@ var ts;
|
|
|
47044
47044
|
return result || ts.emptyArray;
|
|
47045
47045
|
}
|
|
47046
47046
|
function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {
|
|
47047
|
-
|
|
47048
|
-
|
|
47049
|
-
|
|
47050
|
-
|
|
47051
|
-
|
|
47052
|
-
|
|
47053
|
-
|
|
47047
|
+
var resolved = type;
|
|
47048
|
+
resolved.members = members;
|
|
47049
|
+
resolved.properties = ts.emptyArray;
|
|
47050
|
+
resolved.callSignatures = callSignatures;
|
|
47051
|
+
resolved.constructSignatures = constructSignatures;
|
|
47052
|
+
resolved.stringIndexInfo = stringIndexInfo;
|
|
47053
|
+
resolved.numberIndexInfo = numberIndexInfo;
|
|
47054
|
+
// This can loop back to getPropertyOfType() which would crash if `callSignatures` & `constructSignatures` are not initialized.
|
|
47055
|
+
if (members !== emptySymbols)
|
|
47056
|
+
resolved.properties = getNamedMembers(members);
|
|
47057
|
+
return resolved;
|
|
47054
47058
|
}
|
|
47055
47059
|
function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {
|
|
47056
47060
|
return setStructuredTypeMembers(createObjectType(16 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);
|
|
@@ -55677,7 +55681,7 @@ var ts;
|
|
|
55677
55681
|
}
|
|
55678
55682
|
return true;
|
|
55679
55683
|
}
|
|
55680
|
-
function removeRedundantLiteralTypes(types, includes) {
|
|
55684
|
+
function removeRedundantLiteralTypes(types, includes, reduceVoidUndefined) {
|
|
55681
55685
|
var i = types.length;
|
|
55682
55686
|
while (i > 0) {
|
|
55683
55687
|
i--;
|
|
@@ -55687,7 +55691,7 @@ var ts;
|
|
|
55687
55691
|
flags & 256 /* NumberLiteral */ && includes & 8 /* Number */ ||
|
|
55688
55692
|
flags & 2048 /* BigIntLiteral */ && includes & 64 /* BigInt */ ||
|
|
55689
55693
|
flags & 8192 /* UniqueESSymbol */ && includes & 4096 /* ESSymbol */ ||
|
|
55690
|
-
flags & 32768 /* Undefined */ && includes & 16384 /* Void */ ||
|
|
55694
|
+
reduceVoidUndefined && flags & 32768 /* Undefined */ && includes & 16384 /* Void */ ||
|
|
55691
55695
|
isFreshLiteralType(t) && containsType(types, t.regularType);
|
|
55692
55696
|
if (remove) {
|
|
55693
55697
|
ts.orderedRemoveItemAt(types, i);
|
|
@@ -55719,7 +55723,7 @@ var ts;
|
|
|
55719
55723
|
if (t.flags & 1048576 /* Union */) {
|
|
55720
55724
|
var origin = t.origin;
|
|
55721
55725
|
if (t.aliasSymbol || origin && !(origin.flags & 1048576 /* Union */)) {
|
|
55722
|
-
|
|
55726
|
+
ts.pushIfUnique(namedUnions, t);
|
|
55723
55727
|
}
|
|
55724
55728
|
else if (origin && origin.flags & 1048576 /* Union */) {
|
|
55725
55729
|
addNamedUnions(namedUnions, origin.types);
|
|
@@ -55755,7 +55759,7 @@ var ts;
|
|
|
55755
55759
|
}
|
|
55756
55760
|
if (unionReduction & (1 /* Literal */ | 2 /* Subtype */)) {
|
|
55757
55761
|
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
55758
|
-
removeRedundantLiteralTypes(typeSet, includes);
|
|
55762
|
+
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
55759
55763
|
}
|
|
55760
55764
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
55761
55765
|
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
|
|
@@ -63776,7 +63780,16 @@ var ts;
|
|
|
63776
63780
|
var type = getTypeOfDottedName(node.expression, diagnostic);
|
|
63777
63781
|
if (type) {
|
|
63778
63782
|
var name = node.name;
|
|
63779
|
-
var prop =
|
|
63783
|
+
var prop = void 0;
|
|
63784
|
+
if (ts.isPrivateIdentifier(name)) {
|
|
63785
|
+
if (!type.symbol) {
|
|
63786
|
+
return undefined;
|
|
63787
|
+
}
|
|
63788
|
+
prop = getPropertyOfType(type, ts.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText));
|
|
63789
|
+
}
|
|
63790
|
+
else {
|
|
63791
|
+
prop = getPropertyOfType(type, name.escapedText);
|
|
63792
|
+
}
|
|
63780
63793
|
return prop && getExplicitTypeOfSymbol(prop, diagnostic);
|
|
63781
63794
|
}
|
|
63782
63795
|
return undefined;
|
|
@@ -64842,10 +64855,15 @@ var ts;
|
|
|
64842
64855
|
return assignableType;
|
|
64843
64856
|
}
|
|
64844
64857
|
}
|
|
64845
|
-
// If the candidate type is a subtype of the target type, narrow to the candidate type
|
|
64846
|
-
// if the target type is
|
|
64847
|
-
//
|
|
64848
|
-
|
|
64858
|
+
// If the candidate type is a subtype of the target type, narrow to the candidate type.
|
|
64859
|
+
// Otherwise, if the target type is assignable to the candidate type, keep the target type.
|
|
64860
|
+
// Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
|
|
64861
|
+
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
|
|
64862
|
+
// two types.
|
|
64863
|
+
return isTypeSubtypeOf(candidate, type) ? candidate :
|
|
64864
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
64865
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
64866
|
+
getIntersectionType([type, candidate]);
|
|
64849
64867
|
}
|
|
64850
64868
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
64851
64869
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -75188,7 +75206,9 @@ var ts;
|
|
|
75188
75206
|
: ts.isPropertyAccessExpression(location) ? location.name
|
|
75189
75207
|
: ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
|
|
75190
75208
|
: undefined;
|
|
75191
|
-
|
|
75209
|
+
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location)
|
|
75210
|
+
&& ts.isAssertionExpression(ts.skipParentheses(location.expression));
|
|
75211
|
+
if (!testedNode || isPropertyExpressionCast) {
|
|
75192
75212
|
return;
|
|
75193
75213
|
}
|
|
75194
75214
|
var possiblyFalsy = getFalsyFlags(type);
|
|
@@ -77338,6 +77358,7 @@ var ts;
|
|
|
77338
77358
|
return true;
|
|
77339
77359
|
}
|
|
77340
77360
|
function checkAliasSymbol(node) {
|
|
77361
|
+
var _a;
|
|
77341
77362
|
var symbol = getSymbolOfNode(node);
|
|
77342
77363
|
var target = resolveAlias(symbol);
|
|
77343
77364
|
if (target !== unknownSymbol) {
|
|
@@ -77365,7 +77386,7 @@ var ts;
|
|
|
77365
77386
|
&& !(node.flags & 8388608 /* Ambient */)) {
|
|
77366
77387
|
error(node, ts.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type);
|
|
77367
77388
|
}
|
|
77368
|
-
if (ts.isImportSpecifier(node) &&
|
|
77389
|
+
if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
|
|
77369
77390
|
addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
|
|
77370
77391
|
}
|
|
77371
77392
|
}
|
|
@@ -111470,10 +111491,11 @@ var ts;
|
|
|
111470
111491
|
var redirects = host.redirectTargetsMap.get(importedPath) || ts.emptyArray;
|
|
111471
111492
|
var importedFileNames = __spreadArray(__spreadArray(__spreadArray([], (referenceRedirect ? [referenceRedirect] : ts.emptyArray)), [importedFileName]), redirects);
|
|
111472
111493
|
var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
|
|
111494
|
+
var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
|
|
111473
111495
|
if (!preferSymlinks) {
|
|
111474
111496
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
111475
111497
|
// so we only need to remove them from the realpath filenames.
|
|
111476
|
-
var result_15 = ts.forEach(targets, function (p) { return !ts.containsIgnoredPath(p) && cb(p, referenceRedirect === p); });
|
|
111498
|
+
var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
111477
111499
|
if (result_15)
|
|
111478
111500
|
return result_15;
|
|
111479
111501
|
}
|
|
@@ -111499,13 +111521,14 @@ var ts;
|
|
|
111499
111521
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
111500
111522
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
111501
111523
|
var result_16 = cb(option, target === referenceRedirect);
|
|
111524
|
+
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
111502
111525
|
if (result_16)
|
|
111503
111526
|
return result_16;
|
|
111504
111527
|
}
|
|
111505
111528
|
});
|
|
111506
111529
|
});
|
|
111507
111530
|
return result || (preferSymlinks
|
|
111508
|
-
? ts.forEach(targets, function (p) { return ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
|
|
111531
|
+
? ts.forEach(targets, function (p) { return shouldFilterIgnoredPaths && ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
|
|
111509
111532
|
: undefined);
|
|
111510
111533
|
}
|
|
111511
111534
|
moduleSpecifiers.forEachFileNameOfModule = forEachFileNameOfModule;
|
|
@@ -139580,7 +139603,7 @@ var ts;
|
|
|
139580
139603
|
}
|
|
139581
139604
|
function addFunctionDeclaration(changes, context, info) {
|
|
139582
139605
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
139583
|
-
var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(251 /* FunctionDeclaration */, context, importAdder, info.call, info.token, info.modifierFlags, info.parentDeclaration);
|
|
139606
|
+
var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(251 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration);
|
|
139584
139607
|
changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
|
|
139585
139608
|
}
|
|
139586
139609
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
@@ -146961,13 +146984,13 @@ var ts;
|
|
|
146961
146984
|
return { edits: [] }; // TODO: GH#30113
|
|
146962
146985
|
}
|
|
146963
146986
|
function doChange(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
|
|
146964
|
-
var
|
|
146965
|
-
|
|
146966
|
-
|
|
146967
|
-
|
|
146968
|
-
|
|
146969
|
-
|
|
146970
|
-
|
|
146987
|
+
var signature = groupedReferences.signature;
|
|
146988
|
+
var newFunctionDeclarationParams = ts.map(createNewParameters(functionDeclaration, program, host), function (param) { return ts.getSynthesizedDeepClone(param); });
|
|
146989
|
+
if (signature) {
|
|
146990
|
+
var newSignatureParams = ts.map(createNewParameters(signature, program, host), function (param) { return ts.getSynthesizedDeepClone(param); });
|
|
146991
|
+
replaceParameters(signature, newSignatureParams);
|
|
146992
|
+
}
|
|
146993
|
+
replaceParameters(functionDeclaration, newFunctionDeclarationParams);
|
|
146971
146994
|
var functionCalls = ts.sortAndDeduplicate(groupedReferences.functionCalls, /*comparer*/ function (a, b) { return ts.compareValues(a.pos, b.pos); });
|
|
146972
146995
|
for (var _i = 0, functionCalls_1 = functionCalls; _i < functionCalls_1.length; _i++) {
|
|
146973
146996
|
var call = functionCalls_1[_i];
|
|
@@ -146976,6 +146999,15 @@ var ts;
|
|
|
146976
146999
|
changes.replaceNodeRange(ts.getSourceFileOfNode(call), ts.first(call.arguments), ts.last(call.arguments), newArgument, { leadingTriviaOption: ts.textChanges.LeadingTriviaOption.IncludeAll, trailingTriviaOption: ts.textChanges.TrailingTriviaOption.Include });
|
|
146977
147000
|
}
|
|
146978
147001
|
}
|
|
147002
|
+
function replaceParameters(declarationOrSignature, parameterDeclarations) {
|
|
147003
|
+
changes.replaceNodeRangeWithNodes(sourceFile, ts.first(declarationOrSignature.parameters), ts.last(declarationOrSignature.parameters), parameterDeclarations, {
|
|
147004
|
+
joiner: ", ",
|
|
147005
|
+
// indentation is set to 0 because otherwise the object parameter will be indented if there is a `this` parameter
|
|
147006
|
+
indentation: 0,
|
|
147007
|
+
leadingTriviaOption: ts.textChanges.LeadingTriviaOption.IncludeAll,
|
|
147008
|
+
trailingTriviaOption: ts.textChanges.TrailingTriviaOption.Include
|
|
147009
|
+
});
|
|
147010
|
+
}
|
|
146979
147011
|
}
|
|
146980
147012
|
function getGroupedReferences(functionDeclaration, program, cancellationToken) {
|
|
146981
147013
|
var functionNames = getFunctionNames(functionDeclaration);
|
|
@@ -146994,12 +147026,38 @@ var ts;
|
|
|
146994
147026
|
var functionSymbols = ts.map(functionNames, getSymbolTargetAtLocation);
|
|
146995
147027
|
var classSymbols = ts.map(classNames, getSymbolTargetAtLocation);
|
|
146996
147028
|
var isConstructor = ts.isConstructorDeclaration(functionDeclaration);
|
|
147029
|
+
var contextualSymbols = ts.map(functionNames, function (name) { return getSymbolForContextualType(name, checker); });
|
|
146997
147030
|
for (var _i = 0, referenceEntries_1 = referenceEntries; _i < referenceEntries_1.length; _i++) {
|
|
146998
147031
|
var entry = referenceEntries_1[_i];
|
|
146999
|
-
if (entry.kind
|
|
147032
|
+
if (entry.kind === 0 /* Span */) {
|
|
147000
147033
|
groupedReferences.valid = false;
|
|
147001
147034
|
continue;
|
|
147002
147035
|
}
|
|
147036
|
+
/* Declarations in object literals may be implementations of method signatures which have a different symbol from the declaration
|
|
147037
|
+
For example:
|
|
147038
|
+
interface IFoo { m(a: number): void }
|
|
147039
|
+
const foo: IFoo = { m(a: number): void {} }
|
|
147040
|
+
In these cases we get the symbol for the signature from the contextual type.
|
|
147041
|
+
*/
|
|
147042
|
+
if (ts.contains(contextualSymbols, getSymbolTargetAtLocation(entry.node))) {
|
|
147043
|
+
if (isValidMethodSignature(entry.node.parent)) {
|
|
147044
|
+
groupedReferences.signature = entry.node.parent;
|
|
147045
|
+
continue;
|
|
147046
|
+
}
|
|
147047
|
+
var call = entryToFunctionCall(entry);
|
|
147048
|
+
if (call) {
|
|
147049
|
+
groupedReferences.functionCalls.push(call);
|
|
147050
|
+
continue;
|
|
147051
|
+
}
|
|
147052
|
+
}
|
|
147053
|
+
var contextualSymbol = getSymbolForContextualType(entry.node, checker);
|
|
147054
|
+
if (contextualSymbol && ts.contains(contextualSymbols, contextualSymbol)) {
|
|
147055
|
+
var decl = entryToDeclaration(entry);
|
|
147056
|
+
if (decl) {
|
|
147057
|
+
groupedReferences.declarations.push(decl);
|
|
147058
|
+
continue;
|
|
147059
|
+
}
|
|
147060
|
+
}
|
|
147003
147061
|
/* We compare symbols because in some cases find all references wil return a reference that may or may not be to the refactored function.
|
|
147004
147062
|
Example from the refactorConvertParamsToDestructuredObject_methodCallUnion.ts test:
|
|
147005
147063
|
class A { foo(a: number, b: number) { return a + b; } }
|
|
@@ -147062,6 +147120,19 @@ var ts;
|
|
|
147062
147120
|
return symbol && ts.getSymbolTarget(symbol, checker);
|
|
147063
147121
|
}
|
|
147064
147122
|
}
|
|
147123
|
+
/**
|
|
147124
|
+
* Gets the symbol for the contextual type of the node if it is not a union or intersection.
|
|
147125
|
+
*/
|
|
147126
|
+
function getSymbolForContextualType(node, checker) {
|
|
147127
|
+
var element = ts.getContainingObjectLiteralElement(node);
|
|
147128
|
+
if (element) {
|
|
147129
|
+
var contextualType = checker.getContextualTypeForObjectLiteralElement(element);
|
|
147130
|
+
var symbol = contextualType === null || contextualType === void 0 ? void 0 : contextualType.getSymbol();
|
|
147131
|
+
if (symbol && !(ts.getCheckFlags(symbol) & 6 /* Synthetic */)) {
|
|
147132
|
+
return symbol;
|
|
147133
|
+
}
|
|
147134
|
+
}
|
|
147135
|
+
}
|
|
147065
147136
|
function entryToImportOrExport(entry) {
|
|
147066
147137
|
var node = entry.node;
|
|
147067
147138
|
if (ts.isImportSpecifier(node.parent)
|
|
@@ -147169,6 +147240,9 @@ var ts;
|
|
|
147169
147240
|
}
|
|
147170
147241
|
return false;
|
|
147171
147242
|
}
|
|
147243
|
+
function isValidMethodSignature(node) {
|
|
147244
|
+
return ts.isMethodSignature(node) && (ts.isInterfaceDeclaration(node.parent) || ts.isTypeLiteralNode(node.parent));
|
|
147245
|
+
}
|
|
147172
147246
|
function isValidFunctionDeclaration(functionDeclaration, checker) {
|
|
147173
147247
|
if (!isValidParameterNodeArray(functionDeclaration.parameters, checker))
|
|
147174
147248
|
return false;
|
|
@@ -147176,6 +147250,11 @@ var ts;
|
|
|
147176
147250
|
case 251 /* FunctionDeclaration */:
|
|
147177
147251
|
return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker);
|
|
147178
147252
|
case 165 /* MethodDeclaration */:
|
|
147253
|
+
if (ts.isObjectLiteralExpression(functionDeclaration.parent)) {
|
|
147254
|
+
var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker);
|
|
147255
|
+
// don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change
|
|
147256
|
+
return (contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations.length) === 1 && isSingleImplementation(functionDeclaration, checker);
|
|
147257
|
+
}
|
|
147179
147258
|
return isSingleImplementation(functionDeclaration, checker);
|
|
147180
147259
|
case 166 /* Constructor */:
|
|
147181
147260
|
if (ts.isClassDeclaration(functionDeclaration.parent)) {
|
|
@@ -152466,6 +152545,34 @@ var ts;
|
|
|
152466
152545
|
ScriptTarget["ES2020"] = "ES2020";
|
|
152467
152546
|
ScriptTarget["ESNext"] = "ESNext";
|
|
152468
152547
|
})(ScriptTarget = protocol.ScriptTarget || (protocol.ScriptTarget = {}));
|
|
152548
|
+
var ClassificationType;
|
|
152549
|
+
(function (ClassificationType) {
|
|
152550
|
+
ClassificationType[ClassificationType["comment"] = 1] = "comment";
|
|
152551
|
+
ClassificationType[ClassificationType["identifier"] = 2] = "identifier";
|
|
152552
|
+
ClassificationType[ClassificationType["keyword"] = 3] = "keyword";
|
|
152553
|
+
ClassificationType[ClassificationType["numericLiteral"] = 4] = "numericLiteral";
|
|
152554
|
+
ClassificationType[ClassificationType["operator"] = 5] = "operator";
|
|
152555
|
+
ClassificationType[ClassificationType["stringLiteral"] = 6] = "stringLiteral";
|
|
152556
|
+
ClassificationType[ClassificationType["regularExpressionLiteral"] = 7] = "regularExpressionLiteral";
|
|
152557
|
+
ClassificationType[ClassificationType["whiteSpace"] = 8] = "whiteSpace";
|
|
152558
|
+
ClassificationType[ClassificationType["text"] = 9] = "text";
|
|
152559
|
+
ClassificationType[ClassificationType["punctuation"] = 10] = "punctuation";
|
|
152560
|
+
ClassificationType[ClassificationType["className"] = 11] = "className";
|
|
152561
|
+
ClassificationType[ClassificationType["enumName"] = 12] = "enumName";
|
|
152562
|
+
ClassificationType[ClassificationType["interfaceName"] = 13] = "interfaceName";
|
|
152563
|
+
ClassificationType[ClassificationType["moduleName"] = 14] = "moduleName";
|
|
152564
|
+
ClassificationType[ClassificationType["typeParameterName"] = 15] = "typeParameterName";
|
|
152565
|
+
ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName";
|
|
152566
|
+
ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName";
|
|
152567
|
+
ClassificationType[ClassificationType["docCommentTagName"] = 18] = "docCommentTagName";
|
|
152568
|
+
ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName";
|
|
152569
|
+
ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName";
|
|
152570
|
+
ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName";
|
|
152571
|
+
ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute";
|
|
152572
|
+
ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText";
|
|
152573
|
+
ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue";
|
|
152574
|
+
ClassificationType[ClassificationType["bigintLiteral"] = 25] = "bigintLiteral";
|
|
152575
|
+
})(ClassificationType = protocol.ClassificationType || (protocol.ClassificationType = {}));
|
|
152469
152576
|
})(protocol = server.protocol || (server.protocol = {}));
|
|
152470
152577
|
})(server = ts.server || (ts.server = {}));
|
|
152471
152578
|
})(ts || (ts = {}));
|
|
@@ -154415,6 +154522,10 @@ var ts;
|
|
|
154415
154522
|
Project.prototype.enablePlugin = function (pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
154416
154523
|
var _this = this;
|
|
154417
154524
|
this.projectService.logger.info("Enabling plugin " + pluginConfigEntry.name + " from candidate paths: " + searchPaths.join(","));
|
|
154525
|
+
if (!pluginConfigEntry.name || ts.parsePackageName(pluginConfigEntry.name).rest) {
|
|
154526
|
+
this.projectService.logger.info("Skipped loading plugin " + (pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)) + " because only package name is allowed plugin name");
|
|
154527
|
+
return;
|
|
154528
|
+
}
|
|
154418
154529
|
var log = function (message) { return _this.projectService.logger.info(message); };
|
|
154419
154530
|
var errorLogs;
|
|
154420
154531
|
var logError = function (message) { (errorLogs || (errorLogs = [])).push(message); };
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -7136,6 +7136,41 @@ declare namespace ts.server.protocol {
|
|
|
7136
7136
|
*/
|
|
7137
7137
|
body?: string[];
|
|
7138
7138
|
}
|
|
7139
|
+
/**
|
|
7140
|
+
* A request to get encoded semantic classifications for a span in the file
|
|
7141
|
+
*/
|
|
7142
|
+
interface EncodedSemanticClassificationsRequest extends FileRequest {
|
|
7143
|
+
arguments: EncodedSemanticClassificationsRequestArgs;
|
|
7144
|
+
}
|
|
7145
|
+
/**
|
|
7146
|
+
* Arguments for EncodedSemanticClassificationsRequest request.
|
|
7147
|
+
*/
|
|
7148
|
+
interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
|
|
7149
|
+
/**
|
|
7150
|
+
* Start position of the span.
|
|
7151
|
+
*/
|
|
7152
|
+
start: number;
|
|
7153
|
+
/**
|
|
7154
|
+
* Length of the span.
|
|
7155
|
+
*/
|
|
7156
|
+
length: number;
|
|
7157
|
+
/**
|
|
7158
|
+
* Optional parameter for the semantic highlighting response, if absent it
|
|
7159
|
+
* defaults to "original".
|
|
7160
|
+
*/
|
|
7161
|
+
format?: "original" | "2020";
|
|
7162
|
+
}
|
|
7163
|
+
/** The response for a EncodedSemanticClassificationsRequest */
|
|
7164
|
+
interface EncodedSemanticClassificationsResponse extends Response {
|
|
7165
|
+
body?: EncodedSemanticClassificationsResponseBody;
|
|
7166
|
+
}
|
|
7167
|
+
/**
|
|
7168
|
+
* Implementation response message. Gives series of text spans depending on the format ar.
|
|
7169
|
+
*/
|
|
7170
|
+
interface EncodedSemanticClassificationsResponseBody {
|
|
7171
|
+
endOfLineState: EndOfLineState;
|
|
7172
|
+
spans: number[];
|
|
7173
|
+
}
|
|
7139
7174
|
/**
|
|
7140
7175
|
* Arguments in document highlight request; include: filesToSearch, file,
|
|
7141
7176
|
* line, offset.
|
|
@@ -9159,6 +9194,33 @@ declare namespace ts.server.protocol {
|
|
|
9159
9194
|
ES2020 = "ES2020",
|
|
9160
9195
|
ESNext = "ESNext"
|
|
9161
9196
|
}
|
|
9197
|
+
enum ClassificationType {
|
|
9198
|
+
comment = 1,
|
|
9199
|
+
identifier = 2,
|
|
9200
|
+
keyword = 3,
|
|
9201
|
+
numericLiteral = 4,
|
|
9202
|
+
operator = 5,
|
|
9203
|
+
stringLiteral = 6,
|
|
9204
|
+
regularExpressionLiteral = 7,
|
|
9205
|
+
whiteSpace = 8,
|
|
9206
|
+
text = 9,
|
|
9207
|
+
punctuation = 10,
|
|
9208
|
+
className = 11,
|
|
9209
|
+
enumName = 12,
|
|
9210
|
+
interfaceName = 13,
|
|
9211
|
+
moduleName = 14,
|
|
9212
|
+
typeParameterName = 15,
|
|
9213
|
+
typeAliasName = 16,
|
|
9214
|
+
parameterName = 17,
|
|
9215
|
+
docCommentTagName = 18,
|
|
9216
|
+
jsxOpenTagName = 19,
|
|
9217
|
+
jsxCloseTagName = 20,
|
|
9218
|
+
jsxSelfClosingTagName = 21,
|
|
9219
|
+
jsxAttribute = 22,
|
|
9220
|
+
jsxText = 23,
|
|
9221
|
+
jsxAttributeStringLiteralValue = 24,
|
|
9222
|
+
bigintLiteral = 25
|
|
9223
|
+
}
|
|
9162
9224
|
}
|
|
9163
9225
|
declare namespace ts.server {
|
|
9164
9226
|
interface ScriptInfoVersion {
|