Update to VS Code 1.52.1

This commit is contained in:
Asher
2021-02-09 16:08:37 +00:00
1351 changed files with 56560 additions and 38990 deletions

View File

@@ -35,6 +35,17 @@
}
},
/**
* @param {string} channel
* @param {any[]} args
* @returns {Promise<any> | undefined}
*/
invoke(channel, ...args) {
if (validateIPC(channel)) {
return ipcRenderer.invoke(channel, ...args);
}
},
/**
* @param {string} channel
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
@@ -97,80 +108,48 @@
/**
* Support for a subset of access to node.js global `process`.
*
* Note: when `sandbox` is enabled, the only properties available
* are https://github.com/electron/electron/blob/master/docs/api/process.md#sandbox
*/
process: {
get platform() { return process.platform; },
get env() { return process.env; },
get versions() { return process.versions; },
get type() { return 'renderer'; },
get execPath() { return process.execPath; },
_whenEnvResolved: undefined,
whenEnvResolved:
/**
* @returns when the shell environment has been resolved.
*/
function () {
if (!this._whenEnvResolved) {
this._whenEnvResolved = resolveEnv();
}
/**
* @param {{[key: string]: string}} userEnv
* @returns {Promise<void>}
*/
resolveEnv(userEnv) {
return resolveEnv(userEnv);
},
return this._whenEnvResolved;
},
/**
* @returns {Promise<import('electron').ProcessMemoryInfo>}
*/
getProcessMemoryInfo() {
return process.getProcessMemoryInfo();
},
nextTick:
/**
* Adds callback to the "next tick queue". This queue is fully drained
* after the current operation on the JavaScript stack runs to completion
* and before the event loop is allowed to continue.
*
* @param {Function} callback
* @param {any[]} args
*/
function nextTick(callback, ...args) {
return process.nextTick(callback, ...args);
},
cwd:
/**
* @returns the current working directory.
*/
function () {
return process.cwd();
},
getuid:
/**
* @returns the numeric user identity of the process
*/
function () {
return process.getuid();
},
getProcessMemoryInfo:
/**
* @returns {Promise<import('electron').ProcessMemoryInfo>}
*/
function () {
return process.getProcessMemoryInfo();
},
on:
/**
* @param {string} type
* @param {() => void} callback
*/
function (type, callback) {
if (validateProcessEventType(type)) {
process.on(type, callback);
}
/**
* @param {string} type
* @param {() => void} callback
*/
on(type, callback) {
if (validateProcessEventType(type)) {
process.on(type, callback);
}
}
},
/**
* Some information about the context we are running in.
*/
context: {
get sandbox() { return process.argv.includes('--enable-sandbox'); }
get sandbox() { return process.sandboxed; }
}
};
@@ -197,6 +176,7 @@
/**
* @param {string} channel
* @returns {true | never}
*/
function validateIPC(channel) {
if (!channel || !channel.startsWith('vscode:')) {
@@ -218,32 +198,40 @@
return true;
}
/** @type {Promise<void> | undefined} */
let resolvedEnv = undefined;
/**
* If VSCode is not run from a terminal, we should resolve additional
* shell specific environment from the OS shell to ensure we are seeing
* all development related environment variables. We do this from the
* main process because it may involve spawning a shell.
*
* @param {{[key: string]: string}} userEnv
* @returns {Promise<void>}
*/
function resolveEnv() {
return new Promise(function (resolve) {
const handle = setTimeout(function () {
console.warn('Preload: Unable to resolve shell environment in a reasonable time');
function resolveEnv(userEnv) {
if (!resolvedEnv) {
// It took too long to fetch the shell environment, return
resolve();
}, 3000);
// Apply `userEnv` directly
Object.assign(process.env, userEnv);
ipcRenderer.once('vscode:acceptShellEnv', function (event, shellEnv) {
clearTimeout(handle);
// Resolve `shellEnv` from the main side
resolvedEnv = new Promise(function (resolve) {
ipcRenderer.once('vscode:acceptShellEnv', function (event, shellEnv) {
// Assign all keys of the shell environment to our process environment
Object.assign(process.env, shellEnv);
// Assign all keys of the shell environment to our process environment
// But make sure that the user environment wins in the end
Object.assign(process.env, shellEnv, userEnv);
resolve();
resolve();
});
ipcRenderer.send('vscode:fetchShellEnv');
});
}
ipcRenderer.send('vscode:fetchShellEnv');
});
return resolvedEnv;
}
//#endregion