Merge branch 'master' into remove-fields-from-irawfilematch

This commit is contained in:
Rob Lourens
2020-03-02 11:15:05 -08:00
committed by GitHub
439 changed files with 5217 additions and 4532 deletions
-1
View File
@@ -3,7 +3,6 @@
**/vs/css.build.js
**/vs/css.js
**/vs/loader.js
**/promise-polyfill/**
**/insane/**
**/marked/**
**/test/**/*.js
+2 -1
View File
@@ -35,7 +35,8 @@
"external",
"status",
"origin",
"orientation"
"orientation",
"context"
], // non-complete list of globals that are easy to access unintentionally
"no-var": "warn",
"jsdoc/no-types": "warn",
+2 -2
View File
@@ -1,7 +1,7 @@
[
{
"name": "ms-vscode.node-debug",
"version": "1.43.1",
"version": "1.43.2",
"repo": "https://github.com/Microsoft/vscode-node-debug",
"metadata": {
"id": "b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6",
@@ -46,7 +46,7 @@
},
{
"name": "ms-vscode.js-debug-nightly",
"version": "2020.2.2507",
"version": "2020.2.2617",
"forQualities": [
"insider"
],
+1 -6
View File
@@ -72,13 +72,8 @@ const extractEditorSrcTask = task.define('extract-editor-src', () => {
apiusages,
extrausages
],
libs: [
`lib.es5.d.ts`,
`lib.dom.d.ts`,
`lib.webworker.importscripts.d.ts`
],
shakeLevel: 2, // 0-Files, 1-InnerFile, 2-ClassMembers
importIgnorePattern: /(^vs\/css!)|(promise-polyfill\/polyfill)/,
importIgnorePattern: /(^vs\/css!)/,
destRoot: path.join(root, 'out-editor-src'),
redirects: []
});
-1
View File
@@ -114,7 +114,6 @@ const copyrightFilter = [
'!**/*.disabled',
'!**/*.code-workspace',
'!**/*.js.map',
'!**/promise-polyfill/polyfill.js',
'!build/**/*.init',
'!resources/linux/snap/snapcraft.yaml',
'!resources/linux/snap/electron-launch',
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAsar = void 0;
const path = require("path");
const es = require("event-stream");
const pickle = require('chromium-pickle-js');
+1
View File
@@ -4,6 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.bundle = void 0;
const fs = require("fs");
const path = require("path");
const vm = require("vm");
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchTask = exports.compileTask = void 0;
const es = require("event-stream");
const fs = require("fs");
const gulp = require("gulp");
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = exports.getElectronVersion = void 0;
const fs = require("fs");
const path = require("path");
const vfs = require("vinyl-fs");
+1
View File
@@ -4,6 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createImportRuleListener = void 0;
function createImportRuleListener(validateImport) {
function _checkImport(node) {
if (node && node.type === 'Literal' && typeof node.value === 'string') {
+1
View File
@@ -4,6 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageMarketplaceExtensionsStream = exports.packageLocalExtensionsStream = exports.fromMarketplace = void 0;
const es = require("event-stream");
const fs = require("fs");
const glob = require("glob");
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.getVersion = void 0;
const path = require("path");
const fs = require("fs");
/**
+146 -142
View File
@@ -4,6 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareIslFiles = exports.prepareI18nPackFiles = exports.pullI18nPackFiles = exports.prepareI18nFiles = exports.pullSetupXlfFiles = exports.pullCoreAndExtensionsXlfFiles = exports.findObsoleteResources = exports.pushXlfFiles = exports.createXlfFilesForIsl = exports.createXlfFilesForExtensions = exports.createXlfFilesForCoreBundle = exports.getResource = exports.processNlsFiles = exports.Limiter = exports.XLF = exports.Line = exports.externalExtensionsWithTranslations = exports.extraLanguages = exports.defaultLanguages = void 0;
const path = require("path");
const fs = require("fs");
const event_stream_1 = require("event-stream");
@@ -100,155 +101,158 @@ class TextModel {
return this._lines;
}
}
class XLF {
constructor(project) {
this.project = project;
this.buffer = [];
this.files = Object.create(null);
this.numberOfMessages = 0;
}
toString() {
this.appendHeader();
for (let file in this.files) {
this.appendNewLine(`<file original="${file}" source-language="en" datatype="plaintext"><body>`, 2);
for (let item of this.files[file]) {
this.addStringItem(item);
}
this.appendNewLine('</body></file>', 2);
let XLF = /** @class */ (() => {
class XLF {
constructor(project) {
this.project = project;
this.buffer = [];
this.files = Object.create(null);
this.numberOfMessages = 0;
}
this.appendFooter();
return this.buffer.join('\r\n');
}
addFile(original, keys, messages) {
if (keys.length === 0) {
console.log('No keys in ' + original);
return;
}
if (keys.length !== messages.length) {
throw new Error(`Unmatching keys(${keys.length}) and messages(${messages.length}).`);
}
this.numberOfMessages += keys.length;
this.files[original] = [];
let existingKeys = new Set();
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
let realKey;
let comment;
if (Is.string(key)) {
realKey = key;
comment = undefined;
}
else if (LocalizeInfo.is(key)) {
realKey = key.key;
if (key.comment && key.comment.length > 0) {
comment = key.comment.map(comment => encodeEntities(comment)).join('\r\n');
toString() {
this.appendHeader();
for (let file in this.files) {
this.appendNewLine(`<file original="${file}" source-language="en" datatype="plaintext"><body>`, 2);
for (let item of this.files[file]) {
this.addStringItem(item);
}
this.appendNewLine('</body></file>', 2);
}
if (!realKey || existingKeys.has(realKey)) {
continue;
this.appendFooter();
return this.buffer.join('\r\n');
}
addFile(original, keys, messages) {
if (keys.length === 0) {
console.log('No keys in ' + original);
return;
}
existingKeys.add(realKey);
let message = encodeEntities(messages[i]);
this.files[original].push({ id: realKey, message: message, comment: comment });
if (keys.length !== messages.length) {
throw new Error(`Unmatching keys(${keys.length}) and messages(${messages.length}).`);
}
this.numberOfMessages += keys.length;
this.files[original] = [];
let existingKeys = new Set();
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
let realKey;
let comment;
if (Is.string(key)) {
realKey = key;
comment = undefined;
}
else if (LocalizeInfo.is(key)) {
realKey = key.key;
if (key.comment && key.comment.length > 0) {
comment = key.comment.map(comment => encodeEntities(comment)).join('\r\n');
}
}
if (!realKey || existingKeys.has(realKey)) {
continue;
}
existingKeys.add(realKey);
let message = encodeEntities(messages[i]);
this.files[original].push({ id: realKey, message: message, comment: comment });
}
}
addStringItem(item) {
if (!item.id || !item.message) {
throw new Error(`No item ID or value specified: ${JSON.stringify(item)}`);
}
this.appendNewLine(`<trans-unit id="${item.id}">`, 4);
this.appendNewLine(`<source xml:lang="en">${item.message}</source>`, 6);
if (item.comment) {
this.appendNewLine(`<note>${item.comment}</note>`, 6);
}
this.appendNewLine('</trans-unit>', 4);
}
appendHeader() {
this.appendNewLine('<?xml version="1.0" encoding="utf-8"?>', 0);
this.appendNewLine('<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">', 0);
}
appendFooter() {
this.appendNewLine('</xliff>', 0);
}
appendNewLine(content, indent) {
let line = new Line(indent);
line.append(content);
this.buffer.push(line.toString());
}
}
addStringItem(item) {
if (!item.id || !item.message) {
throw new Error(`No item ID or value specified: ${JSON.stringify(item)}`);
}
this.appendNewLine(`<trans-unit id="${item.id}">`, 4);
this.appendNewLine(`<source xml:lang="en">${item.message}</source>`, 6);
if (item.comment) {
this.appendNewLine(`<note>${item.comment}</note>`, 6);
}
this.appendNewLine('</trans-unit>', 4);
}
appendHeader() {
this.appendNewLine('<?xml version="1.0" encoding="utf-8"?>', 0);
this.appendNewLine('<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">', 0);
}
appendFooter() {
this.appendNewLine('</xliff>', 0);
}
appendNewLine(content, indent) {
let line = new Line(indent);
line.append(content);
this.buffer.push(line.toString());
}
}
XLF.parsePseudo = function (xlfString) {
return new Promise((resolve) => {
let parser = new xml2js.Parser();
let files = [];
parser.parseString(xlfString, function (_err, result) {
const fileNodes = result['xliff']['file'];
fileNodes.forEach(file => {
const originalFilePath = file.$.original;
const messages = {};
const transUnits = file.body[0]['trans-unit'];
if (transUnits) {
transUnits.forEach((unit) => {
const key = unit.$.id;
const val = pseudify(unit.source[0]['_'].toString());
if (key && val) {
messages[key] = decodeEntities(val);
}
});
files.push({ messages: messages, originalFilePath: originalFilePath, language: 'ps' });
}
});
resolve(files);
});
});
};
XLF.parse = function (xlfString) {
return new Promise((resolve, reject) => {
let parser = new xml2js.Parser();
let files = [];
parser.parseString(xlfString, function (err, result) {
if (err) {
reject(new Error(`XLF parsing error: Failed to parse XLIFF string. ${err}`));
}
const fileNodes = result['xliff']['file'];
if (!fileNodes) {
reject(new Error(`XLF parsing error: XLIFF file does not contain "xliff" or "file" node(s) required for parsing.`));
}
fileNodes.forEach((file) => {
const originalFilePath = file.$.original;
if (!originalFilePath) {
reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`));
}
let language = file.$['target-language'];
if (!language) {
reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`));
}
const messages = {};
const transUnits = file.body[0]['trans-unit'];
if (transUnits) {
transUnits.forEach((unit) => {
const key = unit.$.id;
if (!unit.target) {
return; // No translation available
}
let val = unit.target[0];
if (typeof val !== 'string') {
val = val._;
}
if (key && val) {
messages[key] = decodeEntities(val);
}
else {
reject(new Error(`XLF parsing error: XLIFF file ${originalFilePath} does not contain full localization data. ID or target translation for one of the trans-unit nodes is not present.`));
}
});
files.push({ messages: messages, originalFilePath: originalFilePath, language: language.toLowerCase() });
}
});
resolve(files);
});
});
};
return XLF;
})();
exports.XLF = XLF;
XLF.parsePseudo = function (xlfString) {
return new Promise((resolve) => {
let parser = new xml2js.Parser();
let files = [];
parser.parseString(xlfString, function (_err, result) {
const fileNodes = result['xliff']['file'];
fileNodes.forEach(file => {
const originalFilePath = file.$.original;
const messages = {};
const transUnits = file.body[0]['trans-unit'];
if (transUnits) {
transUnits.forEach((unit) => {
const key = unit.$.id;
const val = pseudify(unit.source[0]['_'].toString());
if (key && val) {
messages[key] = decodeEntities(val);
}
});
files.push({ messages: messages, originalFilePath: originalFilePath, language: 'ps' });
}
});
resolve(files);
});
});
};
XLF.parse = function (xlfString) {
return new Promise((resolve, reject) => {
let parser = new xml2js.Parser();
let files = [];
parser.parseString(xlfString, function (err, result) {
if (err) {
reject(new Error(`XLF parsing error: Failed to parse XLIFF string. ${err}`));
}
const fileNodes = result['xliff']['file'];
if (!fileNodes) {
reject(new Error(`XLF parsing error: XLIFF file does not contain "xliff" or "file" node(s) required for parsing.`));
}
fileNodes.forEach((file) => {
const originalFilePath = file.$.original;
if (!originalFilePath) {
reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`));
}
let language = file.$['target-language'];
if (!language) {
reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`));
}
const messages = {};
const transUnits = file.body[0]['trans-unit'];
if (transUnits) {
transUnits.forEach((unit) => {
const key = unit.$.id;
if (!unit.target) {
return; // No translation available
}
let val = unit.target[0];
if (typeof val !== 'string') {
val = val._;
}
if (key && val) {
messages[key] = decodeEntities(val);
}
else {
reject(new Error(`XLF parsing error: XLIFF file ${originalFilePath} does not contain full localization data. ID or target translation for one of the trans-unit nodes is not present.`));
}
});
files.push({ messages: messages, originalFilePath: originalFilePath, language: language.toLowerCase() });
}
});
resolve(files);
});
});
};
class Limiter {
constructor(maxDegreeOfParalellism) {
this.maxDegreeOfParalellism = maxDegreeOfParalellism;
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.minifyTask = exports.optimizeTask = exports.loaderConfig = void 0;
const es = require("event-stream");
const fs = require("fs");
const gulp = require("gulp");
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.createReporter = void 0;
const es = require("event-stream");
const _ = require("underscore");
const fancyLog = require("fancy-log");
+1
View File
@@ -4,6 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createESMSourcesAndResources2 = exports.extractEditor = void 0;
const ts = require("typescript");
const fs = require("fs");
const path = require("path");
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.submitAllStats = exports.createStatsStream = void 0;
const es = require("event-stream");
const fancyLog = require("fancy-log");
const ansiColors = require("ansi-colors");
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.define = exports.parallel = exports.series = void 0;
const fancyLog = require("fancy-log");
const ansiColors = require("ansi-colors");
function _isPromise(p) {
+25 -5
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.shake = exports.toStringShakeLevel = exports.ShakeLevel = void 0;
const fs = require("fs");
const path = require("path");
const ts = require("typescript");
@@ -75,11 +76,7 @@ function createTypeScriptLanguageService(options) {
FILES[typing] = fs.readFileSync(filePath).toString();
});
// Resolve libs
const RESOLVED_LIBS = {};
options.libs.forEach((filename) => {
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
RESOLVED_LIBS[`defaultLib:${filename}`] = fs.readFileSync(filepath).toString();
});
const RESOLVED_LIBS = processLibFiles(options);
const compilerOptions = ts.convertCompilerOptionsFromJson(options.compilerOptions, options.sourcesRoot).options;
const host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, compilerOptions);
return ts.createLanguageService(host);
@@ -137,6 +134,29 @@ function discoverAndReadFiles(options) {
}
return FILES;
}
/**
* Read lib files and follow lib references
*/
function processLibFiles(options) {
const stack = [...options.compilerOptions.lib];
const result = {};
while (stack.length > 0) {
const filename = `lib.${stack.shift().toLowerCase()}.d.ts`;
const key = `defaultLib:${filename}`;
if (!result[key]) {
// add this file
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
const sourceText = fs.readFileSync(filepath).toString();
result[key] = sourceText;
// precess dependencies and "recurse"
const info = ts.preProcessFile(sourceText);
for (let ref of info.libReferenceDirectives) {
stack.push(ref.fileName);
}
}
}
return result;
}
/**
* A TypeScript language service host
*/
+31 -12
View File
@@ -18,7 +18,7 @@ export const enum ShakeLevel {
}
export function toStringShakeLevel(shakeLevel: ShakeLevel): string {
switch(shakeLevel) {
switch (shakeLevel) {
case ShakeLevel.Files:
return 'Files (0)';
case ShakeLevel.InnerFile:
@@ -42,11 +42,6 @@ export interface ITreeShakingOptions {
* Inline usages.
*/
inlineEntryPoints: string[];
/**
* TypeScript libs.
* e.g. `lib.d.ts`, `lib.es2015.collection.d.ts`
*/
libs: string[];
/**
* Other .d.ts files
*/
@@ -130,11 +125,7 @@ function createTypeScriptLanguageService(options: ITreeShakingOptions): ts.Langu
});
// Resolve libs
const RESOLVED_LIBS: ILibMap = {};
options.libs.forEach((filename) => {
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
RESOLVED_LIBS[`defaultLib:${filename}`] = fs.readFileSync(filepath).toString();
});
const RESOLVED_LIBS = processLibFiles(options);
const compilerOptions = ts.convertCompilerOptionsFromJson(options.compilerOptions, options.sourcesRoot).options;
@@ -205,6 +196,34 @@ function discoverAndReadFiles(options: ITreeShakingOptions): IFileMap {
return FILES;
}
/**
* Read lib files and follow lib references
*/
function processLibFiles(options: ITreeShakingOptions): ILibMap {
const stack: string[] = [...options.compilerOptions.lib];
const result: ILibMap = {};
while (stack.length > 0) {
const filename = `lib.${stack.shift()!.toLowerCase()}.d.ts`;
const key = `defaultLib:${filename}`;
if (!result[key]) {
// add this file
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
const sourceText = fs.readFileSync(filepath).toString();
result[key] = sourceText;
// precess dependencies and "recurse"
const info = ts.preProcessFile(sourceText);
for (let ref of info.libReferenceDirectives) {
stack.push(ref.fileName);
}
}
}
return result;
}
interface ILibMap { [libName: string]: string; }
interface IFileMap { [fileName: string]: string; }
@@ -475,7 +494,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)) {
+1
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.streamToPromise = exports.versionStringToNumber = exports.filter = exports.rebase = exports.getVersion = exports.ensureDir = exports.rreddir = exports.rimraf = exports.stripSourceMappingURL = exports.loadSourcemaps = exports.cleanNodeModules = exports.skipDirectories = exports.toFileUri = exports.setExecutableBit = exports.fixWin32DirectoryPermissions = exports.incremental = void 0;
const es = require("event-stream");
const debounce = require("debounce");
const _filter = require("gulp-filter");
-26
View File
@@ -33,32 +33,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
END OF nodejs path library NOTICES AND INFORMATION
%% promise-polyfill version 8.1.0 (https://github.com/taylorhakes/promise-polyfill)
=========================================
Copyright (c) 2014 Taylor Hakes
Copyright (c) 2014 Forbes Lindesay
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
=========================================
END OF winjs NOTICES AND INFORMATION
%% string_scorer version 0.1.20 (https://github.com/joshaven/string_score)
+1
View File
@@ -4,6 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.execute = exports.run3 = exports.DeclarationResolver = exports.FSProvider = exports.RECIPE_PATH = void 0;
const fs = require("fs");
const ts = require("typescript");
const path = require("path");
+1 -1
View File
@@ -43,7 +43,7 @@
"minimist": "^1.2.0",
"request": "^2.85.0",
"terser": "4.3.8",
"typescript": "3.8.2",
"typescript": "^3.9.0-dev.20200229",
"vsce": "1.48.0",
"vscode-telemetry-extractor": "^1.5.4",
"xml2js": "^0.4.17"
+5 -5
View File
@@ -2453,16 +2453,16 @@ typed-rest-client@^0.9.0:
tunnel "0.0.4"
underscore "1.8.3"
typescript@3.8.2:
version "3.8.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.2.tgz#91d6868aaead7da74f493c553aeff76c0c0b1d5a"
integrity sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==
typescript@^3.0.1:
version "3.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"
integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==
typescript@^3.9.0-dev.20200229:
version "3.9.0-dev.20200229"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.0-dev.20200229.tgz#45f0821d5c420a4c7d6d894c64531e1301dfa9bd"
integrity sha512-DtSLzxoiUir0qRc3+JJBxiAe6NvTEM3uDxnPxVWJU6sRDhUi8Ssx6DBjGWCZAQJlLk5A+jk2ptf3JvvZrQlLNQ==
typical@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4"
+7 -7
View File
@@ -1825,37 +1825,37 @@
},
"viewsWelcome": [
{
"view": "workbench.scm",
"view": "scm",
"contents": "%view.workbench.scm.disabled%",
"when": "!config.git.enabled"
},
{
"view": "workbench.scm",
"view": "scm",
"contents": "%view.workbench.scm.missing%",
"when": "config.git.enabled && git.missing"
},
{
"view": "workbench.scm",
"view": "scm",
"contents": "%view.workbench.scm.empty%",
"when": "config.git.enabled && !git.missing && workbenchState == empty"
},
{
"view": "workbench.scm",
"view": "scm",
"contents": "%view.workbench.scm.folder%",
"when": "config.git.enabled && !git.missing && workbenchState == folder"
},
{
"view": "workbench.scm",
"view": "scm",
"contents": "%view.workbench.scm.workspace%",
"when": "config.git.enabled && !git.missing && workbenchState == workspace && workspaceFolderCount != 0"
},
{
"view": "workbench.scm",
"view": "scm",
"contents": "%view.workbench.scm.emptyWorkspace%",
"when": "config.git.enabled && !git.missing && workbenchState == workspace && workspaceFolderCount == 0"
},
{
"view": "workbench.explorer.emptyView",
"view": "explorer",
"contents": "%view.workbench.cloneRepository%"
}
]
+7 -7
View File
@@ -150,11 +150,11 @@
"colors.ignored": "Color for ignored resources.",
"colors.conflict": "Color for resources with conflicts.",
"colors.submodule": "Color for submodule resources.",
"view.workbench.scm.missing": "A valid git installation was not detected, more details can be found in the [git output](command:git.showOutput).\nPlease [install git](https://git-scm.com/), or learn more about how to use Git and source control in VS Code in [our docs](https://aka.ms/vscode-scm).\nIf you're using a different version control system, you can [search the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22) for additional extensions.",
"view.workbench.scm.disabled": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.empty": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.folder": "The folder currently open doesn't have a git repository.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.workspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Initialize Repository](command:git.init)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.emptyWorkspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.cloneRepository": "You can also clone a repository from a URL. To learn more about how to use Git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).\n[Clone Repository](command:git.clone)"
"view.workbench.scm.missing": "A valid git installation was not detected, more details can be found in the [git output](command:git.showOutput).\nPlease [install git](https://git-scm.com/), or learn more about how to use git and source control in VS Code in [our docs](https://aka.ms/vscode-scm).\nIf you're using a different version control system, you can [search the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22) for additional extensions.",
"view.workbench.scm.disabled": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.empty": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.folder": "The folder currently open doesn't have a git repository.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.workspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.emptyWorkspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.cloneRepository": "You can also clone a repository from a URL. To learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).\n[Clone Repository](command:git.clone)"
}
+6 -2
View File
@@ -1397,12 +1397,16 @@ export class CommandCenter {
opts.signoff = true;
}
const smartCommitChanges = config.get<'all' | 'tracked'>('smartCommitChanges');
if (
(
// no changes
(noStagedChanges && noUnstagedChanges)
// or no staged changes and not `all`
|| (!opts.all && noStagedChanges)
// no staged changes and no tracked unstaged changes
|| (noStagedChanges && smartCommitChanges === 'tracked' && repository.workingTreeGroup.resourceStates.every(r => r.type === Status.UNTRACKED))
)
&& !opts.empty
) {
@@ -1416,7 +1420,7 @@ export class CommandCenter {
return false;
}
if (opts.all && config.get<'all' | 'tracked'>('smartCommitChanges') === 'tracked') {
if (opts.all && smartCommitChanges === 'tracked') {
opts.all = 'tracked';
}
@@ -2353,7 +2357,7 @@ export class CommandCenter {
else if (item.previousRef === 'HEAD' && item.ref === '~') {
title = localize('git.title.index', '{0} (Index)', basename);
} else {
title = localize('git.title.diffRefs', '{0} ({1}) \u27f7 {0} ({2})', basename, item.shortPreviousRef, item.shortRef);
title = localize('git.title.diffRefs', '{0} ({1}) {0} ({2})', basename, item.shortPreviousRef, item.shortRef);
}
return commands.executeCommand('vscode.diff', toGitUri(uri, item.previousRef), item.ref === '' ? uri : toGitUri(uri, item.ref), title);
+5 -5
View File
@@ -80,7 +80,7 @@ export class GitTimelineProvider implements TimelineProvider {
constructor(private readonly _model: Model) {
this._disposable = Disposable.from(
_model.onDidOpenRepository(this.onRepositoriesChanged, this),
workspace.registerTimelineProvider('*', this),
workspace.registerTimelineProvider(['file', 'git', 'gitlens-git'], this),
);
}
@@ -114,9 +114,9 @@ export class GitTimelineProvider implements TimelineProvider {
// TODO[ECA]: Ensure that the uri is a file -- if not we could get the history of the repo?
let limit: number | undefined;
if (typeof options.limit === 'string') {
if (options.limit !== undefined && typeof options.limit !== 'number') {
try {
const result = await this._model.git.exec(repo.root, ['rev-list', '--count', `${options.limit}..`, '--', uri.fsPath]);
const result = await this._model.git.exec(repo.root, ['rev-list', '--count', `${options.limit.cursor}..`, '--', uri.fsPath]);
if (!result.exitCode) {
// Ask for 1 more than so we can determine if there are more commits
limit = Number(result.stdout) + 1;
@@ -182,7 +182,7 @@ export class GitTimelineProvider implements TimelineProvider {
const item = new GitTimelineItem('~', 'HEAD', localize('git.timeline.stagedChanges', 'Staged Changes'), date.getTime(), 'index', 'git:file:index');
// TODO[ECA]: Replace with a better icon -- reflecting its status maybe?
item.iconPath = new (ThemeIcon as any)('git-commit');
item.description = you;
item.description = '';
item.detail = localize('git.timeline.detail', '{0} \u2014 {1}\n{2}\n\n{3}', you, localize('git.index', 'Index'), dateFormatter.format('MMMM Do, YYYY h:mma'), Resource.getStatusText(index.type));
item.command = {
title: 'Open Comparison',
@@ -201,7 +201,7 @@ export class GitTimelineProvider implements TimelineProvider {
const item = new GitTimelineItem('', index ? '~' : 'HEAD', localize('git.timeline.uncommitedChanges', 'Uncommited Changes'), date.getTime(), 'working', 'git:file:working');
// TODO[ECA]: Replace with a better icon -- reflecting its status maybe?
item.iconPath = new (ThemeIcon as any)('git-commit');
item.description = you;
item.description = '';
item.detail = localize('git.timeline.detail', '{0} \u2014 {1}\n{2}\n\n{3}', you, localize('git.workingTree', 'Working Tree'), dateFormatter.format('MMMM Do, YYYY h:mma'), Resource.getStatusText(working.type));
item.command = {
title: 'Open Comparison',
@@ -16,7 +16,7 @@ export async function activate(context: vscode.ExtensionContext) {
await loginService.initialize();
vscode.authentication.registerAuthenticationProvider({
id: 'GitHub',
id: 'github',
displayName: 'GitHub',
onDidChangeSessions: onDidChangeSessions.event,
getSessions: () => Promise.resolve(loginService.sessions),
@@ -71,7 +71,7 @@ export class GitHubAuthenticationProvider {
id: session.id,
accountName: session.accountName,
scopes: session.scopes,
accessToken: () => Promise.resolve(session.accessToken)
getAccessToken: () => Promise.resolve(session.accessToken)
};
});
} catch (e) {
@@ -84,7 +84,7 @@ export class GitHubAuthenticationProvider {
private async storeSessions(): Promise<void> {
const sessionData: SessionData[] = await Promise.all(this._sessions.map(async session => {
const resolvedAccessToken = await session.accessToken();
const resolvedAccessToken = await session.getAccessToken();
return {
id: session.id,
accountName: session.accountName,
@@ -111,7 +111,7 @@ export class GitHubAuthenticationProvider {
const userInfo = await this._githubServer.getUserInfo(token);
return {
id: userInfo.id,
accessToken: () => Promise.resolve(token),
getAccessToken: () => Promise.resolve(token),
accountName: userInfo.accountName,
scopes: scopes
};
+1 -1
View File
@@ -17,7 +17,7 @@
"Other"
],
"activationEvents": [
"onWebviewEditor:imagePreview.previewEditor",
"onCustomEditor:imagePreview.previewEditor",
"onCommand:imagePreview.zoomIn",
"onCommand:imagePreview.zoomOut"
],
@@ -160,7 +160,10 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
formatterMaxNumberOfEdits = params.initializationOptions?.customCapabilities?.rangeFormatting?.editLimit || Number.MAX_VALUE;
const capabilities: ServerCapabilities = {
textDocumentSync: TextDocumentSyncKind.Incremental,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['"', ':'] } : undefined,
completionProvider: clientSnippetSupport ? {
resolveProvider: false, // turn off resolving as the current language service doesn't do anything on resolve. Also fixes #91747
triggerCharacters: ['"', ':']
} : undefined,
hoverProvider: true,
documentSymbolProvider: true,
documentRangeFormattingProvider: params.initializationOptions.provideFormatter === true,
@@ -26,7 +26,7 @@
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.api.render",
"onWebviewPanel:markdown.preview",
"onWebviewEditor:vscode.markdown.preview.editor"
"onCustomEditor:vscode.markdown.preview.editor"
],
"contributes": {
"commands": [
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "3.8.2"
"typescript": "3.8.3"
},
"scripts": {
"postinstall": "node ./postinstall"
@@ -638,6 +638,42 @@
"description": "%typescript.preferences.importModuleSpecifier%",
"scope": "resource"
},
"javascript.preferences.importModuleSpecifierEnding": {
"type": "string",
"enum": [
"auto",
"minimal",
"index",
"js"
],
"markdownEnumDescriptions": [
"%typescript.preferences.importModuleSpecifierEnding.auto%",
"%typescript.preferences.importModuleSpecifierEnding.minimal%",
"%typescript.preferences.importModuleSpecifierEnding.index%",
"%typescript.preferences.importModuleSpecifierEnding.js%"
],
"default": "auto",
"description": "%typescript.preferences.importModuleSpecifierEnding%",
"scope": "resource"
},
"typescript.preferences.importModuleSpecifierEnding": {
"type": "string",
"enum": [
"auto",
"minimal",
"index",
"js"
],
"markdownEnumDescriptions": [
"%typescript.preferences.importModuleSpecifierEnding.auto%",
"%typescript.preferences.importModuleSpecifierEnding.minimal%",
"%typescript.preferences.importModuleSpecifierEnding.index%",
"%typescript.preferences.importModuleSpecifierEnding.js%"
],
"default": "auto",
"description": "%typescript.preferences.importModuleSpecifierEnding%",
"scope": "resource"
},
"javascript.preferences.renameShorthandProperties": {
"type": "boolean",
"default": true,
@@ -70,6 +70,11 @@
"typescript.preferences.importModuleSpecifier.auto": "Automatically select import path style. Prefers using a relative import if `baseUrl` is configured and the relative path has fewer segments than the non-relative import.",
"typescript.preferences.importModuleSpecifier.relative": "Relative to the file location.",
"typescript.preferences.importModuleSpecifier.nonRelative": "Based on the `baseUrl` configured in your `jsconfig.json` / `tsconfig.json`.",
"typescript.preferences.importModuleSpecifierEnding": "Preferred path ending for auto imports.",
"typescript.preferences.importModuleSpecifierEnding.auto": "Use project settings to select a default.",
"typescript.preferences.importModuleSpecifierEnding.minimal": "Shorten `./component/index.js` to `./component`.",
"typescript.preferences.importModuleSpecifierEnding.index": "Shorten `./component/index.js` to `./component/index`",
"typescript.preferences.importModuleSpecifierEnding.js": "Do not shorten path endings; include the `.js` extension.",
"typescript.updateImportsOnFileMove.enabled": "Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Requires using TypeScript 2.9 or newer in the workspace.",
"typescript.updateImportsOnFileMove.enabled.prompt": "Prompt on each rename.",
"typescript.updateImportsOnFileMove.enabled.always": "Always update paths automatically.",
@@ -7,9 +7,10 @@ import * as vscode from 'vscode';
import type * as Proto from '../protocol';
import { ITypeScriptServiceClient } from '../typescriptService';
import API from '../utils/api';
import { Disposable } from '../utils/dispose';
import * as fileSchemes from '../utils/fileSchemes';
import { isTypeScriptDocument } from '../utils/languageModeIds';
import { ResourceMap } from '../utils/resourceMap';
import { Disposable } from '../utils/dispose';
function objsAreEqual<T>(a: T, b: T): boolean {
@@ -144,9 +145,7 @@ export default class FileConfigurationManager extends Disposable {
isTypeScriptDocument(document) ? 'typescript.format' : 'javascript.format',
document.uri);
// `semicolons` added to `Proto.FormatCodeSettings` in TypeScript 3.7:
// remove intersection type after upgrading TypeScript.
const settings: Proto.FormatCodeSettings & { semicolons?: string } = {
return {
tabSize: options.tabSize,
indentSize: options.tabSize,
convertTabsToSpaces: options.insertSpaces,
@@ -169,8 +168,6 @@ export default class FileConfigurationManager extends Disposable {
placeOpenBraceOnNewLineForControlBlocks: config.get<boolean>('placeOpenBraceOnNewLineForControlBlocks'),
semicolons: config.get<Proto.SemicolonPreference>('semicolons'),
};
return settings;
}
private getPreferences(document: vscode.TextDocument): Proto.UserPreferences {
@@ -182,13 +179,18 @@ export default class FileConfigurationManager extends Disposable {
isTypeScriptDocument(document) ? 'typescript.preferences' : 'javascript.preferences',
document.uri);
return {
// `importModuleSpecifierEnding` added to `Proto.UserPreferences` in TypeScript 3.9:
// remove intersection type after upgrading TypeScript.
const preferences: Proto.UserPreferences & { importModuleSpecifierEnding?: string } = {
quotePreference: this.getQuoteStylePreference(config),
importModuleSpecifierPreference: getImportModuleSpecifierPreference(config),
allowTextChangesInNewFiles: document.uri.scheme === 'file',
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(config),
allowTextChangesInNewFiles: document.uri.scheme === fileSchemes.file,
providePrefixAndSuffixTextForRename: config.get<boolean>('renameShorthandProperties', true),
allowRenameOfImportPath: true,
};
return preferences;
}
private getQuoteStylePreference(config: vscode.WorkspaceConfiguration) {
@@ -207,3 +209,12 @@ function getImportModuleSpecifierPreference(config: vscode.WorkspaceConfiguratio
default: return undefined;
}
}
function getImportModuleSpecifierEndingPreference(config: vscode.WorkspaceConfiguration) {
switch (config.get<string>('importModuleSpecifierEnding')) {
case 'minimal': return 'minimal';
case 'index': return 'index';
case 'js': return 'js';
default: return 'auto';
}
}
@@ -735,7 +735,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
"command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this.logTelemetry('fatalError', { command, ...(error instanceof TypeScriptServerError ? error.telemetry : {}) });
this.logTelemetry('fatalError', { ...(error instanceof TypeScriptServerError ? error.telemetry : { command }) });
console.error(`A non-recoverable error occured while executing tsserver command: ${command}`);
if (error instanceof TypeScriptServerError && error.serverErrorText) {
console.error(error.serverErrorText);
+3
View File
@@ -39,5 +39,8 @@
"tslint": "^5.12.1",
"@types/node": "^10.12.21",
"@types/keytar": "^4.0.1"
},
"dependencies": {
"vscode-nls": "^4.1.1"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"displayName": "Microsoft Account",
"description": "Microsoft authentication provider",
"signIn": "Sign in",
"signOut": "Sign out"
"signIn": "Sign In",
"signOut": "Sign Out"
}
+4 -2
View File
@@ -184,7 +184,7 @@ export class AzureActiveDirectoryService {
private convertToSession(token: IToken): vscode.AuthenticationSession {
return {
id: token.sessionId,
accessToken: () => this.resolveAccessToken(token),
getAccessToken: () => this.resolveAccessToken(token),
accountName: token.accountName,
scopes: token.scope.split(' ')
};
@@ -192,7 +192,9 @@ export class AzureActiveDirectoryService {
private async resolveAccessToken(token: IToken): Promise<string> {
if (token.accessToken && (!token.expiresAt || token.expiresAt > Date.now())) {
Logger.info('Token available from cache');
token.expiresAt
? Logger.info(`Token available from cache, expires in ${token.expiresAt - Date.now()} milliseconds`)
: Logger.info('Token available from cache');
return Promise.resolve(token.accessToken);
}
+6 -1
View File
@@ -5,6 +5,9 @@
import * as vscode from 'vscode';
import { AzureActiveDirectoryService, onDidChangeSessions } from './AADHelper';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
export const DEFAULT_SCOPES = 'https://management.core.windows.net/.default offline_access';
@@ -15,7 +18,7 @@ export async function activate(context: vscode.ExtensionContext) {
await loginService.initialize();
context.subscriptions.push(vscode.authentication.registerAuthenticationProvider({
id: 'MSA',
id: 'microsoft',
displayName: 'Microsoft',
onDidChangeSessions: onDidChangeSessions.event,
getSessions: () => Promise.resolve(loginService.sessions),
@@ -45,6 +48,7 @@ export async function activate(context: vscode.ExtensionContext) {
if (sessions.length === 1) {
await loginService.logout(loginService.sessions[0].id);
onDidChangeSessions.fire();
vscode.window.showInformationMessage(localize('signedOut', "Successfully signed out."));
return;
}
@@ -58,6 +62,7 @@ export async function activate(context: vscode.ExtensionContext) {
if (selectedSession) {
await loginService.logout(selectedSession.id);
onDidChangeSessions.fire();
vscode.window.showInformationMessage(localize('signedOut', "Successfully signed out."));
return;
}
}));
+5
View File
@@ -635,6 +635,11 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1:
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
vscode-nls@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c"
integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==
which-pm-runs@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb"
+4 -4
View File
@@ -2,7 +2,7 @@
# yarn lockfile v1
typescript@3.8.2:
version "3.8.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.2.tgz#91d6868aaead7da74f493c553aeff76c0c0b1d5a"
integrity sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==
typescript@3.8.3:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.43.0",
"distro": "d9ed2bff7e779c71264b0c08311d08192924f473",
"version": "1.44.0",
"distro": "5ddb4bf6f3cbd0c5940960a7dd5dd3790d1d844e",
"author": {
"name": "Microsoft Corporation"
},
@@ -150,13 +150,13 @@
"source-map": "^0.4.4",
"style-loader": "^1.0.0",
"ts-loader": "^4.4.2",
"typescript": "3.8.2",
"typescript": "^3.9.0-dev.20200229",
"typescript-formatter": "7.1.0",
"underscore": "^1.8.2",
"vinyl": "^2.0.0",
"vinyl-fs": "^3.0.0",
"vsce": "1.48.0",
"vscode-debugprotocol": "1.39.0-pre.0",
"vscode-debugprotocol": "1.39.0",
"vscode-nls-dev": "^3.3.1",
"webpack": "^4.16.5",
"webpack-cli": "^3.3.8",
@@ -177,4 +177,4 @@
"windows-mutex": "0.3.0",
"windows-process-tree": "0.2.4"
}
}
}
+10 -10
View File
@@ -2,7 +2,7 @@
# On Fedora $SNAP is under /var and there is some magic to map it to /snap.
# We need to handle that case and reset $SNAP
SNAP=$(echo $SNAP | sed -e "s|/var/lib/snapd||g")
SNAP=$(echo "$SNAP" | sed -e "s|/var/lib/snapd||g")
if [ "$SNAP_ARCH" == "amd64" ]; then
ARCH="x86_64-linux-gnu"
@@ -14,21 +14,21 @@ else
ARCH="$SNAP_ARCH-linux-gnu"
fi
export XDG_CACHE_HOME=$SNAP_USER_COMMON/.cache
if [[ -d $SNAP_USER_DATA/.cache && ! -e $XDG_CACHE_HOME ]]; then
GDK_CACHE_DIR="$SNAP_USER_COMMON/.cache"
if [[ -d "$SNAP_USER_DATA/.cache" && ! -e "$GDK_CACHE_DIR" ]]; then
# the .cache directory used to be stored under $SNAP_USER_DATA, migrate it
mv $SNAP_USER_DATA/.cache $SNAP_USER_COMMON/
mv "$SNAP_USER_DATA/.cache" "$SNAP_USER_COMMON/"
fi
mkdir -p $XDG_CACHE_HOME
[ ! -d "$GDK_CACHE_DIR" ] && mkdir -p "$GDK_CACHE_DIR"
# Gdk-pixbuf loaders
export GDK_PIXBUF_MODULE_FILE=$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache
export GDK_PIXBUF_MODULEDIR=$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders
if [ -f $SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders ]; then
$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders > $GDK_PIXBUF_MODULE_FILE
export GDK_PIXBUF_MODULE_FILE="$GDK_CACHE_DIR/gdk-pixbuf-loaders.cache"
export GDK_PIXBUF_MODULEDIR="$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders"
if [ -f "$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" ]; then
"$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" > "$GDK_PIXBUF_MODULE_FILE"
fi
# Create $XDG_RUNTIME_DIR if not exists (to be removed when https://pad.lv/1656340 is fixed)
[ -n "$XDG_RUNTIME_DIR" ] && mkdir -p $XDG_RUNTIME_DIR -m 700
[ -n "$XDG_RUNTIME_DIR" ] && mkdir -p "$XDG_RUNTIME_DIR" -m 700
exec "$@"
+1 -1
View File
@@ -31,7 +31,7 @@ exports.load = function (modulePaths, resultCallback, options) {
const args = parseURLQueryArgs();
/**
* // configuration: IWindowConfiguration
* // configuration: INativeWindowConfiguration
* @type {{
* zoomLevel?: number,
* extensionDevelopmentPath?: string[],
+1 -1
View File
@@ -175,7 +175,7 @@ function configureCommandlineSwitchesSync(cliArgs) {
app.commandLine.appendSwitch('js-flags', jsFlags);
}
// TODO@Ben TODO@Deepak Electron 7 workaround for https://github.com/microsoft/vscode/issues/88873
// TODO@Deepak Electron 7 workaround for https://github.com/microsoft/vscode/issues/88873
app.commandLine.appendSwitch('disable-features', 'LayoutNG');
return argvConfig;
+8 -1
View File
@@ -12,6 +12,13 @@
"vs/*": [
"./vs/*"
]
}
},
"lib": [
"ES2015",
"ES2018.Promise",
"DOM",
"DOM.Iterable",
"WebWorker.ImportScripts"
]
}
}
-8
View File
@@ -6,11 +6,6 @@
"sourceMap": false,
"outDir": "../out",
"target": "es2017",
"lib": [
"dom",
"es5",
"es2015.iterable"
],
"types": [
"keytar",
"mocha",
@@ -22,8 +17,5 @@
"include": [
"./typings",
"./vs"
],
"exclude": [
"./typings/es6-promise.d.ts"
]
}
+1 -4
View File
@@ -8,17 +8,14 @@
"moduleResolution": "classic",
"removeComments": false,
"preserveConstEnums": true,
"target": "es5",
"target": "es6",
"sourceMap": false,
"declaration": true
},
"include": [
"typings/require.d.ts",
"typings/thenable.d.ts",
"typings/es6-promise.d.ts",
"typings/lib.es2018.promise.d.ts",
"typings/lib.array-ext.d.ts",
"typings/lib.ie11_safe_es6.d.ts",
"vs/css.d.ts",
"vs/monaco.d.ts",
"vs/nls.d.ts",
-29
View File
@@ -1,29 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// from TypeScript: lib.es2015.proxy.d.ts
interface ProxyHandler<T extends object> {
getPrototypeOf?(target: T): object | null;
setPrototypeOf?(target: T, v: any): boolean;
isExtensible?(target: T): boolean;
preventExtensions?(target: T): boolean;
getOwnPropertyDescriptor?(target: T, p: PropertyKey): PropertyDescriptor | undefined;
has?(target: T, p: PropertyKey): boolean;
get?(target: T, p: PropertyKey, receiver: any): any;
set?(target: T, p: PropertyKey, value: any, receiver: any): boolean;
deleteProperty?(target: T, p: PropertyKey): boolean;
defineProperty?(target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;
enumerate?(target: T): PropertyKey[];
ownKeys?(target: T): PropertyKey[];
apply?(target: T, thisArg: any, argArray?: any): any;
construct?(target: T, argArray: any, newTarget?: any): object;
}
interface ProxyConstructor {
revocable<T extends object>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
new <T extends object>(target: T, handler: ProxyHandler<T>): T;
}
declare var Proxy: ProxyConstructor;
-89
View File
@@ -1,89 +0,0 @@
// Type definitions for es6-promise
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Thenable<T> {
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
}
declare class Promise<T> implements Thenable<T> {
/**
* If you call resolve in the body of the callback passed to the constructor,
* your promise is fulfilled with result object passed to resolve.
* If you call reject your promise is rejected with the object passed to reject.
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
* Any errors thrown in the constructor callback will be implicitly passed to reject().
*/
constructor(callback: (resolve: (value?: T | Thenable<T>) => void, reject: (error?: any) => void) => void);
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
*
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
*
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
}
declare namespace Promise {
/**
* Make a new promise from the thenable.
* A thenable is promise-like in as far as it has a "then" method.
*/
function resolve<T>(value: T | Thenable<T>): Promise<T>;
/**
*
*/
function resolve(): Promise<void>;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
*/
function reject(error: any): Promise<any>;
function reject<T>(error: T): Promise<T>;
/**
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
* the array passed to all can be a mixture of promise-like objects and other objects.
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
*/
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>, T10 | Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
function all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
function all<T1, T2, T3, T4, T5, T6>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>, T6 | Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
function all<T1, T2, T3, T4, T5>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>, T5 | Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
function all<T1, T2, T3, T4>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable<T4>]): Promise<[T1, T2, T3, T4]>;
function all<T1, T2, T3>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>]): Promise<[T1, T2, T3]>;
function all<T1, T2>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>]): Promise<[T1, T2]>;
function all<T>(values: (T | Thenable<T>)[]): Promise<T[]>;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
function race<T>(promises: (T | Thenable<T>)[]): Promise<T>;
}
declare module 'es6-promise' {
var foo: typeof Promise; // Temp variable to reference Promise in local context
namespace rsvp {
export var Promise: typeof foo;
export function polyfill(): void;
}
export = rsvp;
}
-27
View File
@@ -1,27 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> {
/**
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
* resolved value cannot be modified from the callback.
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
* @returns A Promise for the completion of the callback.
*/
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
}
-821
View File
@@ -1,821 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Defined a subset of ES6 built ins that run in IE11
// CHECK WITH http://kangax.github.io/compat-table/es6/#ie11
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V | undefined;
has(key: K): boolean;
set(key: K, value: V): Map<K, V>;
readonly size: number;
// not supported on IE11:
// entries(): IterableIterator<[K, V]>;
// keys(): IterableIterator<K>;
// values(): IterableIterator<V>;
// [Symbol.iterator]():IterableIterator<[K,V]>;
// [Symbol.toStringTag]: string;
}
interface MapConstructor {
new <K, V>(): Map<K, V>;
readonly prototype: Map<any, any>;
// not supported on IE11:
// new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
}
declare var Map: MapConstructor;
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
readonly size: number;
// not supported on IE11:
// entries(): IterableIterator<[T, T]>;
// keys(): IterableIterator<T>;
// values(): IterableIterator<T>;
// [Symbol.iterator]():IterableIterator<T>;
// [Symbol.toStringTag]: string;
}
interface SetConstructor {
new <T>(): Set<T>;
readonly prototype: Set<any>;
// not supported on IE11:
// new <T>(iterable: Iterable<T>): Set<T>;
}
declare var Set: SetConstructor;
interface WeakMap<K extends object, V> {
delete(key: K): boolean;
get(key: K): V | undefined;
has(key: K): boolean;
// IE11 doesn't return this
// set(key: K, value?: V): this;
set(key: K, value?: V): undefined;
}
interface WeakMapConstructor {
new(): WeakMap<any, any>;
new <K extends object, V>(): WeakMap<K, V>;
// new <K, V>(entries?: [K, V][]): WeakMap<K, V>;
readonly prototype: WeakMap<object, any>;
}
declare var WeakMap: WeakMapConstructor;
// /**
// * Represents a raw buffer of binary data, which is used to store data for the
// * different typed arrays. ArrayBuffers cannot be read from or written to directly,
// * but can be passed to a typed array or DataView Object to interpret the raw
// * buffer as needed.
// */
// interface ArrayBuffer {
// /**
// * Read-only. The length of the ArrayBuffer (in bytes).
// */
// readonly byteLength: number;
// /**
// * Returns a section of an ArrayBuffer.
// */
// slice(begin: number, end?: number): ArrayBuffer;
// }
// interface ArrayBufferConstructor {
// readonly prototype: ArrayBuffer;
// new (byteLength: number): ArrayBuffer;
// isView(arg: any): arg is ArrayBufferView;
// }
// declare const ArrayBuffer: ArrayBufferConstructor;
// interface ArrayBufferView {
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// byteOffset: number;
// }
// interface DataView {
// readonly buffer: ArrayBuffer;
// readonly byteLength: number;
// readonly byteOffset: number;
// /**
// * Gets the Float32 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getFloat32(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Float64 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getFloat64(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Int8 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getInt8(byteOffset: number): number;
// /**
// * Gets the Int16 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getInt16(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Int32 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getInt32(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Uint8 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getUint8(byteOffset: number): number;
// /**
// * Gets the Uint16 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getUint16(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Gets the Uint32 value at the specified byte offset from the start of the view. There is
// * no alignment constraint; multi-byte values may be fetched from any offset.
// * @param byteOffset The place in the buffer at which the value should be retrieved.
// */
// getUint32(byteOffset: number, littleEndian?: boolean): number;
// /**
// * Stores an Float32 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Float64 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Int8 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// */
// setInt8(byteOffset: number, value: number): void;
// /**
// * Stores an Int16 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Int32 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Uint8 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// */
// setUint8(byteOffset: number, value: number): void;
// /**
// * Stores an Uint16 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;
// /**
// * Stores an Uint32 value at the specified byte offset from the start of the view.
// * @param byteOffset The place in the buffer at which the value should be set.
// * @param value The value to set.
// * @param littleEndian If false or undefined, a big-endian value should be written,
// * otherwise a little-endian value should be written.
// */
// setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;
// }
// interface DataViewConstructor {
// new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
// }
// declare const DataView: DataViewConstructor;
// /**
// * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
// * number of bytes could not be allocated an exception is raised.
// */
// interface Int8Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Int8ArrayConstructor {
// readonly prototype: Int8Array;
// new (length: number): Int8Array;
// new (array: ArrayLike<number>): Int8Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Int8Array: Int8ArrayConstructor;
// /**
// * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Uint8Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Uint8ArrayConstructor {
// readonly prototype: Uint8Array;
// new (length: number): Uint8Array;
// new (array: ArrayLike<number>): Uint8Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Uint8Array: Uint8ArrayConstructor;
// /**
// * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Int16Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Int16ArrayConstructor {
// readonly prototype: Int16Array;
// new (length: number): Int16Array;
// new (array: ArrayLike<number>): Int16Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Int16Array: Int16ArrayConstructor;
// /**
// * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Uint16Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Uint16ArrayConstructor {
// readonly prototype: Uint16Array;
// new (length: number): Uint16Array;
// new (array: ArrayLike<number>): Uint16Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Uint16Array: Uint16ArrayConstructor;
// /**
// * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Int32Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Int32ArrayConstructor {
// readonly prototype: Int32Array;
// new (length: number): Int32Array;
// new (array: ArrayLike<number>): Int32Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Int32Array: Int32ArrayConstructor;
// /**
// * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
// * requested number of bytes could not be allocated an exception is raised.
// */
// interface Uint32Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Uint32ArrayConstructor {
// readonly prototype: Uint32Array;
// new (length: number): Uint32Array;
// new (array: ArrayLike<number>): Uint32Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Uint32Array: Uint32ArrayConstructor;
// /**
// * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
// * of bytes could not be allocated an exception is raised.
// */
// interface Float32Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Float32ArrayConstructor {
// readonly prototype: Float32Array;
// new (length: number): Float32Array;
// new (array: ArrayLike<number>): Float32Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Float32Array: Float32ArrayConstructor;
// /**
// * A typed array of 64-bit float values. The contents are initialized to 0. If the requested
// * number of bytes could not be allocated an exception is raised.
// */
// interface Float64Array {
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// /**
// * The ArrayBuffer instance referenced by the array.
// */
// readonly buffer: ArrayBuffer;
// /**
// * The length in bytes of the array.
// */
// readonly byteLength: number;
// /**
// * The offset in bytes of the array.
// */
// readonly byteOffset: number;
// /**
// * The length of the array.
// */
// readonly length: number;
// /**
// * Sets a value or an array of values.
// * @param index The index of the location to set.
// * @param value The value to set.
// */
// set(index: number, value: number): void;
// /**
// * Sets a value or an array of values.
// * @param array A typed or untyped array of values to set.
// * @param offset The index in the current array at which the values are to be written.
// */
// set(array: ArrayLike<number>, offset?: number): void;
// /**
// * Converts a number to a string by using the current locale.
// */
// toLocaleString(): string;
// /**
// * Returns a string representation of an array.
// */
// toString(): string;
// [index: number]: number;
// }
// interface Float64ArrayConstructor {
// readonly prototype: Float64Array;
// new (length: number): Float64Array;
// new (array: ArrayLike<number>): Float64Array;
// new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;
// /**
// * The size in bytes of each element in the array.
// */
// readonly BYTES_PER_ELEMENT: number;
// }
// declare const Float64Array: Float64ArrayConstructor;
-23
View File
@@ -1,23 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/////////////////////////////
/// WorkerGlobalScope APIs
/////////////////////////////
// These are only available in a Web Worker
declare function importScripts(...urls: string[]): void;
-3
View File
@@ -110,10 +110,7 @@ export const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscree
const userAgent = navigator.userAgent;
export const isIE = (userAgent.indexOf('Trident') >= 0);
export const isEdge = (userAgent.indexOf('Edge/') >= 0);
export const isEdgeOrIE = isIE || isEdge;
export const isOpera = (userAgent.indexOf('Opera') >= 0);
export const isFirefox = (userAgent.indexOf('Firefox') >= 0);
export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);
-4
View File
@@ -27,10 +27,6 @@ export const BrowserFeatures = {
|| !!(navigator && navigator.clipboard && navigator.clipboard.readText)
),
richText: (() => {
if (browser.isIE) {
return false;
}
if (browser.isEdge) {
let index = navigator.userAgent.indexOf('Edge/');
let version = parseInt(navigator.userAgent.substring(index + 5, navigator.userAgent.indexOf('.', index)), 10);
+1 -115
View File
@@ -8,7 +8,6 @@ import { domEvent } from 'vs/base/browser/event';
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { TimeoutTimer } from 'vs/base/common/async';
import { CharCode } from 'vs/base/common/charCode';
import { onUnexpectedError } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
@@ -49,117 +48,7 @@ interface IDomClassList {
toggleClass(node: HTMLElement | SVGElement, className: string, shouldHaveIt?: boolean): void;
}
const _manualClassList = new class implements IDomClassList {
private _lastStart: number = -1;
private _lastEnd: number = -1;
private _findClassName(node: HTMLElement, className: string): void {
let classes = node.className;
if (!classes) {
this._lastStart = -1;
return;
}
className = className.trim();
let classesLen = classes.length,
classLen = className.length;
if (classLen === 0) {
this._lastStart = -1;
return;
}
if (classesLen < classLen) {
this._lastStart = -1;
return;
}
if (classes === className) {
this._lastStart = 0;
this._lastEnd = classesLen;
return;
}
let idx = -1,
idxEnd: number;
while ((idx = classes.indexOf(className, idx + 1)) >= 0) {
idxEnd = idx + classLen;
// a class that is followed by another class
if ((idx === 0 || classes.charCodeAt(idx - 1) === CharCode.Space) && classes.charCodeAt(idxEnd) === CharCode.Space) {
this._lastStart = idx;
this._lastEnd = idxEnd + 1;
return;
}
// last class
if (idx > 0 && classes.charCodeAt(idx - 1) === CharCode.Space && idxEnd === classesLen) {
this._lastStart = idx - 1;
this._lastEnd = idxEnd;
return;
}
// equal - duplicate of cmp above
if (idx === 0 && idxEnd === classesLen) {
this._lastStart = 0;
this._lastEnd = idxEnd;
return;
}
}
this._lastStart = -1;
}
hasClass(node: HTMLElement, className: string): boolean {
this._findClassName(node, className);
return this._lastStart !== -1;
}
addClasses(node: HTMLElement, ...classNames: string[]): void {
classNames.forEach(nameValue => nameValue.split(' ').forEach(name => this.addClass(node, name)));
}
addClass(node: HTMLElement, className: string): void {
if (!node.className) { // doesn't have it for sure
node.className = className;
} else {
this._findClassName(node, className); // see if it's already there
if (this._lastStart === -1) {
node.className = node.className + ' ' + className;
}
}
}
removeClass(node: HTMLElement, className: string): void {
this._findClassName(node, className);
if (this._lastStart === -1) {
return; // Prevent styles invalidation if not necessary
} else {
node.className = node.className.substring(0, this._lastStart) + node.className.substring(this._lastEnd);
}
}
removeClasses(node: HTMLElement, ...classNames: string[]): void {
classNames.forEach(nameValue => nameValue.split(' ').forEach(name => this.removeClass(node, name)));
}
toggleClass(node: HTMLElement, className: string, shouldHaveIt?: boolean): void {
this._findClassName(node, className);
if (this._lastStart !== -1 && (shouldHaveIt === undefined || !shouldHaveIt)) {
this.removeClass(node, className);
}
if (this._lastStart === -1 && (shouldHaveIt === undefined || shouldHaveIt)) {
this.addClass(node, className);
}
}
};
const _nativeClassList = new class implements IDomClassList {
const _classList: IDomClassList = new class implements IDomClassList {
hasClass(node: HTMLElement, className: string): boolean {
return Boolean(className) && node.classList && node.classList.contains(className);
}
@@ -191,9 +80,6 @@ const _nativeClassList = new class implements IDomClassList {
}
};
// In IE11 there is only partial support for `classList` which makes us keep our
// custom implementation. Otherwise use the native implementation, see: http://caniuse.com/#search=classlist
const _classList: IDomClassList = browser.isIE ? _manualClassList : _nativeClassList;
export const hasClass: (node: HTMLElement | SVGElement, className: string) => boolean = _classList.hasClass.bind(_classList);
export const addClass: (node: HTMLElement | SVGElement, className: string) => void = _classList.addClass.bind(_classList);
export const addClasses: (node: HTMLElement | SVGElement, ...classNames: string[]) => void = _classList.addClasses.bind(_classList);
+2 -2
View File
@@ -244,11 +244,11 @@ export class FastDomNode<T extends HTMLElement> {
this.domNode.removeAttribute(name);
}
public appendChild(child: FastDomNode<any>): void {
public appendChild(child: FastDomNode<T>): void {
this.domNode.appendChild(child.domNode);
}
public removeChild(child: FastDomNode<any>): void {
public removeChild(child: FastDomNode<T>): void {
this.domNode.removeChild(child.domNode);
}
}
@@ -5,7 +5,6 @@
import * as dom from 'vs/base/browser/dom';
import * as platform from 'vs/base/common/platform';
import * as browser from 'vs/base/browser/browser';
import { IframeUtils } from 'vs/base/browser/iframe';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
@@ -103,7 +102,7 @@ export class GlobalMouseMoveMonitor<R extends { buttons: number; }> implements I
for (const element of listenTo) {
this._hooks.add(dom.addDisposableThrottledListener(element, mouseMove,
(data: R) => {
if (!browser.isIE && data.buttons !== initialButtons) {
if (data.buttons !== initialButtons) {
// Buttons state has changed in the meantime
this.stopMonitoring(true);
return;
+1 -1
View File
@@ -98,7 +98,7 @@ export class IframeUtils {
/**
* Returns the position of `childWindow` relative to `ancestorWindow`
*/
public static getPositionOfChildWindowRelativeToAncestorWindow(childWindow: Window, ancestorWindow: any) {
public static getPositionOfChildWindowRelativeToAncestorWindow(childWindow: Window, ancestorWindow: Window | null) {
if (!ancestorWindow || childWindow === ancestorWindow) {
return {
+1 -3
View File
@@ -145,9 +145,7 @@ let INVERSE_KEY_CODE_MAP: KeyCode[] = new Array(KeyCode.MAX_VALUE);
*/
define(229, KeyCode.KEY_IN_COMPOSITION);
if (browser.isIE) {
define(91, KeyCode.Meta);
} else if (browser.isFirefox) {
if (browser.isFirefox) {
define(59, KeyCode.US_SEMICOLON);
define(107, KeyCode.US_EQUAL);
define(109, KeyCode.US_MINUS);
+2 -2
View File
@@ -131,7 +131,7 @@ export class Gesture extends Disposable {
@memoize
private static isTouchDevice(): boolean {
return 'ontouchstart' in window as any || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0;
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0;
}
public dispose(): void {
@@ -247,7 +247,7 @@ export class Gesture extends Disposable {
}
private newGestureEvent(type: string, initialTarget?: EventTarget): GestureEvent {
let event = <GestureEvent>(<any>document.createEvent('CustomEvent'));
let event = document.createEvent('CustomEvent') as unknown as GestureEvent;
event.initEvent(type, false, true);
event.initialTarget = initialTarget;
event.tapCount = 0;
@@ -104,7 +104,7 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
return this._action.enabled;
}
setActionContext(newContext: any): void {
setActionContext(newContext: unknown): void {
this._context = newContext;
}
@@ -248,7 +248,7 @@ export class ActionViewItem extends BaseActionViewItem {
private cssClass?: string;
constructor(context: any, action: IAction, options: IActionViewItemOptions = {}) {
constructor(context: unknown, action: IAction, options: IActionViewItemOptions = {}) {
super(context, action, options);
this.options = options;
@@ -423,7 +423,7 @@ export class ActionBar extends Disposable implements IActionRunner {
options: IActionBarOptions;
private _actionRunner: IActionRunner;
private _context: any;
private _context: unknown;
// View Items
viewItems: IActionViewItem[];
@@ -821,7 +821,7 @@ export class ActionBar extends Disposable implements IActionRunner {
this._onDidCancel.fire();
}
run(action: IAction, context?: any): Promise<void> {
run(action: IAction, context?: unknown): Promise<void> {
return this._actionRunner.run(action, context);
}
@@ -838,7 +838,7 @@ export class ActionBar extends Disposable implements IActionRunner {
export class SelectActionViewItem extends BaseActionViewItem {
protected selectBox: SelectBox;
constructor(ctx: any, action: IAction, options: ISelectOptionItem[], selected: number, contextViewProvider: IContextViewProvider, selectBoxOptions?: ISelectBoxOptions) {
constructor(ctx: unknown, action: IAction, options: ISelectOptionItem[], selected: number, contextViewProvider: IContextViewProvider, selectBoxOptions?: ISelectBoxOptions) {
super(ctx, action);
this.selectBox = new SelectBox(options, selected, contextViewProvider, undefined, selectBoxOptions);
@@ -5,7 +5,7 @@
@font-face {
font-family: "codicon";
src: url("./codicon.ttf?279add2ec8b3d516ca20a123230cbf9f") format("truetype");
src: url("./codicon.ttf?b5dd8f5aa953889dc1f4c9fa9b44d3dd") format("truetype");
}
.codicon[class*='codicon-'] {
@@ -415,5 +415,6 @@
.codicon-group-by-ref-type:before { content: "\eb97" }
.codicon-ungroup-by-ref-type:before { content: "\eb98" }
.codicon-bell-dot:before { content: "\f101" }
.codicon-debug-alt-2:before { content: "\f102" }
.codicon-debug-alt:before { content: "\f103" }
.codicon-bell-progress:before { content: "\f102" }
.codicon-debug-alt-2:before { content: "\f103" }
.codicon-debug-alt:before { content: "\f104" }
+3 -3
View File
@@ -271,7 +271,7 @@ export class DropdownMenu extends BaseDropdown {
}
export class DropdownMenuActionViewItem extends BaseActionViewItem {
private menuActionsOrProvider: any;
private menuActionsOrProvider: ReadonlyArray<IAction> | IActionProvider;
private dropdownMenu: DropdownMenu | undefined;
private contextMenuProvider: IContextMenuProvider;
private actionViewItemProvider?: IActionViewItemProvider;
@@ -317,7 +317,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
if (Array.isArray(this.menuActionsOrProvider)) {
options.actions = this.menuActionsOrProvider;
} else {
options.actionProvider = this.menuActionsOrProvider;
options.actionProvider = this.menuActionsOrProvider as IActionProvider;
}
this.dropdownMenu = this._register(new DropdownMenu(container, options));
@@ -341,7 +341,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
}
}
setActionContext(newContext: any): void {
setActionContext(newContext: unknown): void {
super.setActionContext(newContext);
if (this.dropdownMenu) {
@@ -6,7 +6,6 @@
import 'vs/css!./inputBox';
import * as nls from 'vs/nls';
import * as Bal from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom';
import { MarkdownRenderOptions } from 'vs/base/browser/markdownRenderer';
import { renderFormattedText, renderText } from 'vs/base/browser/formattedTextRenderer';
@@ -212,14 +211,6 @@ export class InputBox extends Widget {
this.onblur(this.input, () => this.onBlur());
this.onfocus(this.input, () => this.onFocus());
// Add placeholder shim for IE because IE decides to hide the placeholder on focus (we dont want that!)
if (this.placeholder && Bal.isIE) {
this.onclick(this.input, (e) => {
dom.EventHelper.stop(e, true);
this.input.focus();
});
}
this.ignoreGesture(this.input);
setTimeout(() => this.updateMirror(), 0);
+52 -6
View File
@@ -21,6 +21,7 @@ import { equals, distinct } from 'vs/base/common/arrays';
import { DataTransfers, StaticDND, IDragAndDropData } from 'vs/base/browser/dnd';
import { disposableTimeout, Delayer } from 'vs/base/common/async';
import { isFirefox } from 'vs/base/browser/browser';
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
interface IItem<T> {
readonly id: string;
@@ -198,6 +199,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
get onDidScroll(): Event<ScrollEvent> { return this.scrollableElement.onScroll; }
get onWillScroll(): Event<ScrollEvent> { return this.scrollableElement.onWillScroll; }
get containerDomNode(): HTMLElement { return this.rowsContainer; }
constructor(
container: HTMLElement,
@@ -273,6 +275,31 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
this.layout();
}
triggerScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {
this.scrollableElement.triggerScrollFromMouseWheelEvent(browserEvent);
}
updateElementHeight(index: number, size: number): void {
if (this.items[index].size === size) {
return;
}
const lastRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
const heightDiff = index < lastRenderRange.start ? size - this.items[index].size : 0;
this.rangeMap.splice(index, 1, [{ size: size }]);
this.items[index].size = size;
this.render(lastRenderRange, this.lastRenderTop + heightDiff, this.lastRenderHeight, undefined, undefined, true);
this.eventuallyUpdateScrollDimensions();
if (this.supportDynamicHeights) {
this._rerender(this.lastRenderTop, this.lastRenderHeight);
}
return;
}
splice(start: number, deleteCount: number, elements: T[] = []): T[] {
if (this.splicing) {
throw new Error('Can\'t run recursive splices.');
@@ -516,14 +543,21 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
// Render
private render(renderTop: number, renderHeight: number, renderLeft: number, scrollWidth: number): void {
const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
private render(previousRenderRange: IRange, renderTop: number, renderHeight: number, renderLeft: number | undefined, scrollWidth: number | undefined, updateItemsInDOM: boolean = false): void {
const renderRange = this.getRenderRange(renderTop, renderHeight);
const rangesToInsert = Range.relativeComplement(renderRange, previousRenderRange);
const rangesToRemove = Range.relativeComplement(previousRenderRange, renderRange);
const beforeElement = this.getNextToLastElement(rangesToInsert);
if (updateItemsInDOM) {
const rangesToUpdate = Range.intersect(previousRenderRange, renderRange);
for (let i = rangesToUpdate.start; i < rangesToUpdate.end; i++) {
this.updateItemInDOM(this.items[i], i);
}
}
for (const range of rangesToInsert) {
for (let i = range.start; i < range.end; i++) {
this.insertItemInDOM(i, beforeElement);
@@ -536,10 +570,13 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
}
}
this.rowsContainer.style.left = `-${renderLeft}px`;
if (renderLeft !== undefined) {
this.rowsContainer.style.left = `-${renderLeft}px`;
}
this.rowsContainer.style.top = `-${renderTop}px`;
if (this.horizontalScrolling) {
if (this.horizontalScrolling && scrollWidth !== undefined) {
this.rowsContainer.style.width = `${Math.max(scrollWidth, this.renderWidth)}px`;
}
@@ -554,7 +591,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
if (!item.row) {
item.row = this.cache.alloc(item.templateId);
const role = this.ariaProvider.getRole ? this.ariaProvider.getRole(item.element) : 'treeitem';
const role = this.ariaProvider.getRole ? this.ariaProvider.getRole(item.element) : 'listitem';
item.row!.domNode!.setAttribute('role', role);
const checked = this.ariaProvider.isChecked ? this.ariaProvider.isChecked(item.element) : undefined;
if (typeof checked !== 'undefined') {
@@ -741,7 +778,8 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
private onScroll(e: ScrollEvent): void {
try {
this.render(e.scrollTop, e.height, e.scrollLeft, e.scrollWidth);
const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
this.render(previousRenderRange, e.scrollTop, e.height, e.scrollLeft, e.scrollWidth);
if (this.supportDynamicHeights) {
this._rerender(e.scrollTop, e.height);
@@ -1097,6 +1135,14 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
}
const size = item.size;
if (item.row && item.row.domNode) {
let newSize = item.row.domNode.offsetHeight;
item.size = newSize;
item.lastDynamicHeightWidth = this.renderWidth;
return newSize - size;
}
const row = this.cache.alloc(item.templateId);
row.domNode!.style.height = '';
+5 -1
View File
@@ -1115,7 +1115,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
private focus: Trait<T>;
private selection: Trait<T>;
private eventBufferer = new EventBufferer();
private view: ListView<T>;
protected view: ListView<T>;
private spliceable: ISpliceable<T>;
private styleController: IStyleController;
private typeLabelController?: TypeLabelController<T>;
@@ -1310,6 +1310,10 @@ export class List<T> implements ISpliceable<T>, IDisposable {
this.view.updateWidth(index);
}
updateElementHeight(index: number, size: number): void {
this.view.updateElementHeight(index, size);
}
rerender(): void {
this.view.rerender();
}
+3 -3
View File
@@ -6,7 +6,7 @@
import 'vs/css!./menu';
import * as nls from 'vs/nls';
import * as strings from 'vs/base/common/strings';
import { IActionRunner, IAction, Action, IActionViewItem } from 'vs/base/common/actions';
import { IActionRunner, IAction, Action } from 'vs/base/common/actions';
import { ActionBar, IActionViewItemProvider, ActionsOrientation, Separator, ActionViewItem, IActionViewItemOptions, BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes';
import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses, clearNode } from 'vs/base/browser/dom';
@@ -205,7 +205,7 @@ export class Menu extends ActionBar {
container.appendChild(this.scrollableElement.getDomNode());
this.scrollableElement.scanDomNode();
this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item: IActionViewItem, index: number, array: any[]) => {
this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item, index, array) => {
(item as BaseMenuActionViewItem).updatePositionInSet(index + 1, array.length);
});
}
@@ -363,7 +363,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
private cssClass: string;
protected menuStyle: IMenuStyles | undefined;
constructor(ctx: any, action: IAction, options: IMenuItemOptions = {}) {
constructor(ctx: unknown, action: IAction, options: IMenuItemOptions = {}) {
options.isMenu = true;
super(action, action, options);
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/scrollbars';
import { isEdgeOrIE } from 'vs/base/browser/browser';
import { isEdge } from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom';
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
import { IMouseEvent, StandardWheelEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
@@ -303,6 +303,10 @@ export abstract class AbstractScrollableElement extends Widget {
this._revealOnScroll = value;
}
public triggerScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {
this._onMouseWheel(new StandardWheelEvent(browserEvent));
}
// -------------------- mouse wheel scrolling --------------------
private _setListeningToMouseWheel(shouldListen: boolean): void {
@@ -322,7 +326,7 @@ export abstract class AbstractScrollableElement extends Widget {
this._onMouseWheel(new StandardWheelEvent(browserEvent));
};
this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, { passive: false }));
this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, isEdge ? 'mousewheel' : 'wheel', onMouseWheel, { passive: false }));
}
}
+2 -4
View File
@@ -86,7 +86,7 @@ export class ToolBar extends Disposable {
return this.actionBar.actionRunner;
}
set context(context: any) {
set context(context: unknown) {
this.actionBar.context = context;
if (this.toggleMenuActionViewItem.value) {
this.toggleMenuActionViewItem.value.setActionContext(context);
@@ -166,10 +166,8 @@ class ToggleMenuAction extends Action {
this.toggleDropdownMenu = toggleDropdownMenu;
}
run(): Promise<any> {
async run(): Promise<void> {
this.toggleDropdownMenu();
return Promise.resolve(true);
}
get menuActions(): ReadonlyArray<IAction> {
+3 -3
View File
@@ -14,7 +14,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import { ITreeModel, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeFilter, ITreeNavigator, ICollapseStateChangeEvent, ITreeDragAndDrop, TreeDragOverBubble, TreeVisibility, TreeFilterResult, ITreeModelSpliceEvent, TreeMouseEventTarget } from 'vs/base/browser/ui/tree/tree';
import { ISpliceable } from 'vs/base/common/sequence';
import { IDragAndDropData, StaticDND, DragAndDropData } from 'vs/base/browser/dnd';
import { range, equals, distinctES6, fromSet } from 'vs/base/common/arrays';
import { range, equals, distinctES6 } from 'vs/base/common/arrays';
import { ElementsDragAndDropData } from 'vs/base/browser/ui/list/listView';
import { domEvent } from 'vs/base/browser/event';
import { fuzzyScore, FuzzyScore } from 'vs/base/common/filters';
@@ -196,7 +196,7 @@ function asListOptions<T, TFilterData, TRef>(modelProvider: () => ITreeModel<T,
} : undefined,
getRole: options.ariaProvider && options.ariaProvider.getRole ? (node) => {
return options.ariaProvider!.getRole!(node.element);
} : undefined
} : () => 'treeitem'
}
};
}
@@ -1320,7 +1320,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
set.add(node);
}
return fromSet(set);
return values(set);
}).event;
if (_options.keyboardSupport !== false) {
+1 -1
View File
@@ -267,7 +267,7 @@ function asObjectTreeOptions<TInput, T, TFilterData>(options?: IAsyncDataTreeOpt
},
getRole: options.ariaProvider!.getRole ? (el) => {
return options.ariaProvider!.getRole!(el.element as T);
} : undefined,
} : () => 'treeitem',
isChecked: options.ariaProvider!.isChecked ? (e) => {
return options.ariaProvider?.isChecked!(e.element as T);
} : undefined
+14 -6
View File
@@ -372,12 +372,6 @@ export function distinctES6<T>(array: ReadonlyArray<T>): T[] {
});
}
export function fromSet<T>(set: Set<T>): T[] {
const result: T[] = [];
set.forEach(o => result.push(o));
return result;
}
export function uniqueFilter<T>(keyFn: (t: T) => string): (t: T) => boolean {
const seen: { [key: string]: boolean; } = Object.create(null);
@@ -405,6 +399,9 @@ export function lastIndex<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean):
return -1;
}
/**
* @deprecated ES6: use `Array.findIndex`
*/
export function firstIndex<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean): number {
for (let i = 0; i < array.length; i++) {
const element = array[i];
@@ -417,6 +414,10 @@ export function firstIndex<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean)
return -1;
}
/**
* @deprecated ES6: use `Array.find`
*/
export function first<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean, notFoundValue: T): T;
export function first<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean): T | undefined;
export function first<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean, notFoundValue: T | undefined = undefined): T | undefined {
@@ -471,6 +472,9 @@ export function range(arg: number, to?: number): number[] {
return result;
}
/**
* @deprecated ES6: use `Array.fill`
*/
export function fill<T>(num: number, value: T, arr: T[] = []): T[] {
for (let i = 0; i < num; i++) {
arr[i] = value;
@@ -564,6 +568,10 @@ export function pushToEnd<T>(arr: T[], value: T): void {
}
}
/**
* @deprecated ES6: use `Array.find`
*/
export function find<T>(arr: ArrayLike<T>, predicate: (value: T, index: number, arr: ArrayLike<T>) => any): T | undefined {
for (let i = 0; i < arr.length; i++) {
const element = arr[i];
+2 -2
View File
@@ -6,8 +6,8 @@
/**
* Throws an error with the provided message if the provided value does not evaluate to a true Javascript value.
*/
export function ok(value?: any, message?: string) {
export function ok(value?: unknown, message?: string) {
if (!value) {
throw new Error(message ? 'Assertion failed (' + message + ')' : 'Assertion Failed');
throw new Error(message ? `Assertion failed (${message})` : 'Assertion Failed');
}
}
+1 -1
View File
@@ -837,7 +837,7 @@ export class TaskSequentializer {
this._pending?.cancel();
}
setPending(taskId: number, promise: Promise<void>, onCancel?: () => void, ): Promise<void> {
setPending(taskId: number, promise: Promise<void>, onCancel?: () => void,): Promise<void> {
this._pending = { taskId: taskId, cancel: () => onCancel?.(), promise };
promise.then(() => this.donePending(taskId), () => this.donePending(taskId));
+1 -1
View File
@@ -31,7 +31,7 @@ const shortcutEvent: Event<any> = Object.freeze(function (callback, context?): I
export namespace CancellationToken {
export function isCancellationToken(thing: any): thing is CancellationToken {
export function isCancellationToken(thing: unknown): thing is CancellationToken {
if (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {
return true;
}
-5
View File
@@ -95,11 +95,6 @@ export function fromMap<T>(original: Map<string, T>): IStringDictionary<T> {
return result;
}
export function mapValues<V>(map: Map<any, V>): V[] {
const result: V[] = [];
map.forEach(v => result.push(v));
return result;
}
export class SetMap<K, V> {
+1 -1
View File
@@ -13,7 +13,7 @@ export interface IErrorWithActions {
actions?: ReadonlyArray<IAction>;
}
export function isErrorWithActions(obj: any): obj is IErrorWithActions {
export function isErrorWithActions(obj: unknown): obj is IErrorWithActions {
return obj instanceof Error && Array.isArray((obj as IErrorWithActions).actions);
}
+4 -4
View File
@@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export function once<T extends Function>(this: any, fn: T): T {
export function once<T extends Function>(this: unknown, fn: T): T {
const _this = this;
let didCall = false;
let result: any;
let result: unknown;
return function () {
if (didCall) {
@@ -17,5 +17,5 @@ export function once<T extends Function>(this: any, fn: T): T {
result = fn.apply(_this, arguments);
return result;
} as any as T;
}
} as unknown as T;
}
+18
View File
@@ -34,6 +34,24 @@ export interface NativeIterator<T> {
next(): NativeIteratorResult<T>;
}
export namespace Iterable {
export function some<T>(iterable: IterableIterator<T>, predicate: (t: T) => boolean): boolean {
for (const element of iterable) {
if (predicate(element)) {
return true;
}
}
return false;
}
export function* map<T, R>(iterable: IterableIterator<T>, fn: (t: T) => R): IterableIterator<R> {
for (const element of iterable) {
return yield fn(element);
}
}
}
export module Iterator {
const _empty: Iterator<any> = {
next() {
+1 -1
View File
@@ -21,7 +21,7 @@ export class Lazy<T> {
private _didRun: boolean = false;
private _value?: T;
private _error: any;
private _error: Error | undefined;
constructor(
private readonly executor: () => T,
+3 -4
View File
@@ -49,8 +49,7 @@ export interface IDisposable {
}
export function isDisposable<E extends object>(thing: E): thing is E & IDisposable {
return typeof (<IDisposable><any>thing).dispose === 'function'
&& (<IDisposable><any>thing).dispose.length === 0;
return typeof (<IDisposable>thing).dispose === 'function' && (<IDisposable>thing).dispose.length === 0;
}
export function dispose<T extends IDisposable>(disposable: T): T;
@@ -124,7 +123,7 @@ export class DisposableStore implements IDisposable {
if (!t) {
return t;
}
if ((t as any as DisposableStore) === this) {
if ((t as unknown as DisposableStore) === this) {
throw new Error('Cannot register a disposable on itself!');
}
@@ -158,7 +157,7 @@ export abstract class Disposable implements IDisposable {
}
protected _register<T extends IDisposable>(t: T): T {
if ((t as any as Disposable) === this) {
if ((t as unknown as Disposable) === this) {
throw new Error('Cannot register a disposable on itself!');
}
return this._store.add(t);
+2 -2
View File
@@ -23,7 +23,7 @@ export class LinkedText {
}
}
const LINK_REGEX = /\[([^\]]+)\]\(((?:https?:\/\/|command:)[^\)\s]+)(?: "([^"]+)")?\)/gi;
const LINK_REGEX = /\[([^\]]+)\]\(((?:https?:\/\/|command:)[^\)\s]+)(?: ("|')([^\3]+)(\3))?\)/gi;
export function parseLinkedText(text: string): LinkedText {
const result: LinkedTextNode[] = [];
@@ -36,7 +36,7 @@ export function parseLinkedText(text: string): LinkedText {
result.push(text.substring(index, match.index));
}
const [, label, href, title] = match;
const [, label, href, , title] = match;
if (title) {
result.push({ label, href, title });
+12 -1
View File
@@ -7,7 +7,9 @@ import { URI } from 'vs/base/common/uri';
import { CharCode } from 'vs/base/common/charCode';
import { Iterator, IteratorResult, FIN } from './iterator';
/**
* @deprecated ES6: use `[...SetOrMap.values()]`
*/
export function values<V = any>(set: Set<V>): V[];
export function values<K = any, V = any>(map: Map<K, V>): V[];
export function values<V>(forEachable: { forEach(callback: (value: V, ...more: any[]) => any): void }): V[] {
@@ -16,6 +18,9 @@ export function values<V>(forEachable: { forEach(callback: (value: V, ...more: a
return result;
}
/**
* @deprecated ES6: use `[...map.keys()]`
*/
export function keys<K, V>(map: Map<K, V>): K[] {
const result: K[] = [];
map.forEach((_value, key) => result.push(key));
@@ -51,6 +56,9 @@ export function setToString<K>(set: Set<K>): string {
return `Set(${set.size}) {${entries.join(', ')}}`;
}
/**
* @deprecated ES6: use `...Map.entries()`
*/
export function mapToSerializable(map: Map<string, string>): [string, string][] {
const serializable: [string, string][] = [];
@@ -61,6 +69,9 @@ export function mapToSerializable(map: Map<string, string>): [string, string][]
return serializable;
}
/**
* @deprecated ES6: use `new Map([[key1, value1],[key2, value2]])`
*/
export function serializableToMap(serializable: [string, string][]): Map<string, string> {
const items = new Map<string, string>();
+1 -1
View File
@@ -11,7 +11,7 @@ import { LRUCache } from 'vs/base/common/map';
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize}
*/
export const canNormalize = typeof ((<any>'').normalize) === 'function';
export const canNormalize = typeof (String.prototype as any /* standalone editor compilation */).normalize === 'function';
const nfcCache = new LRUCache<string, string>(10000); // bounded to 10000 elements
export function normalizeNFC(str: string): string {
+2 -3
View File
@@ -8,8 +8,7 @@ import * as paths from 'vs/base/common/path';
import { Iterator } from 'vs/base/common/iterator';
import { relativePath, joinPath } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import { mapValues } from 'vs/base/common/collections';
import { PathIterator } from 'vs/base/common/map';
import { PathIterator, values } from 'vs/base/common/map';
export interface IResourceNode<T, C = void> {
readonly uri: URI;
@@ -32,7 +31,7 @@ class Node<T, C> implements IResourceNode<T, C> {
}
get children(): Iterator<Node<T, C>> {
return Iterator.fromArray(mapValues(this._children));
return Iterator.fromArray(values(this._children));
}
@memoize
+2 -2
View File
@@ -95,8 +95,8 @@ export interface WriteableStream<T> extends ReadableStream<T> {
end(result?: T | Error): void;
}
export function isReadableStream<T>(obj: any): obj is ReadableStream<T> {
const candidate: ReadableStream<T> = obj;
export function isReadableStream<T>(obj: unknown): obj is ReadableStream<T> {
const candidate = obj as ReadableStream<T>;
return candidate && [candidate.on, candidate.pause, candidate.resume, candidate.destroy].every(fn => typeof fn === 'function');
}
+8 -7
View File
@@ -5,6 +5,7 @@
import { CharCode } from 'vs/base/common/charCode';
import { Constants } from 'vs/base/common/uint';
import { canNormalize, normalizeNFD } from 'vs/base/common/normalization';
export function isFalsyOrWhitespace(str: string | undefined): boolean {
if (!str || typeof str !== 'string') {
@@ -14,7 +15,7 @@ export function isFalsyOrWhitespace(str: string | undefined): boolean {
}
/**
* @returns the provided number with the given number of preceding zeros.
* @deprecated ES6: use `String.padStart`
*/
export function pad(n: number, l: number, char: string = '0'): string {
const str = '' + n;
@@ -145,7 +146,7 @@ export function stripWildcards(pattern: string): string {
}
/**
* Determines if haystack starts with needle.
* @deprecated ES6: use `String.startsWith`
*/
export function startsWith(haystack: string, needle: string): boolean {
if (haystack.length < needle.length) {
@@ -166,7 +167,7 @@ export function startsWith(haystack: string, needle: string): boolean {
}
/**
* Determines if haystack ends with needle.
* @deprecated ES6: use `String.endsWith`
*/
export function endsWith(haystack: string, needle: string): boolean {
const diff = haystack.length - needle.length;
@@ -240,7 +241,7 @@ export function regExpFlags(regexp: RegExp): string {
return (regexp.global ? 'g' : '')
+ (regexp.ignoreCase ? 'i' : '')
+ (regexp.multiline ? 'm' : '')
+ ((regexp as any).unicode ? 'u' : '');
+ ((regexp as any /* standalone editor compilation */).unicode ? 'u' : '');
}
/**
@@ -853,15 +854,15 @@ export function removeAnsiEscapeCodes(str: string): string {
}
export const removeAccents: (str: string) => string = (function () {
if (typeof (String.prototype as any).normalize !== 'function') {
// ☹️ no ES6 features...
if (!canNormalize) {
// no ES6 features...
return function (str: string) { return str; };
} else {
// transform into NFD form and remove accents
// see: https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463
const regex = /[\u0300-\u036f]/g;
return function (str: string) {
return (str as any).normalize('NFD').replace(regex, '');
return normalizeNFD(str).replace(regex, '');
};
}
})();
+4 -6
View File
@@ -5,19 +5,17 @@
import * as fs from 'fs';
import * as crypto from 'crypto';
import * as stream from 'stream';
import { once } from 'vs/base/common/functional';
export function checksum(path: string, sha1hash: string | undefined): Promise<void> {
const promise = new Promise<string | undefined>((c, e) => {
const input = fs.createReadStream(path);
const hash = crypto.createHash('sha1');
const hashStream = hash as any as stream.PassThrough;
input.pipe(hashStream);
input.pipe(hash);
const done = once((err?: Error, result?: string) => {
input.removeAllListeners();
hashStream.removeAllListeners();
hash.removeAllListeners();
if (err) {
e(err);
@@ -28,8 +26,8 @@ export function checksum(path: string, sha1hash: string | undefined): Promise<vo
input.once('error', done);
input.once('end', done);
hashStream.once('error', done);
hashStream.once('data', (data: Buffer) => done(undefined, data.toString('hex')));
hash.once('error', done);
hash.once('data', (data: Buffer) => done(undefined, data.toString('hex')));
});
return promise.then(hash => {
@@ -21,4 +21,5 @@ export class CompositeDragAndDropData implements IDragAndDropData {
export interface ICompositeDragAndDrop {
drop(data: IDragAndDropData, target: string | undefined, originalEvent: DragEvent): void;
onDragOver(data: IDragAndDropData, target: string | undefined, originalEvent: DragEvent): boolean;
onDragEnter(data: IDragAndDropData, target: string | undefined, originalEvent: DragEvent): boolean;
}
@@ -397,7 +397,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
private _valueSelection: Readonly<[number, number]> | undefined;
private valueSelectionUpdated = true;
private _validationMessage: string | undefined;
private _ok = false;
private _ok: boolean | 'default' = 'default';
private _customButton = false;
private _customButtonLabel: string | undefined;
private _customButtonHover: string | undefined;
@@ -566,7 +566,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
return this._ok;
}
set ok(showOkButton: boolean) {
set ok(showOkButton: boolean | 'default') {
this._ok = showOkButton;
this.update();
}
@@ -575,6 +575,10 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
return this.visible ? this.ui.inputBox.hasFocus() : false;
}
public focusOnInput() {
this.ui.inputBox.setFocus();
}
onDidChangeSelection = this.onDidChangeSelectionEmitter.event;
onDidTriggerItemButton = this.onDidTriggerItemButtonEmitter.event;
@@ -753,7 +757,8 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
if (!this.visible) {
return;
}
this.ui.setVisibilities(this.canSelectMany ? { title: !!this.title || !!this.step, description: !!this.description, checkAll: true, inputBox: true, visibleCount: true, count: true, ok: this.ok, list: true, message: !!this.validationMessage, customButton: this.customButton } : { title: !!this.title || !!this.step, description: !!this.description, inputBox: true, visibleCount: true, list: true, message: !!this.validationMessage, customButton: this.customButton, ok: this.ok });
const ok = this.ok === 'default' ? this.canSelectMany : this.ok;
this.ui.setVisibilities(this.canSelectMany ? { title: !!this.title || !!this.step, description: !!this.description, checkAll: true, inputBox: true, visibleCount: true, count: true, ok, list: true, message: !!this.validationMessage, customButton: this.customButton } : { title: !!this.title || !!this.step, description: !!this.description, inputBox: true, visibleCount: true, list: true, message: !!this.validationMessage, customButton: this.customButton, ok });
super.update();
if (this.ui.inputBox.value !== this.value) {
this.ui.inputBox.value = this.value;
@@ -113,7 +113,7 @@ export interface IInputOptions {
placeHolder?: string;
/**
* set to true to show a password prompt that will not show the typed value
* Controls if a password input is shown. Password input hides the typed text.
*/
password?: boolean;
@@ -162,7 +162,7 @@ export interface IQuickPick<T extends IQuickPickItem> extends IQuickInput {
readonly onDidAccept: Event<void>;
ok: boolean;
ok: boolean | 'default';
readonly onDidCustom: Event<void>;
@@ -209,6 +209,8 @@ export interface IQuickPick<T extends IQuickPickItem> extends IQuickInput {
validationMessage: string | undefined;
inputHasFocus(): boolean;
focusOnInput(): void;
}
export interface IInputBox extends IQuickInput {
+6 -4
View File
@@ -27,7 +27,8 @@ export interface IUpdateRequest {
}
export interface IStorageItemsChangeEvent {
items: Map<string, string>;
changed?: Map<string, string>;
deleted?: Set<string>;
}
export interface IStorageDatabase {
@@ -104,10 +105,11 @@ export class Storage extends Disposable implements IStorage {
// items that change external require us to update our
// caches with the values. we just accept the value and
// emit an event if there is a change.
e.items.forEach((value, key) => this.accept(key, value));
e.changed?.forEach((value, key) => this.accept(key, value));
e.deleted?.forEach(key => this.accept(key, undefined));
}
private accept(key: string, value: string): void {
private accept(key: string, value: string | undefined): void {
if (this.state === StorageState.Closed) {
return; // Return early if we are already closed
}
@@ -315,4 +317,4 @@ export class InMemoryStorageDatabase implements IStorageDatabase {
close(): Promise<void> {
return Promise.resolve();
}
}
}
@@ -124,28 +124,27 @@ suite('Storage Library', () => {
changes.clear();
// Nothing happens if changing to same value
const change = new Map<string, string>();
change.set('foo', 'bar');
database.fireDidChangeItemsExternal({ items: change });
const changed = new Map<string, string>();
changed.set('foo', 'bar');
database.fireDidChangeItemsExternal({ changed });
equal(changes.size, 0);
// Change is accepted if valid
change.set('foo', 'bar1');
database.fireDidChangeItemsExternal({ items: change });
changed.set('foo', 'bar1');
database.fireDidChangeItemsExternal({ changed });
ok(changes.has('foo'));
equal(storage.get('foo'), 'bar1');
changes.clear();
// Delete is accepted
change.set('foo', undefined!);
database.fireDidChangeItemsExternal({ items: change });
const deleted = new Set<string>(['foo']);
database.fireDidChangeItemsExternal({ deleted });
ok(changes.has('foo'));
equal(storage.get('foo', null!), null);
equal(storage.get('foo', undefined), undefined);
changes.clear();
// Nothing happens if changing to same value
change.set('foo', undefined!);
database.fireDidChangeItemsExternal({ items: change });
database.fireDidChangeItemsExternal({ deleted });
equal(changes.size, 0);
await storage.close();
+1 -74
View File
@@ -375,11 +375,6 @@ class RootViewItem extends ViewItem {
}
}
interface IThrottledGestureEvent {
translationX: number;
translationY: number;
}
function reactionEquals(one: _.IDragOverReaction, other: _.IDragOverReaction | null): boolean {
if (!one && !other) {
return true;
@@ -417,7 +412,6 @@ export class TreeView extends HeightMap {
private scrollableElement: ScrollableElement;
private msGesture: MSGesture | undefined;
private lastPointerType: string = '';
private lastClickTimeStamp: number = 0;
private horizontalScrolling: boolean;
private contentWidthUpdateDelayer = new Delayer<void>(50);
@@ -520,12 +514,7 @@ export class TreeView extends HeightMap {
this._onDidScroll.fire();
});
if (Browser.isIE) {
this.wrapper.style.msTouchAction = 'none';
this.wrapper.style.msContentZooming = 'none';
} else {
this.gestureDisposable = Touch.Gesture.addTarget(this.wrapper);
}
this.gestureDisposable = Touch.Gesture.addTarget(this.wrapper);
this.rowsContainer = document.createElement('div');
this.rowsContainer.className = 'monaco-tree-rows';
@@ -552,26 +541,6 @@ export class TreeView extends HeightMap {
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, Touch.EventType.Tap, (e) => this.onTap(e)));
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, Touch.EventType.Change, (e) => this.onTouchChange(e)));
if (Browser.isIE) {
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'MSPointerDown', (e) => this.onMsPointerDown(e)));
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'MSGestureTap', (e) => this.onMsGestureTap(e)));
// these events come too fast, we throttle them
this.viewListeners.push(DOM.addDisposableThrottledListener<IThrottledGestureEvent, MSGestureEvent>(this.wrapper, 'MSGestureChange', e => this.onThrottledMsGestureChange(e), (lastEvent, event) => {
event.stopPropagation();
event.preventDefault();
let result = { translationY: event.translationY, translationX: event.translationX };
if (lastEvent) {
result.translationY += lastEvent.translationY;
result.translationX += lastEvent.translationX;
}
return result;
}));
}
this.viewListeners.push(DOM.addDisposableListener(window, 'dragover', (e) => this.onDragOver(e)));
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'drop', (e) => this.onDrop(e)));
this.viewListeners.push(DOM.addDisposableListener(window, 'dragend', (e) => this.onDragEnd(e)));
@@ -1144,15 +1113,6 @@ export class TreeView extends HeightMap {
return;
}
if (Browser.isIE && Date.now() - this.lastClickTimeStamp < 300) {
// IE10+ doesn't set the detail property correctly. While IE10 simply
// counts the number of clicks, IE11 reports always 1. To align with
// other browser, we set the value to 2 if clicks events come in a 300ms
// sequence.
event.detail = 2;
}
this.lastClickTimeStamp = Date.now();
this.context.controller!.onClick(this.context.tree, item.model.getElement(), event);
}
@@ -1563,39 +1523,6 @@ export class TreeView extends HeightMap {
this._onDOMBlur.fire();
}
// MS specific DOM Events
private onMsPointerDown(event: MSPointerEvent): void {
if (!this.msGesture) {
return;
}
// Circumvent IE11 breaking change in e.pointerType & TypeScript's stale definitions
let pointerType = event.pointerType;
if (pointerType === ((<any>event).MSPOINTER_TYPE_MOUSE || 'mouse')) {
this.lastPointerType = 'mouse';
return;
} else if (pointerType === ((<any>event).MSPOINTER_TYPE_TOUCH || 'touch')) {
this.lastPointerType = 'touch';
} else {
return;
}
event.stopPropagation();
event.preventDefault();
this.msGesture.addPointer(event.pointerId);
}
private onThrottledMsGestureChange(event: IThrottledGestureEvent): void {
this.scrollTop -= event.translationY;
}
private onMsGestureTap(event: MSGestureEvent): void {
(<any>event).initialTarget = document.elementFromPoint(event.clientX, event.clientY);
this.onTap(<any>event);
}
// DOM changes
private insertItemInDOM(item: ViewItem): void {

Some files were not shown because too many files have changed in this diff Show More