Skip to content

Commit b8c953d

Browse files
authored
Merge branch 'master' into 99129-theme-colour-git-staged
2 parents 536652a + 772aa07 commit b8c953d

216 files changed

Lines changed: 2893 additions & 2546 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/classifier.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/microsoft/vscode-github-triage-actions/master/classifier-deep/apply/apply-labels/deep-classifier-config.schema.json",
3-
"vacation": ["joaomoreno"],
3+
"vacation": ["joaomoreno"],
44
"assignees": {
55
"JacksonKearl": {"accuracy": 0.5}
66
},
@@ -20,8 +20,8 @@
2020
"context-keys": {"assign": []},
2121
"css-less-scss": {"assign": ["aeschli"]},
2222
"custom-editors": {"assign": ["mjbvz"]},
23-
"debug": {"assign": ["weinand"]},
24-
"debug-console": {"assign": ["weinand"]},
23+
"debug": {"assign": ["isidorn"]},
24+
"debug-console": {"assign": ["isidorn"]},
2525
"dialogs": {"assign": ["sbatten"]},
2626
"diff-editor": {"assign": []},
2727
"dropdown": {"assign": []},

build/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
*.js
1+
azure-pipelines/**/*.js
2+
darwin/**/*.js
3+
lib/**/*.js

build/gulpfile.editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const i18n = require('./lib/i18n');
1414
const standalone = require('./lib/standalone');
1515
const cp = require('child_process');
1616
const compilation = require('./lib/compilation');
17-
const monacoapi = require('./monaco/api');
17+
const monacoapi = require('./lib/monaco-api');
1818
const fs = require('fs');
1919
const webpack = require('webpack');
2020
const webpackGulp = require('webpack-stream');
Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,54 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
'use strict';
6+
import * as fs from 'fs';
7+
import * as path from 'path';
8+
import * as os from 'os';
9+
import * as rimraf from 'rimraf';
10+
import * as es from 'event-stream';
11+
import * as rename from 'gulp-rename';
12+
import * as vfs from 'vinyl-fs';
13+
import * as ext from './extensions';
14+
import * as fancyLog from 'fancy-log';
15+
import * as ansiColors from 'ansi-colors';
16+
import { Stream } from 'stream';
717

8-
const fs = require('fs');
9-
const path = require('path');
10-
const os = require('os');
1118
const mkdirp = require('mkdirp');
12-
const rimraf = require('rimraf');
13-
const es = require('event-stream');
14-
const rename = require('gulp-rename');
15-
const vfs = require('vinyl-fs');
16-
const ext = require('./extensions');
17-
const fancyLog = require('fancy-log');
18-
const ansiColors = require('ansi-colors');
19+
20+
interface IExtensionDefinition {
21+
name: string;
22+
version: string;
23+
repo: string;
24+
metadata: {
25+
id: string;
26+
publisherId: {
27+
publisherId: string;
28+
publisherName: string;
29+
displayName: string;
30+
flags: string;
31+
};
32+
publisherDisplayName: string;
33+
}
34+
}
1935

2036
const root = path.dirname(path.dirname(__dirname));
2137
const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../product.json'), 'utf8'));
22-
const builtInExtensions = productjson.builtInExtensions;
23-
const webBuiltInExtensions = productjson.webBuiltInExtensions;
38+
const builtInExtensions = <IExtensionDefinition[]>productjson.builtInExtensions;
39+
const webBuiltInExtensions = <IExtensionDefinition[]>productjson.webBuiltInExtensions;
2440
const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json');
2541
const ENABLE_LOGGING = !process.env['VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE'];
2642

