Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -5,13 +5,13 @@
'use strict';
var path = require('path');
var fs = require('fs');
var https = require('https');
var url = require('url');
let path = require('path');
let fs = require('fs');
let https = require('https');
let url = require('url');
function getCommitSha(repoId, repoPath) {
var commitInfo = 'https://api.github.com/repos/' + repoId + '/commits?path=' + repoPath;
let commitInfo = 'https://api.github.com/repos/' + repoId + '/commits?path=' + repoPath;
return download(commitInfo).then(function (content) {
try {
let lastCommit = JSON.parse(content)[0];
@@ -23,7 +23,7 @@ function getCommitSha(repoId, repoPath) {
return Promise.resolve(null);
}
}, function () {
console.err('Failed loading ' + commitInfo);
console.error('Failed loading ' + commitInfo);
return Promise.resolve(null);
});
}
@@ -33,9 +33,9 @@ function download(source) {
return readFile(source);
}
return new Promise((c, e) => {
var _url = url.parse(source);
var options = { host: _url.host, port: _url.port, path: _url.path, headers: { 'User-Agent': 'NodeJS' }};
var content = '';
let _url = url.parse(source);
let options = { host: _url.host, port: _url.port, path: _url.path, headers: { 'User-Agent': 'NodeJS' }};
let content = '';
https.get(options, function (response) {
response.on('data', function (data) {
content += data.toString();
@@ -69,7 +69,7 @@ function downloadBinary(source, dest) {
https.get(source, function (response) {
switch(response.statusCode) {
case 200:
var file = fs.createWriteStream(dest);
let file = fs.createWriteStream(dest);
response.on('data', function(chunk){
file.write(chunk);
}).on('end', function(){
@@ -96,16 +96,16 @@ function downloadBinary(source, dest) {
function copyFile(fileName, dest) {
return new Promise((c, e) => {
var cbCalled = false;
let cbCalled = false;
function handleError(err) {
if (!cbCalled) {
e(err);
cbCalled = true;
}
}
var rd = fs.createReadStream(fileName);
let rd = fs.createReadStream(fileName);
rd.on("error", handleError);
var wr = fs.createWriteStream(dest);
let wr = fs.createWriteStream(dest);
wr.on("error", handleError);
wr.on("close", function() {
if (!cbCalled) {
@@ -118,10 +118,10 @@ function copyFile(fileName, dest) {
}
function darkenColor(color) {
var res = '#';
for (var i = 1; i < 7; i+=2) {
var newVal = Math.round(parseInt('0x' + color.substr(i, 2), 16) * 0.9);
var hex = newVal.toString(16);
let res = '#';
for (let i = 1; i < 7; i+=2) {
let newVal = Math.round(parseInt('0x' + color.substr(i, 2), 16) * 0.9);
let hex = newVal.toString(16);
if (hex.length == 1) {
res += '0';
}
@@ -132,23 +132,23 @@ function darkenColor(color) {
function getLanguageMappings() {
let langMappings = {};
var allExtensions = fs.readdirSync('..');
for (var i= 0; i < allExtensions.length; i++) {
let allExtensions = fs.readdirSync('..');
for (let i= 0; i < allExtensions.length; i++) {
let dirPath = path.join('..', allExtensions[i], 'package.json');
if (fs.existsSync(dirPath)) {
let content = fs.readFileSync(dirPath).toString();
let jsonContent = JSON.parse(content);
let languages = jsonContent.contributes && jsonContent.contributes.languages;
if (Array.isArray(languages)) {
for (var k = 0; k < languages.length; k++) {
var languageId = languages[k].id;
for (let k = 0; k < languages.length; k++) {
let languageId = languages[k].id;
if (languageId) {
var extensions = languages[k].extensions;
var mapping = {};
let extensions = languages[k].extensions;
let mapping = {};
if (Array.isArray(extensions)) {
mapping.extensions = extensions.map(function (e) { return e.substr(1).toLowerCase(); });
}
var filenames = languages[k].filenames;
let filenames = languages[k].filenames;
if (Array.isArray(filenames)) {
mapping.fileNames = filenames.map(function (f) { return f.toLowerCase(); });
}
@@ -161,43 +161,45 @@ function getLanguageMappings() {
return langMappings;
}
//var font = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti/seti.woff';
var font = '../../../seti-ui/styles/_fonts/seti/seti.woff';
//let font = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti/seti.woff';
let font = '../../../seti-ui/styles/_fonts/seti/seti.woff';
exports.copyFont = function() {
return downloadBinary(font, './icons/seti.woff');
};
//var fontMappings = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti.less';
//var mappings = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/components/icons/mapping.less';
//var colors = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/ui-variables.less';
//let fontMappings = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti.less';
//let mappings = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/components/icons/mapping.less';
//let colors = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/ui-variables.less';
var fontMappings = '../../../seti-ui/styles/_fonts/seti.less';
var mappings = '../../../seti-ui/styles/components/icons/mapping.less';
var colors = '../../../seti-ui/styles/ui-variables.less';
let fontMappings = '../../../seti-ui/styles/_fonts/seti.less';
let mappings = '../../../seti-ui/styles/components/icons/mapping.less';
let colors = '../../../seti-ui/styles/ui-variables.less';
exports.update = function () {
console.log('Reading from ' + fontMappings);
var def2Content = {};
var ext2Def = {};
var fileName2Def = {};
var def2ColorId = {};
var colorId2Value = {};
var lang2Def = {};
let def2Content = {};
let ext2Def = {};
let fileName2Def = {};
let def2ColorId = {};
let colorId2Value = {};
let lang2Def = {};
function writeFileIconContent(info) {
var iconDefinitions = {};
let iconDefinitions = {};
let allDefs = Object.keys(def2Content).sort();
for (var def in def2Content) {
var entry = { fontCharacter: def2Content[def] };
var colorId = def2ColorId[def];
for (let i = 0; i < allDefs.length; i++) {
let def = allDefs[i];
let entry = { fontCharacter: def2Content[def] };
let colorId = def2ColorId[def];
if (colorId) {
var colorValue = colorId2Value[colorId];
let colorValue = colorId2Value[colorId];
if (colorValue) {
entry.fontColor = colorValue;
var entryInverse = { fontCharacter: entry.fontCharacter, fontColor: darkenColor(colorValue) };
let entryInverse = { fontCharacter: entry.fontCharacter, fontColor: darkenColor(colorValue) };
iconDefinitions[def + '_light'] = entryInverse;
}
}
@@ -205,8 +207,8 @@ exports.update = function () {
}
function getInvertSet(input) {
var result = {};
for (var assoc in input) {
let result = {};
for (let assoc in input) {
let invertDef = input[assoc] + '_light';
if (iconDefinitions[invertDef]) {
result[assoc] = invertDef;
@@ -215,7 +217,7 @@ exports.update = function () {
return result;
}
var res = {
let res = {
information_for_contributors: [
'This file has been generated from data in https://github.com/jesseweed/seti-ui',
'- icon definitions: https://github.com/jesseweed/seti-ui/blob/master/styles/_fonts/seti.less',
@@ -246,40 +248,52 @@ exports.update = function () {
version: 'https://github.com/jesseweed/seti-ui/commit/' + info.commitSha,
};
var path = './icons/vs-seti-icon-theme.json';
let path = './icons/vs-seti-icon-theme.json';
fs.writeFileSync(path, JSON.stringify(res, null, '\t'));
console.log('written ' + path);
}
var match;
let match;
return download(fontMappings).then(function (content) {
var regex = /@([\w-]+):\s*'(\\E[0-9A-F]+)';/g;
let regex = /@([\w-]+):\s*'(\\E[0-9A-F]+)';/g;
let contents = {};
while ((match = regex.exec(content)) !== null) {
def2Content['_' + match[1]] = match[2];
contents[match[1]] = match[2];
}
return download(mappings).then(function (content) {
var regex2 = /\.icon-(?:set|partial)\('([\w-\.]+)',\s*'([\w-]+)',\s*(@[\w-]+)\)/g;
let regex2 = /\.icon-(?:set|partial)\('([\w-\.]+)',\s*'([\w-]+)',\s*(@[\w-]+)\)/g;
while ((match = regex2.exec(content)) !== null) {
let pattern = match[1];
let def = '_' + match[2];
let colorId = match[3];
let storedColorId = def2ColorId[def];
let i = 1;
while (storedColorId && colorId !== storedColorId) { // different colors for the same def?
def = `_${match[2]}_${i}`;
storedColorId = def2ColorId[def];
i++;
}
if (!def2ColorId[def]) {
def2ColorId[def] = colorId;
def2Content[def] = contents[match[2]];
}
if (pattern[0] === '.') {
ext2Def[pattern.substr(1).toLowerCase()] = def;
} else {
fileName2Def[pattern.toLowerCase()] = def;
}
def2ColorId[def] = colorId;
}
// replace extensions for languageId
var langMappings = getLanguageMappings();
for (var lang in langMappings) {
var mappings = langMappings[lang];
var exts = mappings.extensions || [];
var fileNames = mappings.fileNames || [];
var preferredDef = null;
let langMappings = getLanguageMappings();
for (let lang in langMappings) {
let mappings = langMappings[lang];
let exts = mappings.extensions || [];
let fileNames = mappings.fileNames || [];
let preferredDef = null;
// use the first file association for the preferred definition
for (let i1 = 0; i1 < exts.length && !preferredDef; i1++) {
preferredDef = ext2Def[exts[i1]];
@@ -307,7 +321,7 @@ exports.update = function () {
return download(colors).then(function (content) {
var regex3 = /(@[\w-]+):\s*(#[0-9a-z]+)/g;
let regex3 = /(@[\w-]+):\s*(#[0-9a-z]+)/g;
while ((match = regex3.exec(content)) !== null) {
colorId2Value[match[1]] = match[2];
}

View File

@@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><title>dashboard</title><path d="M8,.19a7.61,7.61,0,0,1,2.07.28,8,8,0,0,1,1.87.79,7.8,7.8,0,0,1,2.8,2.8,8,8,0,0,1,.79,1.87,7.78,7.78,0,0,1,0,4.14,8,8,0,0,1-.79,1.87,7.8,7.8,0,0,1-2.8,2.8,8,8,0,0,1-1.87.79,7.78,7.78,0,0,1-4.14,0,8,8,0,0,1-1.87-.79,7.8,7.8,0,0,1-2.8-2.8,8,8,0,0,1-.79-1.87,7.78,7.78,0,0,1,0-4.14,8,8,0,0,1,.79-1.87,7.8,7.8,0,0,1,2.8-2.8A8,8,0,0,1,5.93.47,7.6,7.6,0,0,1,8,.19ZM8,14.77a6.58,6.58,0,0,0,1.8-.24,6.94,6.94,0,0,0,1.62-.68,6.77,6.77,0,0,0,2.43-2.43,6.94,6.94,0,0,0,.68-1.62,6.75,6.75,0,0,0,0-3.6,6.94,6.94,0,0,0-.68-1.62,6.77,6.77,0,0,0-2.43-2.43A6.94,6.94,0,0,0,9.8,1.47a6.75,6.75,0,0,0-3.6,0,6.93,6.93,0,0,0-1.62.68A6.77,6.77,0,0,0,2.16,4.59,6.94,6.94,0,0,0,1.47,6.2a6.75,6.75,0,0,0,0,3.6,6.94,6.94,0,0,0,.68,1.62,6.77,6.77,0,0,0,2.43,2.43,6.93,6.93,0,0,0,1.62.68A6.57,6.57,0,0,0,8,14.77Zm1.92-11A4.68,4.68,0,0,0,8,3.31,4.58,4.58,0,0,0,5.62,4a4.7,4.7,0,0,0-.94.74A4.77,4.77,0,0,0,4,5.64a4.68,4.68,0,0,0-.47,1.12,4.69,4.69,0,0,0,.19,3,4.66,4.66,0,0,0,1,1.52l-.74.74a5.72,5.72,0,0,1-.9-6.94A5.75,5.75,0,0,1,3.95,4,5.76,5.76,0,0,1,9.2,2.41a5.58,5.58,0,0,1,1.14.38ZM9.4,7.32A1.52,1.52,0,0,1,9.56,8a1.54,1.54,0,0,1-.12.61,1.55,1.55,0,0,1-.83.83,1.59,1.59,0,0,1-1.22,0,1.55,1.55,0,0,1-.83-.83,1.59,1.59,0,0,1,0-1.22,1.55,1.55,0,0,1,.83-.83A1.53,1.53,0,0,1,8,6.44a1.51,1.51,0,0,1,.68.16h0l3-3,.73.73-3,3ZM8,8.52a.53.53,0,1,0-.37-.15A.5.5,0,0,0,8,8.52Zm5.21-2.86a5.58,5.58,0,0,1,.38,1.14A5.71,5.71,0,0,1,13.71,8a5.78,5.78,0,0,1-.43,2.19,5.55,5.55,0,0,1-1.23,1.86l-.74-.74a4.71,4.71,0,0,0,1-1.51A4.52,4.52,0,0,0,12.69,8a4.68,4.68,0,0,0-.42-1.95Z"/></svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:#fff;}</style></defs><title>dashboard_inverse</title><path class="cls-1" d="M7.95.19A7.61,7.61,0,0,1,10,.47a8,8,0,0,1,1.87.79,7.8,7.8,0,0,1,2.8,2.8,8,8,0,0,1,.79,1.87,7.78,7.78,0,0,1,0,4.14,8,8,0,0,1-.79,1.87,7.8,7.8,0,0,1-2.8,2.8,8,8,0,0,1-1.87.79,7.78,7.78,0,0,1-4.14,0A8,8,0,0,1,4,14.74a7.8,7.8,0,0,1-2.8-2.8,8,8,0,0,1-.79-1.87,7.78,7.78,0,0,1,0-4.14,8,8,0,0,1,.79-1.87A7.8,7.8,0,0,1,4,1.26,8,8,0,0,1,5.88.47,7.6,7.6,0,0,1,7.95.19Zm0,14.58a6.58,6.58,0,0,0,1.8-.24,6.94,6.94,0,0,0,1.62-.68,6.77,6.77,0,0,0,2.43-2.43,6.94,6.94,0,0,0,.68-1.62,6.75,6.75,0,0,0,0-3.6,6.94,6.94,0,0,0-.68-1.62,6.77,6.77,0,0,0-2.43-2.43,6.94,6.94,0,0,0-1.62-.68,6.75,6.75,0,0,0-3.6,0,6.93,6.93,0,0,0-1.62.68A6.77,6.77,0,0,0,2.11,4.59,6.94,6.94,0,0,0,1.42,6.2a6.75,6.75,0,0,0,0,3.6,6.94,6.94,0,0,0,.68,1.62,6.77,6.77,0,0,0,2.43,2.43,6.93,6.93,0,0,0,1.62.68A6.57,6.57,0,0,0,7.95,14.77Zm1.92-11a4.68,4.68,0,0,0-1.95-.42A4.58,4.58,0,0,0,5.57,4a4.7,4.7,0,0,0-.94.74,4.77,4.77,0,0,0-.73.95,4.68,4.68,0,0,0-.47,1.12,4.69,4.69,0,0,0,.19,3,4.66,4.66,0,0,0,1,1.52l-.74.74A5.72,5.72,0,0,1,3,5.11,5.75,5.75,0,0,1,3.9,4,5.76,5.76,0,0,1,9.15,2.41a5.58,5.58,0,0,1,1.14.38ZM9.35,7.32A1.52,1.52,0,0,1,9.51,8a1.54,1.54,0,0,1-.12.61,1.55,1.55,0,0,1-.83.83,1.59,1.59,0,0,1-1.22,0,1.55,1.55,0,0,1-.83-.83,1.59,1.59,0,0,1,0-1.22,1.55,1.55,0,0,1,.83-.83,1.53,1.53,0,0,1,.61-.12,1.51,1.51,0,0,1,.68.16h0l3-3,.73.73-3,3Zm-1.4,1.2a.53.53,0,1,0-.37-.15A.5.5,0,0,0,7.95,8.52Zm5.21-2.86a5.58,5.58,0,0,1,.38,1.14A5.71,5.71,0,0,1,13.66,8a5.78,5.78,0,0,1-.43,2.19A5.55,5.55,0,0,1,12,12.05l-.74-.74a4.71,4.71,0,0,0,1-1.51A4.52,4.52,0,0,0,12.64,8a4.68,4.68,0,0,0-.42-1.95Z"/></svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,11 @@
{
"name": "vscode-theme-seti",
"private": true,
"version": "0.1.0",
"description": "A file icon theme made out of the Seti UI file icons",
"version": "1.0.0",
"displayName": "%displayName%",
"description": "%description%",
"publisher": "vscode",
"icon": "icons/seti-circular-128x128.png",
"scripts": {
"update": "node ./build/update-icon-theme.js"
},

View File

@@ -0,0 +1,4 @@
{
"displayName": "Seti File Icon Theme",
"description": "A file icon theme made out of the Seti UI file icons"
}