Skip to content

Commit 80fff90

Browse files
committed
Update LKG
1 parent 149803b commit 80fff90

9 files changed

+86
-46
lines changed

lib/tsc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10534,6 +10534,10 @@ var ts;
1053410534
|| kind === 251;
1053510535
}
1053610536
ts.isTypeElement = isTypeElement;
10537+
function isClassOrTypeElement(node) {
10538+
return isTypeElement(node) || isClassElement(node);
10539+
}
10540+
ts.isClassOrTypeElement = isClassOrTypeElement;
1053710541
function isObjectLiteralElementLike(node) {
1053810542
var kind = node.kind;
1053910543
return kind === 268

lib/tsserver.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10985,6 +10985,10 @@ var ts;
1098510985
|| kind === 251;
1098610986
}
1098710987
ts.isTypeElement = isTypeElement;
10988+
function isClassOrTypeElement(node) {
10989+
return isTypeElement(node) || isClassElement(node);
10990+
}
10991+
ts.isClassOrTypeElement = isClassOrTypeElement;
1098810992
function isObjectLiteralElementLike(node) {
1098910993
var kind = node.kind;
1099010994
return kind === 268
@@ -78631,10 +78635,7 @@ var ts;
7863178635
}
7863278636
};
7863378637
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
78634-
if (ts.isStatementButNotDeclaration(after) ||
78635-
after.kind === 151 ||
78636-
after.kind === 150 ||
78637-
after.kind === 152) {
78638+
if (needSemicolonBetween(after, newNode)) {
7863878639
if (sourceFile.text.charCodeAt(after.end - 1) !== 59) {
7863978640
this.changes.push({
7864078641
kind: ChangeKind.ReplaceWithSingleNode,
@@ -78652,7 +78653,7 @@ var ts;
7865278653
if (ts.isClassDeclaration(node) || ts.isModuleDeclaration(node)) {
7865378654
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
7865478655
}
78655-
else if (ts.isStatement(node) || ts.isClassElement(node) || ts.isTypeElement(node)) {
78656+
else if (ts.isStatement(node) || ts.isClassOrTypeElement(node)) {
7865678657
return { suffix: this.newLineCharacter };
7865778658
}
7865878659
else if (ts.isVariableDeclaration(node)) {
@@ -79017,6 +79018,10 @@ var ts;
7901779018
}
7901879019
}
7901979020
}
79021+
function needSemicolonBetween(a, b) {
79022+
return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 146
79023+
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b);
79024+
}
7902079025
})(textChanges = ts.textChanges || (ts.textChanges = {}));
7902179026
})(ts || (ts = {}));
7902279027
var ts;
@@ -85937,6 +85942,11 @@ var ts;
8593785942
: undefined;
8593885943
}
8593985944
server.findArgument = findArgument;
85945+
function nowString() {
85946+
var d = new Date();
85947+
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
85948+
}
85949+
server.nowString = nowString;
8594085950
})(server = ts.server || (ts.server = {}));
8594185951
})(ts || (ts = {}));
8594285952
var ts;
@@ -88963,6 +88973,8 @@ var ts;
8896388973
}
8896488974
this.currentDirectory = this.host.getCurrentDirectory();
8896588975
this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
88976+
this.globalCacheLocationDirectoryPath = this.typingsInstaller.globalTypingsCacheLocation &&
88977+
ts.ensureTrailingDirectorySeparator(this.toPath(this.typingsInstaller.globalTypingsCacheLocation));
8896688978
this.throttledOperations = new server.ThrottledOperations(this.host, this.logger);
8896788979
if (this.typesMapLocation) {
8896888980
this.loadTypesMap();
@@ -89060,8 +89072,8 @@ var ts;
8906089072
else {
8906189073
if (_this.pendingEnsureProjectForOpenFiles) {
8906289074
_this.ensureProjectForOpenFiles();
89075+
_this.sendProjectsUpdatedInBackgroundEvent();
8906389076
}
89064-
_this.sendProjectsUpdatedInBackgroundEvent();
8906589077
}
8906689078
});
8906789079
};
@@ -89132,7 +89144,6 @@ var ts;
8913289144
return undefined;
8913389145
}
8913489146
if (server.isInferredProjectName(projectName)) {
89135-
this.ensureProjectStructuresUptoDate();
8913689147
return findProjectByName(projectName, this.inferredProjects);
8913789148
}
8913889149
return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName));
@@ -89884,7 +89895,9 @@ var ts;
8988489895
ProjectService.prototype.watchClosedScriptInfo = function (info) {
8988589896
var _this = this;
8988689897
ts.Debug.assert(!info.fileWatcher);
89887-
if (!info.isDynamicOrHasMixedContent()) {
89898+
if (!info.isDynamicOrHasMixedContent() &&
89899+
(!this.globalCacheLocationDirectoryPath ||
89900+
!ts.startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
8988889901
var fileName = info.fileName;
8988989902
info.fileWatcher = this.watchFactory.watchFilePath(this.host, fileName, function (fileName, eventKind, path) { return _this.onSourceFileChanged(fileName, eventKind, path); }, ts.PollingInterval.Medium, info.path, "Closed Script info");
8989089903
}
@@ -93041,7 +93054,7 @@ var ts;
9304193054
if (type === void 0) { type = server.Msg.Err; }
9304293055
if (!this.canWrite)
9304393056
return;
93044-
s = "[" + nowString() + "] " + s + "\n";
93057+
s = "[" + server.nowString() + "] " + s + "\n";
9304593058
if (!this.inGroup || this.firstInGroup) {
9304693059
var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " ");
9304793060
s = prefix + s;
@@ -93069,10 +93082,6 @@ var ts;
9306993082
};
9307093083
return Logger;
9307193084
}());
93072-
function nowString() {
93073-
var d = new Date();
93074-
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
93075-
}
9307693085
var NodeTypingsInstaller = (function () {
9307793086
function NodeTypingsInstaller(telemetryEnabled, logger, host, globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, event) {
9307893087
this.telemetryEnabled = telemetryEnabled;

lib/tsserverlibrary.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,6 +3219,7 @@ declare namespace ts {
32193219
function isClassLike(node: Node): node is ClassLikeDeclaration;
32203220
function isAccessor(node: Node): node is AccessorDeclaration;
32213221
function isTypeElement(node: Node): node is TypeElement;
3222+
function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
32223223
function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
32233224
/**
32243225
* Node test that determines whether a node is a valid type node.
@@ -7847,6 +7848,7 @@ declare namespace ts.server {
78477848
readonly useSingleInferredProject: boolean;
78487849
readonly useInferredProjectPerProjectRoot: boolean;
78497850
readonly typingsInstaller: ITypingsInstaller;
7851+
private readonly globalCacheLocationDirectoryPath;
78507852
readonly throttleWaitMilliseconds?: number;
78517853
private readonly eventHandler?;
78527854
readonly globalPlugins: ReadonlyArray<string>;

lib/tsserverlibrary.js

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3648,10 +3648,6 @@ var ts;
36483648
return path;
36493649
}
36503650
ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;
3651-
/**
3652-
* Adds a trailing directory separator to a path, if it does not already have one.
3653-
* @param path The path.
3654-
*/
36553651
function ensureTrailingDirectorySeparator(path) {
36563652
if (path.charAt(path.length - 1) !== ts.directorySeparator) {
36573653
return path + ts.directorySeparator;
@@ -11497,6 +11493,10 @@ var ts;
1149711493
|| kind === 251 /* MissingDeclaration */;
1149811494
}
1149911495
ts.isTypeElement = isTypeElement;
11496+
function isClassOrTypeElement(node) {
11497+
return isTypeElement(node) || isClassElement(node);
11498+
}
11499+
ts.isClassOrTypeElement = isClassOrTypeElement;
1150011500
function isObjectLiteralElementLike(node) {
1150111501
var kind = node.kind;
1150211502
return kind === 268 /* PropertyAssignment */
@@ -94878,10 +94878,7 @@ var ts;
9487894878
}
9487994879
};
9488094880
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
94881-
if (ts.isStatementButNotDeclaration(after) ||
94882-
after.kind === 151 /* PropertyDeclaration */ ||
94883-
after.kind === 150 /* PropertySignature */ ||
94884-
after.kind === 152 /* MethodSignature */) {
94881+
if (needSemicolonBetween(after, newNode)) {
9488594882
// check if previous statement ends with semicolon
9488694883
// if not - insert semicolon to preserve the code from changing the meaning due to ASI
9488794884
if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) {
@@ -94901,7 +94898,7 @@ var ts;
9490194898
if (ts.isClassDeclaration(node) || ts.isModuleDeclaration(node)) {
9490294899
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
9490394900
}
94904-
else if (ts.isStatement(node) || ts.isClassElement(node) || ts.isTypeElement(node)) {
94901+
else if (ts.isStatement(node) || ts.isClassOrTypeElement(node)) {
9490594902
return { suffix: this.newLineCharacter };
9490694903
}
9490794904
else if (ts.isVariableDeclaration(node)) {
@@ -95335,6 +95332,10 @@ var ts;
9533595332
}
9533695333
}
9533795334
}
95335+
function needSemicolonBetween(a, b) {
95336+
return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 146 /* ComputedPropertyName */
95337+
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
95338+
}
9533895339
})(textChanges = ts.textChanges || (ts.textChanges = {}));
9533995340
})(ts || (ts = {}));
9534095341
/* @internal */
@@ -102515,6 +102516,13 @@ var ts;
102515102516
: undefined;
102516102517
}
102517102518
server.findArgument = findArgument;
102519+
/*@internal*/
102520+
function nowString() {
102521+
// E.g. "12:34:56.789"
102522+
var d = new Date();
102523+
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
102524+
}
102525+
server.nowString = nowString;
102518102526
})(server = ts.server || (ts.server = {}));
102519102527
})(ts || (ts = {}));
102520102528
/// <reference path="types.ts" />
@@ -108711,6 +108719,8 @@ var ts;
108711108719
}
108712108720
this.currentDirectory = this.host.getCurrentDirectory();
108713108721
this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
108722+
this.globalCacheLocationDirectoryPath = this.typingsInstaller.globalTypingsCacheLocation &&
108723+
ts.ensureTrailingDirectorySeparator(this.toPath(this.typingsInstaller.globalTypingsCacheLocation));
108714108724
this.throttledOperations = new server.ThrottledOperations(this.host, this.logger);
108715108725
if (this.typesMapLocation) {
108716108726
this.loadTypesMap();
@@ -108815,10 +108825,10 @@ var ts;
108815108825
else {
108816108826
if (_this.pendingEnsureProjectForOpenFiles) {
108817108827
_this.ensureProjectForOpenFiles();
108828+
// Send the event to notify that there were background project updates
108829+
// send current list of open files
108830+
_this.sendProjectsUpdatedInBackgroundEvent();
108818108831
}
108819-
// Send the event to notify that there were background project updates
108820-
// send current list of open files
108821-
_this.sendProjectsUpdatedInBackgroundEvent();
108822108832
}
108823108833
});
108824108834
};
@@ -108901,7 +108911,6 @@ var ts;
108901108911
return undefined;
108902108912
}
108903108913
if (server.isInferredProjectName(projectName)) {
108904-
this.ensureProjectStructuresUptoDate();
108905108914
return findProjectByName(projectName, this.inferredProjects);
108906108915
}
108907108916
return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName));
@@ -109848,7 +109857,10 @@ var ts;
109848109857
var _this = this;
109849109858
ts.Debug.assert(!info.fileWatcher);
109850109859
// do not watch files with mixed content - server doesn't know how to interpret it
109851-
if (!info.isDynamicOrHasMixedContent()) {
109860+
// do not watch files in the global cache location
109861+
if (!info.isDynamicOrHasMixedContent() &&
109862+
(!this.globalCacheLocationDirectoryPath ||
109863+
!ts.startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
109852109864
var fileName = info.fileName;
109853109865
info.fileWatcher = this.watchFactory.watchFilePath(this.host, fileName, function (fileName, eventKind, path) { return _this.onSourceFileChanged(fileName, eventKind, path); }, ts.PollingInterval.Medium, info.path, "Closed Script info" /* ClosedScriptInfo */);
109854109866
}

lib/typescript.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,6 +3274,7 @@ declare namespace ts {
32743274
function isClassLike(node: Node): node is ClassLikeDeclaration;
32753275
function isAccessor(node: Node): node is AccessorDeclaration;
32763276
function isTypeElement(node: Node): node is TypeElement;
3277+
function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
32773278
function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
32783279
/**
32793280
* Node test that determines whether a node is a valid type node.

lib/typescript.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3648,10 +3648,6 @@ var ts;
36483648
return path;
36493649
}
36503650
ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;
3651-
/**
3652-
* Adds a trailing directory separator to a path, if it does not already have one.
3653-
* @param path The path.
3654-
*/
36553651
function ensureTrailingDirectorySeparator(path) {
36563652
if (path.charAt(path.length - 1) !== ts.directorySeparator) {
36573653
return path + ts.directorySeparator;
@@ -13373,6 +13369,10 @@ var ts;
1337313369
|| kind === 251 /* MissingDeclaration */;
1337413370
}
1337513371
ts.isTypeElement = isTypeElement;
13372+
function isClassOrTypeElement(node) {
13373+
return isTypeElement(node) || isClassElement(node);
13374+
}
13375+
ts.isClassOrTypeElement = isClassOrTypeElement;
1337613376
function isObjectLiteralElementLike(node) {
1337713377
var kind = node.kind;
1337813378
return kind === 268 /* PropertyAssignment */
@@ -96457,10 +96457,7 @@ var ts;
9645796457
}
9645896458
};
9645996459
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
96460-
if (ts.isStatementButNotDeclaration(after) ||
96461-
after.kind === 151 /* PropertyDeclaration */ ||
96462-
after.kind === 150 /* PropertySignature */ ||
96463-
after.kind === 152 /* MethodSignature */) {
96460+
if (needSemicolonBetween(after, newNode)) {
9646496461
// check if previous statement ends with semicolon
9646596462
// if not - insert semicolon to preserve the code from changing the meaning due to ASI
9646696463
if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) {
@@ -96480,7 +96477,7 @@ var ts;
9648096477
if (ts.isClassDeclaration(node) || ts.isModuleDeclaration(node)) {
9648196478
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
9648296479
}
96483-
else if (ts.isStatement(node) || ts.isClassElement(node) || ts.isTypeElement(node)) {
96480+
else if (ts.isStatement(node) || ts.isClassOrTypeElement(node)) {
9648496481
return { suffix: this.newLineCharacter };
9648596482
}
9648696483
else if (ts.isVariableDeclaration(node)) {
@@ -96914,6 +96911,10 @@ var ts;
9691496911
}
9691596912
}
9691696913
}
96914+
function needSemicolonBetween(a, b) {
96915+
return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 146 /* ComputedPropertyName */
96916+
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
96917+
}
9691796918
})(textChanges = ts.textChanges || (ts.textChanges = {}));
9691896919
})(ts || (ts = {}));
9691996920
/* @internal */

