Merge VS Code 1.31.1 (#4283)

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

View File

@@ -28,20 +28,18 @@ bootstrap.enableASARSupport();
const args = parseCLIArgs();
const userDataPath = getUserDataPath(args);
// TODO@Ben global storage migration needs to happen very early before app.on("ready")
// We copy the DB instead of moving it to ensure we are not running into locking issues
if (process.env['VSCODE_TEST_STORAGE_MIGRATION']) {
try {
const globalStorageHome = path.join(userDataPath, 'User', 'globalStorage', 'temp.vscdb');
const localStorageHome = path.join(userDataPath, 'Local Storage');
const localStorageDB = path.join(localStorageHome, 'file__0.localstorage');
const localStorageDBBackup = path.join(localStorageHome, 'file__0.localstorage.vscmig');
if (!fs.existsSync(globalStorageHome) && fs.existsSync(localStorageDB)) {
fs.copyFileSync(localStorageDB, localStorageDBBackup);
}
} catch (error) {
console.error(error);
// global storage migration needs to happen very early before app.on("ready")
// TODO@Ben remove after a while
try {
const globalStorageHome = path.join(userDataPath, 'User', 'globalStorage', 'state.vscdb');
const localStorageHome = path.join(userDataPath, 'Local Storage');
const localStorageDB = path.join(localStorageHome, 'file__0.localstorage');
const localStorageDBBackup = path.join(localStorageHome, 'file__0.vscmig');
if (!fs.existsSync(globalStorageHome) && fs.existsSync(localStorageDB)) {
fs.renameSync(localStorageDB, localStorageDBBackup);
}
} catch (error) {
console.error(error);
}
app.setPath('userData', userDataPath);
@@ -108,7 +106,10 @@ function onReady() {
process.env['VSCODE_NODE_CACHED_DATA_DIR'] = cachedDataDir || '';
// Load main in AMD
require('./bootstrap-amd').load('vs/code/electron-main/main');
perf.mark('willLoadMainBundle');
require('./bootstrap-amd').load('vs/code/electron-main/main', () => {
perf.mark('didLoadMainBundle');
});
};
// We recevied a valid nlsConfig from a user defined locale
@@ -149,9 +150,6 @@ function onReady() {
*/
function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) {
// TODO@Ben Electron 2.0.x: prevent localStorage migration from SQLite to LevelDB due to issues
app.commandLine.appendSwitch('disable-mojo-local-storage');
// Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791)
app.commandLine.appendSwitch('disable-features', 'ColorCorrectRendering');
@@ -168,10 +166,13 @@ function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) {
* @returns {string}
*/
function resolveJSFlags(cliArgs, ...jsFlags) {
// Add any existing JS flags we already got from the command line
if (cliArgs['js-flags']) {
jsFlags.push(cliArgs['js-flags']);
}
// Support max-memory flag
if (cliArgs['max-memory'] && !/max_old_space_size=(\d+)/g.exec(cliArgs['js-flags'])) {
jsFlags.push(`--max_old_space_size=${cliArgs['max-memory']}`);
}
@@ -269,7 +270,8 @@ function getNodeCachedDir() {
}
jsFlags() {
return this.value ? '--nolazy' : undefined;
// return this.value ? '--nolazy' : undefined;
return undefined;
}
ensureExists() {
@@ -415,7 +417,7 @@ function rimraf(location) {
}
}, err => {
if (err.code === 'ENOENT') {
return void 0;
return undefined;
}
throw err;
});
@@ -435,20 +437,16 @@ function getUserDefinedLocale() {
}
const localeConfig = path.join(userDataPath, 'User', 'locale.json');
return exists(localeConfig).then((result) => {
if (result) {
return bootstrap.readFile(localeConfig).then((content) => {
content = stripComments(content);
try {
const value = JSON.parse(content).locale;
return value && typeof value === 'string' ? value.toLowerCase() : undefined;
} catch (e) {
return undefined;
}
});
} else {
return bootstrap.readFile(localeConfig).then((content) => {
content = stripComments(content);
try {
const value = JSON.parse(content).locale;
return value && typeof value === 'string' ? value.toLowerCase() : undefined;
} catch (e) {
return undefined;
}
}, () => {
return undefined;
});
}