Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -126,6 +126,20 @@ class MonacoGenerator {
this._declarationResolver.invalidateCache(moduleId);
this._executeSoon();
});
watcher.addListener('error', (err) => {
console.error(`Encountered error while watching ${filePath}.`);
console.log(err);
delete this._watchedFiles[filePath];
for (let i = 0; i < this._watchers.length; i++) {
if (this._watchers[i] === watcher) {
this._watchers.splice(i, 1);
break;
}
}
watcher.close();
this._declarationResolver.invalidateCache(moduleId);
this._executeSoon();
});
this._watchers.push(watcher);
};
this._fsProvider = new class extends monacodts.FSProvider {

View File

@@ -159,6 +159,20 @@ class MonacoGenerator {
this._declarationResolver.invalidateCache(moduleId);
this._executeSoon();
});
watcher.addListener('error', (err) => {
console.error(`Encountered error while watching ${filePath}.`);
console.log(err);
delete this._watchedFiles[filePath];
for (let i = 0; i < this._watchers.length; i++) {
if (this._watchers[i] === watcher) {
this._watchers.splice(i, 1);
break;
}
}
watcher.close();
this._declarationResolver.invalidateCache(moduleId);
this._executeSoon();
});
this._watchers.push(watcher);
};
this._fsProvider = new class extends monacodts.FSProvider {

View File

@@ -17,14 +17,14 @@ function getVersion(repo) {
head = fs.readFileSync(headPath, 'utf8').trim();
}
catch (e) {
return void 0;
return undefined;
}
if (/^[0-9a-f]{40}$/i.test(head)) {
return head;
}
const refMatch = /^ref: (.*)$/.exec(head);
if (!refMatch) {
return void 0;
return undefined;
}
const ref = refMatch[1];
const refPath = path.join(git, ref);
@@ -40,7 +40,7 @@ function getVersion(repo) {
refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim();
}
catch (e) {
return void 0;
return undefined;
}
const refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm;
let refsMatch;

View File

@@ -18,7 +18,7 @@ export function getVersion(repo: string): string | undefined {
try {
head = fs.readFileSync(headPath, 'utf8').trim();
} catch (e) {
return void 0;
return undefined;
}
if (/^[0-9a-f]{40}$/i.test(head)) {
@@ -28,7 +28,7 @@ export function getVersion(repo: string): string | undefined {
const refMatch = /^ref: (.*)$/.exec(head);
if (!refMatch) {
return void 0;
return undefined;
}
const ref = refMatch[1];
@@ -46,7 +46,7 @@ export function getVersion(repo: string): string | undefined {
try {
refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim();
} catch (e) {
return void 0;
return undefined;
}
const refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm;

View File

@@ -238,6 +238,10 @@
"name": "vs/workbench/services/decorations",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/label",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/preferences",
"project": "vscode-preferences"

View File

@@ -119,8 +119,7 @@ function createESMSourcesAndResources2(options) {
return path.join(OUT_RESOURCES_FOLDER, dest);
};
const allFiles = walkDirRecursive(SRC_FOLDER);
for (let i = 0; i < allFiles.length; i++) {
const file = allFiles[i];
for (const file of allFiles) {
if (options.ignores.indexOf(file.replace(/\\/g, '/')) >= 0) {
continue;
}

View File

@@ -139,8 +139,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
};
const allFiles = walkDirRecursive(SRC_FOLDER);
for (let i = 0; i < allFiles.length; i++) {
const file = allFiles[i];
for (const file of allFiles) {
if (options.ignores.indexOf(file.replace(/\\/g, '/')) >= 0) {
continue;
@@ -244,7 +243,6 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
let mode = 0;
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (mode === 0) {
if (/\/\/ ESM-comment-begin/.test(line)) {
mode = 1;

View File

@@ -15,8 +15,7 @@ var ShakeLevel;
ShakeLevel[ShakeLevel["ClassMembers"] = 2] = "ClassMembers";
})(ShakeLevel = exports.ShakeLevel || (exports.ShakeLevel = {}));
function printDiagnostics(diagnostics) {
for (let i = 0; i < diagnostics.length; i++) {
const diag = diagnostics[i];
for (const diag of diagnostics) {
let result = '';
if (diag.file) {
result += `${diag.file.fileName}: `;
@@ -97,6 +96,11 @@ function discoverAndReadFiles(options) {
FILES[`${moduleId}.d.ts`] = dts_filecontents;
continue;
}
const js_filename = path.join(options.sourcesRoot, moduleId + '.js');
if (fs.existsSync(js_filename)) {
// This is an import for a .js file, so ignore it...
continue;
}
let ts_filename;
if (options.redirects[moduleId]) {
ts_filename = path.join(options.sourcesRoot, options.redirects[moduleId] + '.ts');
@@ -475,8 +479,7 @@ function generateResult(languageService, shakeLevel) {
}
else {
let survivingImports = [];
for (let i = 0; i < node.importClause.namedBindings.elements.length; i++) {
const importNode = node.importClause.namedBindings.elements[i];
for (const importNode of node.importClause.namedBindings.elements) {
if (getColor(importNode) === 2 /* Black */) {
survivingImports.push(importNode.getFullText(sourceFile));
}

View File

@@ -61,15 +61,14 @@ export interface ITreeShakingResult {
}
function printDiagnostics(diagnostics: ReadonlyArray<ts.Diagnostic>): void {
for (let i = 0; i < diagnostics.length; i++) {
const diag = diagnostics[i];
for (const diag of diagnostics) {
let result = '';
if (diag.file) {
result += `${diag.file.fileName}: `;
}
if (diag.file && diag.start) {
let location = diag.file.getLineAndCharacterOfPosition(diag.start);
result += `- ${location.line + 1},${location.character} - `
result += `- ${location.line + 1},${location.character} - `;
}
result += JSON.stringify(diag.messageText);
console.log(result);
@@ -160,6 +159,12 @@ function discoverAndReadFiles(options: ITreeShakingOptions): IFileMap {
continue;
}
const js_filename = path.join(options.sourcesRoot, moduleId + '.js');
if (fs.existsSync(js_filename)) {
// This is an import for a .js file, so ignore it...
continue;
}
let ts_filename: string;
if (options.redirects[moduleId]) {
ts_filename = path.join(options.sourcesRoot, options.redirects[moduleId] + '.ts');
@@ -459,7 +464,7 @@ function markNodes(languageService: ts.LanguageService, options: ITreeShakingOpt
}
if (black_queue.length === 0) {
for (let i = 0; i < gray_queue.length; i++) {
for (let i = 0; i< gray_queue.length; i++) {
const node = gray_queue[i];
const nodeParent = node.parent;
if ((ts.isClassDeclaration(nodeParent) || ts.isInterfaceDeclaration(nodeParent)) && nodeOrChildIsBlack(nodeParent)) {
@@ -604,8 +609,7 @@ function generateResult(languageService: ts.LanguageService, shakeLevel: ShakeLe
}
} else {
let survivingImports: string[] = [];
for (let i = 0; i < node.importClause.namedBindings.elements.length; i++) {
const importNode = node.importClause.namedBindings.elements[i];
for (const importNode of node.importClause.namedBindings.elements) {
if (getColor(importNode) === NodeColor.Black) {
survivingImports.push(importNode.getFullText(sourceFile));
}

View File

@@ -109,8 +109,7 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
this.recordKey(keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined);
}
else if (isObjectLiteral(keyArg)) {
for (let i = 0; i < keyArg.properties.length; i++) {
const property = keyArg.properties[i];
for (const property of keyArg.properties) {
if (isPropertyAssignment(property)) {
const name = property.name.getText();
if (name === 'key') {

View File

@@ -148,8 +148,7 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
if (isStringLiteral(keyArg)) {
this.recordKey(keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined);
} else if (isObjectLiteral(keyArg)) {
for (let i = 0; i < keyArg.properties.length; i++) {
const property = keyArg.properties[i];
for (const property of keyArg.properties) {
if (isPropertyAssignment(property)) {
const name = property.name.getText();
if (name === 'key') {

View File

@@ -17,7 +17,7 @@ function handleDeletions() {
});
}
let watch = void 0;
let watch = undefined;
if (!watch) {
watch = process.platform === 'win32' ? require('./watch-win32') : require('gulp-watch');