Update LKG

This commit is contained in:
Mohamed Hegazy
2018-04-19 14:14:07 -07:00
parent 149803bb12
commit 80fff90e91
9 changed files with 86 additions and 46 deletions

View File

@@ -10534,6 +10534,10 @@ var ts;
|| kind === 251;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
return isTypeElement(node) || isClassElement(node);
}
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
return kind === 268

View File

@@ -10985,6 +10985,10 @@ var ts;
|| kind === 251;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
return isTypeElement(node) || isClassElement(node);
}
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
return kind === 268
@@ -78631,10 +78635,7 @@ var ts;
}
};
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
if (ts.isStatementButNotDeclaration(after) ||
after.kind === 151 ||
after.kind === 150 ||
after.kind === 152) {
if (needSemicolonBetween(after, newNode)) {
if (sourceFile.text.charCodeAt(after.end - 1) !== 59) {
this.changes.push({
kind: ChangeKind.ReplaceWithSingleNode,
@@ -78652,7 +78653,7 @@ var ts;
if (ts.isClassDeclaration(node) || ts.isModuleDeclaration(node)) {
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
}
else if (ts.isStatement(node) || ts.isClassElement(node) || ts.isTypeElement(node)) {
else if (ts.isStatement(node) || ts.isClassOrTypeElement(node)) {
return { suffix: this.newLineCharacter };
}
else if (ts.isVariableDeclaration(node)) {
@@ -79017,6 +79018,10 @@ var ts;
}
}
}
function needSemicolonBetween(a, b) {
return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 146
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b);
}
})(textChanges = ts.textChanges || (ts.textChanges = {}));
})(ts || (ts = {}));
var ts;
@@ -85937,6 +85942,11 @@ var ts;
: undefined;
}
server.findArgument = findArgument;
function nowString() {
var d = new Date();
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
}
server.nowString = nowString;
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
var ts;
@@ -88963,6 +88973,8 @@ var ts;
}
this.currentDirectory = this.host.getCurrentDirectory();
this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
this.globalCacheLocationDirectoryPath = this.typingsInstaller.globalTypingsCacheLocation &&
ts.ensureTrailingDirectorySeparator(this.toPath(this.typingsInstaller.globalTypingsCacheLocation));
this.throttledOperations = new server.ThrottledOperations(this.host, this.logger);
if (this.typesMapLocation) {
this.loadTypesMap();
@@ -89060,8 +89072,8 @@ var ts;
else {
if (_this.pendingEnsureProjectForOpenFiles) {
_this.ensureProjectForOpenFiles();
_this.sendProjectsUpdatedInBackgroundEvent();
}
_this.sendProjectsUpdatedInBackgroundEvent();
}
});
};
@@ -89132,7 +89144,6 @@ var ts;
return undefined;
}
if (server.isInferredProjectName(projectName)) {
this.ensureProjectStructuresUptoDate();
return findProjectByName(projectName, this.inferredProjects);
}
return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName));
@@ -89884,7 +89895,9 @@ var ts;
ProjectService.prototype.watchClosedScriptInfo = function (info) {
var _this = this;
ts.Debug.assert(!info.fileWatcher);
if (!info.isDynamicOrHasMixedContent()) {
if (!info.isDynamicOrHasMixedContent() &&
(!this.globalCacheLocationDirectoryPath ||
!ts.startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
var fileName = info.fileName;
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");
}
@@ -93041,7 +93054,7 @@ var ts;
if (type === void 0) { type = server.Msg.Err; }
if (!this.canWrite)
return;
s = "[" + nowString() + "] " + s + "\n";
s = "[" + server.nowString() + "] " + s + "\n";
if (!this.inGroup || this.firstInGroup) {
var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " ");
s = prefix + s;
@@ -93069,10 +93082,6 @@ var ts;
};
return Logger;
}());
function nowString() {
var d = new Date();
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
}
var NodeTypingsInstaller = (function () {
function NodeTypingsInstaller(telemetryEnabled, logger, host, globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, event) {
this.telemetryEnabled = telemetryEnabled;

View File

@@ -3219,6 +3219,7 @@ declare namespace ts {
function isClassLike(node: Node): node is ClassLikeDeclaration;
function isAccessor(node: Node): node is AccessorDeclaration;
function isTypeElement(node: Node): node is TypeElement;
function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
/**
* Node test that determines whether a node is a valid type node.
@@ -7847,6 +7848,7 @@ declare namespace ts.server {
readonly useSingleInferredProject: boolean;
readonly useInferredProjectPerProjectRoot: boolean;
readonly typingsInstaller: ITypingsInstaller;
private readonly globalCacheLocationDirectoryPath;
readonly throttleWaitMilliseconds?: number;
private readonly eventHandler?;
readonly globalPlugins: ReadonlyArray<string>;

View File

@@ -3648,10 +3648,6 @@ var ts;
return path;
}
ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;
/**
* Adds a trailing directory separator to a path, if it does not already have one.
* @param path The path.
*/
function ensureTrailingDirectorySeparator(path) {
if (path.charAt(path.length - 1) !== ts.directorySeparator) {
return path + ts.directorySeparator;
@@ -11497,6 +11493,10 @@ var ts;
|| kind === 251 /* MissingDeclaration */;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
return isTypeElement(node) || isClassElement(node);
}
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
return kind === 268 /* PropertyAssignment */
@@ -94878,10 +94878,7 @@ var ts;
}
};
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
if (ts.isStatementButNotDeclaration(after) ||
after.kind === 151 /* PropertyDeclaration */ ||
after.kind === 150 /* PropertySignature */ ||
after.kind === 152 /* MethodSignature */) {
if (needSemicolonBetween(after, newNode)) {
// check if previous statement ends with semicolon
// if not - insert semicolon to preserve the code from changing the meaning due to ASI
if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) {
@@ -94901,7 +94898,7 @@ var ts;
if (ts.isClassDeclaration(node) || ts.isModuleDeclaration(node)) {
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
}
else if (ts.isStatement(node) || ts.isClassElement(node) || ts.isTypeElement(node)) {
else if (ts.isStatement(node) || ts.isClassOrTypeElement(node)) {
return { suffix: this.newLineCharacter };
}
else if (ts.isVariableDeclaration(node)) {
@@ -95335,6 +95332,10 @@ var ts;
}
}
}
function needSemicolonBetween(a, b) {
return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 146 /* ComputedPropertyName */
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
}
})(textChanges = ts.textChanges || (ts.textChanges = {}));
})(ts || (ts = {}));
/* @internal */
@@ -102515,6 +102516,13 @@ var ts;
: undefined;
}
server.findArgument = findArgument;
/*@internal*/
function nowString() {
// E.g. "12:34:56.789"
var d = new Date();
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
}
server.nowString = nowString;
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
/// <reference path="types.ts" />
@@ -108711,6 +108719,8 @@ var ts;
}
this.currentDirectory = this.host.getCurrentDirectory();
this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
this.globalCacheLocationDirectoryPath = this.typingsInstaller.globalTypingsCacheLocation &&
ts.ensureTrailingDirectorySeparator(this.toPath(this.typingsInstaller.globalTypingsCacheLocation));
this.throttledOperations = new server.ThrottledOperations(this.host, this.logger);
if (this.typesMapLocation) {
this.loadTypesMap();
@@ -108815,10 +108825,10 @@ var ts;
else {
if (_this.pendingEnsureProjectForOpenFiles) {
_this.ensureProjectForOpenFiles();
// Send the event to notify that there were background project updates
// send current list of open files
_this.sendProjectsUpdatedInBackgroundEvent();
}
// Send the event to notify that there were background project updates
// send current list of open files
_this.sendProjectsUpdatedInBackgroundEvent();
}
});
};
@@ -108901,7 +108911,6 @@ var ts;
return undefined;
}
if (server.isInferredProjectName(projectName)) {
this.ensureProjectStructuresUptoDate();
return findProjectByName(projectName, this.inferredProjects);
}
return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName));
@@ -109848,7 +109857,10 @@ var ts;
var _this = this;
ts.Debug.assert(!info.fileWatcher);
// do not watch files with mixed content - server doesn't know how to interpret it
if (!info.isDynamicOrHasMixedContent()) {
// do not watch files in the global cache location
if (!info.isDynamicOrHasMixedContent() &&
(!this.globalCacheLocationDirectoryPath ||
!ts.startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
var fileName = info.fileName;
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 */);
}

1
lib/typescript.d.ts vendored
View File

@@ -3274,6 +3274,7 @@ declare namespace ts {
function isClassLike(node: Node): node is ClassLikeDeclaration;
function isAccessor(node: Node): node is AccessorDeclaration;
function isTypeElement(node: Node): node is TypeElement;
function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
/**
* Node test that determines whether a node is a valid type node.

View File

@@ -3648,10 +3648,6 @@ var ts;
return path;
}
ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;
/**
* Adds a trailing directory separator to a path, if it does not already have one.
* @param path The path.
*/
function ensureTrailingDirectorySeparator(path) {
if (path.charAt(path.length - 1) !== ts.directorySeparator) {
return path + ts.directorySeparator;
@@ -13373,6 +13369,10 @@ var ts;
|| kind === 251 /* MissingDeclaration */;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
return isTypeElement(node) || isClassElement(node);
}
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
return kind === 268 /* PropertyAssignment */
@@ -96457,10 +96457,7 @@ var ts;
}
};
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
if (ts.isStatementButNotDeclaration(after) ||
after.kind === 151 /* PropertyDeclaration */ ||
after.kind === 150 /* PropertySignature */ ||
after.kind === 152 /* MethodSignature */) {
if (needSemicolonBetween(after, newNode)) {
// check if previous statement ends with semicolon
// if not - insert semicolon to preserve the code from changing the meaning due to ASI
if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) {
@@ -96480,7 +96477,7 @@ var ts;
if (ts.isClassDeclaration(node) || ts.isModuleDeclaration(node)) {
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
}
else if (ts.isStatement(node) || ts.isClassElement(node) || ts.isTypeElement(node)) {
else if (ts.isStatement(node) || ts.isClassOrTypeElement(node)) {
return { suffix: this.newLineCharacter };
}
else if (ts.isVariableDeclaration(node)) {
@@ -96914,6 +96911,10 @@ var ts;
}
}
}
function needSemicolonBetween(a, b) {
return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 146 /* ComputedPropertyName */
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
}
})(textChanges = ts.textChanges || (ts.textChanges = {}));
})(ts || (ts = {}));
/* @internal */