27-
function log() {
43+
function log(...messages: string[]): void {
2844
if (ENABLE_LOGGING) {
29-
fancyLog.apply(this, arguments);
45+
fancyLog(...messages);
3046
}
3147
}
3248

33-
function getExtensionPath(extension) {
49+
function getExtensionPath(extension: IExtensionDefinition): string {
3450
return path.join(root, '.build', 'builtInExtensions', extension.name);
3551
}
3652

37-
function isUpToDate(extension) {
53+
function isUpToDate(extension: IExtensionDefinition): boolean {
3854
const packagePath = path.join(getExtensionPath(extension), 'package.json');
3955

4056
if (!fs.existsSync(packagePath)) {
@@ -51,7 +67,7 @@ function isUpToDate(extension) {
5167
}
5268
}
5369

54-
function syncMarketplaceExtension(extension) {
70+
function syncMarketplaceExtension(extension: IExtensionDefinition): Stream {
5571
if (isUpToDate(extension)) {
5672
log(ansiColors.blue('[marketplace]'), `${extension.name}@${extension.version}`, ansiColors.green('✔︎'));
5773
return es.readArray([]);
@@ -65,7 +81,7 @@ function syncMarketplaceExtension(extension) {
6581
.on('end', () => log(ansiColors.blue('[marketplace]'), extension.name, ansiColors.green('✔︎')));
6682
}
6783

68-
function syncExtension(extension, controlState) {
84+
function syncExtension(extension: IExtensionDefinition, controlState: 'disabled' | 'marketplace'): Stream {
6985
switch (controlState) {
7086
case 'disabled':
7187
log(ansiColors.blue('[disabled]'), ansiColors.gray(extension.name));
@@ -89,25 +105,29 @@ function syncExtension(extension, controlState) {
89105
}
90106
}
91107

92-
function readControlFile() {
108+
interface IControlFile {
109+
[name: string]: 'disabled' | 'marketplace';
110+
}
111+
112+
function readControlFile(): IControlFile {
93113
try {
94114
return JSON.parse(fs.readFileSync(controlFilePath, 'utf8'));
95115
} catch (err) {
96116
return {};
97117
}
98118
}
99119

100-
function writeControlFile(control) {
120+
function writeControlFile(control: IControlFile): void {
101121
mkdirp.sync(path.dirname(controlFilePath));
102122
fs.writeFileSync(controlFilePath, JSON.stringify(control, null, 2));
103123
}
104124

105-
exports.getBuiltInExtensions = function getBuiltInExtensions() {
125+
export function getBuiltInExtensions(): Promise<void> {
106126
log('Syncronizing built-in extensions...');
107127
log(`You can manage built-in extensions with the ${ansiColors.cyan('--builtin')} flag`);
108128

109129
const control = readControlFile();
110-
const streams = [];
130+
const streams: Stream[] = [];
111131

112132
for (const extension of [...builtInExtensions, ...webBuiltInExtensions]) {
113133
let controlState = control[extension.name] || 'marketplace';
@@ -123,10 +143,10 @@ exports.getBuiltInExtensions = function getBuiltInExtensions() {
123143
.on('error', reject)
124144
.on('end', resolve);
125145
});
126-
};
146+
}
127147

128148
if (require.main === module) {
129-
exports.getBuiltInExtensions().then(() => process.exit(0)).catch(err => {
149+
getBuiltInExtensions().then(() => process.exit(0)).catch(err => {
130150
console.error(err);
131151
process.exit(1);
132152
});

build/lib/compilation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as bom from 'gulp-bom';
1212
import * as sourcemaps from 'gulp-sourcemaps';
1313
import * as tsb from 'gulp-tsb';
1414
import * as path from 'path';
15-
import * as monacodts from '../monaco/api';
15+
import * as monacodts from './monaco-api';
1616
import * as nls from './nls';
1717
import { createReporter } from './reporter';
1818
import * as util from './util';

build/lib/eslint/code-no-unused-expressions.js renamed to build/lib/eslint/code-no-unused-expressions.ts

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
'use strict';
1515

16+
import * as eslint from 'eslint';
17+
import { TSESTree } from '@typescript-eslint/experimental-utils';
18+
import * as ESTree from 'estree';
19+
1620
//------------------------------------------------------------------------------
1721
// Rule Definition
1822
//------------------------------------------------------------------------------
@@ -50,29 +54,29 @@ module.exports = {
5054
]
5155
},
5256

53-
create(context) {
57+
create(context: eslint.Rule.RuleContext) {
5458
const config = context.options[0] || {},
5559
allowShortCircuit = config.allowShortCircuit || false,
5660
allowTernary = config.allowTernary || false,
5761
allowTaggedTemplates = config.allowTaggedTemplates || false;
5862

5963
// eslint-disable-next-line jsdoc/require-description
60-
/**
61-
* @param {ASTNode} node any node
62-
* @returns {boolean} whether the given node structurally represents a directive
63-
*/
64-
function looksLikeDirective(node) {
64+
/**
65+
* @param node any node
66+
* @returns whether the given node structurally represents a directive
67+
*/
68+
function looksLikeDirective(node: TSESTree.Node): boolean {
6569
return node.type === 'ExpressionStatement' &&
6670
node.expression.type === 'Literal' && typeof node.expression.value === 'string';
6771
}
6872

6973
// eslint-disable-next-line jsdoc/require-description
70-
/**
71-
* @param {Function} predicate ([a] -> Boolean) the function used to make the determination
72-
* @param {a[]} list the input list
73-
* @returns {a[]} the leading sequence of members in the given list that pass the given predicate
74-
*/
75-
function takeWhile(predicate, list) {
74+
/**
75+
* @param predicate ([a] -> Boolean) the function used to make the determination
76+
* @param list the input list
77+
* @returns the leading sequence of members in the given list that pass the given predicate
78+
*/
79+
function takeWhile<T>(predicate: (item: T) => boolean, list: T[]): T[] {
7680
for (let i = 0; i < list.length; ++i) {
7781
if (!predicate(list[i])) {
7882
return list.slice(0, i);
@@ -82,21 +86,21 @@ module.exports = {
8286
}
8387

8488
// eslint-disable-next-line jsdoc/require-description
85-
/**
86-
* @param {ASTNode} node a Program or BlockStatement node
87-
* @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body
88-
*/
89-
function directives(node) {
89+
/**
90+
* @param node a Program or BlockStatement node
91+
* @returns the leading sequence of directive nodes in the given node's body
92+
*/
93+
function directives(node: TSESTree.Program | TSESTree.BlockStatement): TSESTree.Node[] {
9094
return takeWhile(looksLikeDirective, node.body);
9195
}
9296

9397
// eslint-disable-next-line jsdoc/require-description
94-
/**
95-
* @param {ASTNode} node any node
96-
* @param {ASTNode[]} ancestors the given node's ancestors
97-
* @returns {boolean} whether the given node is considered a directive in its current position
98-
*/
99-
function isDirective(node, ancestors) {
98+
/**
99+
* @param node any node
100+
* @param ancestors the given node's ancestors
101+
* @returns whether the given node is considered a directive in its current position
102+
*/
103+
function isDirective(node: TSESTree.Node, ancestors: TSESTree.Node[]): boolean {
100104
const parent = ancestors[ancestors.length - 1],
101105
grandparent = ancestors[ancestors.length - 2];
102106

@@ -105,12 +109,12 @@ module.exports = {
105109
directives(parent).indexOf(node) >= 0;
106110
}
107111

108-
/**
109-
* Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags.
110-
* @param {ASTNode} node any node
111-
* @returns {boolean} whether the given node is a valid expression
112-
*/
113-
function isValidExpression(node) {
112+
/**
113+
* Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags.
114+
* @param node any node
115+
* @returns whether the given node is a valid expression
116+
*/
117+
function isValidExpression(node: TSESTree.Node): boolean {
114118
if (allowTernary) {
115119

116120
// Recursive check for ternary and logical expressions
@@ -134,9 +138,9 @@ module.exports = {
134138
}
135139

136140
return {
137-
ExpressionStatement(node) {
138-
if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors())) {
139-
context.report({ node, message: 'Expected an assignment or function call and instead saw an expression.' });
141+
ExpressionStatement(node: TSESTree.ExpressionStatement) {
142+
if (!isValidExpression(node.expression) && !isDirective(node, <TSESTree.Node[]>context.getAncestors())) {
143+
context.report({ node: <ESTree.Node>node, message: 'Expected an assignment or function call and instead saw an expression.' });
140144
}
141145
}
142146
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const dtsv = '3';
1414
const tsfmt = require('../../tsfmt.json');
1515

1616
const SRC = path.join(__dirname, '../../src');
17-
export const RECIPE_PATH = path.join(__dirname, './monaco.d.ts.recipe');
17+
export const RECIPE_PATH = path.join(__dirname, '../monaco/monaco.d.ts.recipe');
1818
const DECLARATION_PATH = path.join(__dirname, '../../src/vs/monaco.d.ts');
1919

2020
function logErr(message: any, ...rest: any[]): void {

0 commit comments

Comments
 (0)