lib/typescriptServices.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,6 +3274,7 @@ declare namespace ts {
32743274
function isClassLike(node: Node): node is ClassLikeDeclaration;
32753275
function isAccessor(node: Node): node is AccessorDeclaration;
32763276
function isTypeElement(node: Node): node is TypeElement;
3277+
function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
32773278
function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
32783279
/**
32793280
* Node test that determines whether a node is a valid type node.

lib/typescriptServices.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3648,10 +3648,6 @@ var ts;
36483648
return path;
36493649
}
36503650
ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;
3651-
/**
3652-
* Adds a trailing directory separator to a path, if it does not already have one.
3653-
* @param path The path.
3654-
*/
36553651
function ensureTrailingDirectorySeparator(path) {
36563652
if (path.charAt(path.length - 1) !== ts.directorySeparator) {
36573653
return path + ts.directorySeparator;
@@ -13373,6 +13369,10 @@ var ts;
1337313369
|| kind === 251 /* MissingDeclaration */;
1337413370
}
1337513371
ts.isTypeElement = isTypeElement;
13372+
function isClassOrTypeElement(node) {
13373+
return isTypeElement(node) || isClassElement(node);
13374+
}
13375+
ts.isClassOrTypeElement = isClassOrTypeElement;
1337613376
function isObjectLiteralElementLike(node) {
1337713377
var kind = node.kind;
1337813378
return kind === 268 /* PropertyAssignment */
@@ -96457,10 +96457,7 @@ var ts;
9645796457
}
9645896458
};
9645996459
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
96460-
if (ts.isStatementButNotDeclaration(after) ||
96461-
after.kind === 151 /* PropertyDeclaration */ ||
96462-
after.kind === 150 /* PropertySignature */ ||
96463-
after.kind === 152 /* MethodSignature */) {
96460+
if (needSemicolonBetween(after, newNode)) {
9646496461
// check if previous statement ends with semicolon
9646596462
// if not - insert semicolon to preserve the code from changing the meaning due to ASI
9646696463
if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) {
@@ -96480,7 +96477,7 @@ var ts;
9648096477
if (ts.isClassDeclaration(node) || ts.isModuleDeclaration(node)) {
9648196478
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
9648296479
}
96483-
else if (ts.isStatement(node) || ts.isClassElement(node) || ts.isTypeElement(node)) {
96480+
else if (ts.isStatement(node) || ts.isClassOrTypeElement(node)) {
9648496481
return { suffix: this.newLineCharacter };
9648596482
}
9648696483
else if (ts.isVariableDeclaration(node)) {
@@ -96914,6 +96911,10 @@ var ts;
9691496911
}
9691596912
}
9691696913
}
96914+
function needSemicolonBetween(a, b) {
96915+
return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 146 /* ComputedPropertyName */
96916+
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
96917+
}
9691796918
})(textChanges = ts.textChanges || (ts.textChanges = {}));
9691896919
})(ts || (ts = {}));
9691996920
/* @internal */

0 commit comments

Comments
 (0)