View File

@@ -3274,6 +3274,7 @@ declare namespace ts {
function isClassLike(node: Node): node is ClassLikeDeclaration;
function isAccessor(node: Node): node is AccessorDeclaration;
function isTypeElement(node: Node): node is TypeElement;
function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
/**
* Node test that determines whether a node is a valid type node.

View File

@@ -3648,10 +3648,6 @@ var ts;
return path;
}
ts.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;
/**
* Adds a trailing directory separator to a path, if it does not already have one.
* @param path The path.
*/
function ensureTrailingDirectorySeparator(path) {
if (path.charAt(path.length - 1) !== ts.directorySeparator) {
return path + ts.directorySeparator;
@@ -13373,6 +13369,10 @@ var ts;
|| kind === 251 /* MissingDeclaration */;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
return isTypeElement(node) || isClassElement(node);
}
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
return kind === 268 /* PropertyAssignment */
@@ -96457,10 +96457,7 @@ var ts;
}
};
ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode) {
if (ts.isStatementButNotDeclaration(after) ||
after.kind === 151 /* PropertyDeclaration */ ||
after.kind === 150 /* PropertySignature */ ||
after.kind === 152 /* MethodSignature */) {
if (needSemicolonBetween(after, newNode)) {
// check if previous statement ends with semicolon
// if not - insert semicolon to preserve the code from changing the meaning due to ASI
if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) {
@@ -96480,7 +96477,7 @@ var ts;
if (ts.isClassDeclaration(node) || ts.isModuleDeclaration(node)) {
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
}
else if (ts.isStatement(node) || ts.isClassElement(node) || ts.isTypeElement(node)) {
else if (ts.isStatement(node) || ts.isClassOrTypeElement(node)) {
return { suffix: this.newLineCharacter };
}
else if (ts.isVariableDeclaration(node)) {
@@ -96914,6 +96911,10 @@ var ts;
}
}
}
function needSemicolonBetween(a, b) {
return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 146 /* ComputedPropertyName */
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
}
})(textChanges = ts.textChanges || (ts.textChanges = {}));
})(ts || (ts = {}));
/* @internal */

View File

@@ -8856,6 +8856,10 @@ var ts;
|| kind === 251;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
return isTypeElement(node) || isClassElement(node);
}
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
return kind === 268
@@ -19535,6 +19539,11 @@ var ts;
: undefined;
}
server.findArgument = findArgument;
function nowString() {
var d = new Date();
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds();
}
server.nowString = nowString;
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
var ts;
@@ -19917,7 +19926,7 @@ var ts;
};
this.writeLine = function (text) {
try {
fs.appendFileSync(_this.logFile, text + ts.sys.newLine);
fs.appendFileSync(_this.logFile, "[" + server.nowString() + "] " + text + ts.sys.newLine);
}
catch (e) {
_this.logEnabled = false;