mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 01:25:38 -05:00
VS Code merge to df8fe74bd55313de0dd2303bc47a4aab0ca56b0e (#17979)
* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9 * delete unused folders * distro * Bump build node version * update chokidar * FIx hygiene errors * distro * Fix extension lint issues * Remove strict-vscode * Add copyright header exemptions * Bump vscode-extension-telemetry to fix webpacking issue with zone.js * distro * Fix failing tests (revert marked.js back to current one until we decide to update) * Skip searchmodel test * Fix mac build * temp debug script loading * Try disabling coverage * log error too * Revert "log error too" This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f. * Revert "temp debug script loading" This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c. * Add comments explaining coverage disabling * Fix ansi_up loading issue * Merge latest from ads * Use newer option * Fix compile * add debug logging warn * Always log stack * log more * undo debug * Update to use correct base path (+cleanup) * distro * fix compile errors * Remove strict-vscode * Fix sql editors not showing * Show db dropdown input & fix styling * Fix more info in gallery * Fix gallery asset requests * Delete unused workflow * Fix tapable resolutions for smoke test compile error * Fix smoke compile * Disable crash reporting * Disable interactive Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
79
src/bootstrap-window.js
vendored
79
src/bootstrap-window.js
vendored
@@ -24,7 +24,6 @@
|
||||
const bootstrapLib = bootstrap();
|
||||
const preloadGlobals = sandboxGlobals();
|
||||
const safeProcess = preloadGlobals.process;
|
||||
const useCustomProtocol = safeProcess.sandboxed || typeof safeProcess.env['VSCODE_BROWSER_CODE_LOADING'] === 'string';
|
||||
|
||||
/**
|
||||
* @typedef {import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
|
||||
@@ -45,17 +44,21 @@
|
||||
*/
|
||||
async function load(modulePaths, resultCallback, options) {
|
||||
|
||||
const isDev = !!safeProcess.env['VSCODE_DEV'];
|
||||
|
||||
// Error handler (TODO@sandbox non-sandboxed only)
|
||||
let showDevtoolsOnError = !!safeProcess.env['VSCODE_DEV'];
|
||||
let showDevtoolsOnError = isDev;
|
||||
safeProcess.on('uncaughtException', function (/** @type {string | Error} */ error) {
|
||||
onUnexpectedError(error, showDevtoolsOnError);
|
||||
});
|
||||
|
||||
// Await window configuration from preload
|
||||
const timeout = setTimeout(() => { console.error(`[resolve window config] Could not resolve window configuration within 10 seconds, but will continue to wait...`); }, 10000);
|
||||
performance.mark('code/willWaitForWindowConfig');
|
||||
/** @type {ISandboxConfiguration} */
|
||||
const configuration = await preloadGlobals.context.resolveConfiguration();
|
||||
performance.mark('code/didWaitForWindowConfig');
|
||||
clearTimeout(timeout);
|
||||
|
||||
// Signal DOM modifications are now OK
|
||||
if (typeof options?.canModifyDOM === 'function') {
|
||||
@@ -74,18 +77,13 @@
|
||||
disallowReloadKeybinding: false,
|
||||
removeDeveloperKeybindingsAfterLoad: false
|
||||
};
|
||||
showDevtoolsOnError = safeProcess.env['VSCODE_DEV'] && !forceDisableShowDevtoolsOnError;
|
||||
const enableDeveloperKeybindings = safeProcess.env['VSCODE_DEV'] || forceEnableDeveloperKeybindings;
|
||||
showDevtoolsOnError = isDev && !forceDisableShowDevtoolsOnError;
|
||||
const enableDeveloperKeybindings = isDev || forceEnableDeveloperKeybindings;
|
||||
let developerDeveloperKeybindingsDisposable;
|
||||
if (enableDeveloperKeybindings) {
|
||||
developerDeveloperKeybindingsDisposable = registerDeveloperKeybindings(disallowReloadKeybinding);
|
||||
}
|
||||
|
||||
// Correctly inherit the parent's environment (TODO@sandbox non-sandboxed only)
|
||||
if (!safeProcess.sandboxed) {
|
||||
Object.assign(safeProcess.env, configuration.userEnv);
|
||||
}
|
||||
|
||||
// Enable ASAR support (TODO@sandbox non-sandboxed only)
|
||||
if (!safeProcess.sandboxed) {
|
||||
globalThis.MonacoBootstrap.enableASARSupport(configuration.appRoot);
|
||||
@@ -103,11 +101,6 @@
|
||||
|
||||
window.document.documentElement.setAttribute('lang', locale);
|
||||
|
||||
// Do not advertise AMD to avoid confusing UMD modules loaded with nodejs
|
||||
if (!useCustomProtocol) {
|
||||
window['define'] = undefined;
|
||||
}
|
||||
|
||||
// Replace the patched electron fs with the original node fs for all AMD code (TODO@sandbox non-sandboxed only)
|
||||
if (!safeProcess.sandboxed) {
|
||||
require.define('fs', [], function () { return require.__$__nodeRequire('original-fs'); });
|
||||
@@ -116,12 +109,9 @@
|
||||
window['MonacoEnvironment'] = {};
|
||||
|
||||
const loaderConfig = {
|
||||
baseUrl: useCustomProtocol ?
|
||||
`${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out` :
|
||||
`${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32' })}/out`,
|
||||
baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out`,
|
||||
'vs/nls': nlsConfig,
|
||||
amdModulesPattern: /^(vs|sql)\//, // {{SQL CARBON EDIT}} include sql in regex
|
||||
preferScriptTags: useCustomProtocol
|
||||
preferScriptTags: true
|
||||
};
|
||||
|
||||
// use a trusted types policy when loading via script tags
|
||||
@@ -136,31 +126,34 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Enable loading of node modules:
|
||||
// - sandbox: we list paths of webpacked modules to help the loader
|
||||
// - non-sandbox: we signal that any module that does not begin with
|
||||
// `vs/` should be loaded using node.js require()
|
||||
if (safeProcess.sandboxed) {
|
||||
loaderConfig.paths = {
|
||||
'vscode-textmate': `../node_modules/vscode-textmate/release/main`,
|
||||
'vscode-oniguruma': `../node_modules/vscode-oniguruma/release/main`,
|
||||
'xterm': `../node_modules/xterm/lib/xterm.js`,
|
||||
'xterm-addon-search': `../node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
'xterm-addon-unicode11': `../node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
|
||||
'xterm-addon-webgl': `../node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
|
||||
'iconv-lite-umd': `../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`,
|
||||
'jschardet': `../node_modules/jschardet/dist/jschardet.min.js`,
|
||||
};
|
||||
} else {
|
||||
loaderConfig.amdModulesPattern = /^(vs|sql)\//; // {{SQL CARBON EDIT}} include sql in regex
|
||||
}
|
||||
// Teach the loader the location of the node modules we use in renderers
|
||||
// This will enable to load these modules via <script> tags instead of
|
||||
// using a fallback such as node.js require which does not exist in sandbox
|
||||
const baseNodeModulesPath = isDev ? '../node_modules' : '../node_modules.asar';
|
||||
loaderConfig.paths = {
|
||||
'vscode-textmate': `${baseNodeModulesPath}/vscode-textmate/release/main.js`,
|
||||
'vscode-oniguruma': `${baseNodeModulesPath}/vscode-oniguruma/release/main.js`,
|
||||
'xterm': `${baseNodeModulesPath}/xterm/lib/xterm.js`,
|
||||
'xterm-addon-search': `${baseNodeModulesPath}/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
'xterm-addon-unicode11': `${baseNodeModulesPath}/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
|
||||
'xterm-addon-webgl': `${baseNodeModulesPath}/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
|
||||
'iconv-lite-umd': `${baseNodeModulesPath}/iconv-lite-umd/lib/iconv-lite-umd.js`,
|
||||
'jschardet': `${baseNodeModulesPath}/jschardet/dist/jschardet.min.js`,
|
||||
'@vscode/vscode-languagedetection': `${baseNodeModulesPath}/@vscode/vscode-languagedetection/dist/lib/index.js`,
|
||||
'tas-client-umd': `${baseNodeModulesPath}/tas-client-umd/lib/tas-client-umd.js`,
|
||||
'ansi_up': `${baseNodeModulesPath}/ansi_up/ansi_up.js`
|
||||
};
|
||||
|
||||
// Cached data config (node.js loading only)
|
||||
if (!useCustomProtocol && configuration.codeCachePath) {
|
||||
loaderConfig.nodeCachedData = {
|
||||
path: configuration.codeCachePath,
|
||||
seed: modulePaths.join('')
|
||||
};
|
||||
// For priviledged renderers, allow to load built-in and other node.js
|
||||
// modules via AMD which has a fallback to using node.js `require`
|
||||
if (!safeProcess.sandboxed) {
|
||||
// VS Code uses an AMD loader for its own files (and ours) but Node.JS normally uses commonjs. For modules that
|
||||
// support UMD this may cause some issues since it will appear to them that AMD exists and so depending on the order
|
||||
// they check support for the two types they may end up using either commonjs or AMD. If commonjs is first this is
|
||||
// the expected method and so nothing needs to be done - but if it's AMD then the VS Code loader will throw an error
|
||||
// (Can only have one anonymous define call per script file). In order to make packages that do this load correctly
|
||||
// we need to add them to the list below to tell the loader that these should be loaded using AMD as well
|
||||
loaderConfig.amdModulesPattern = /(vs|sql)\/|(^vscode-textmate$)|(^vscode-oniguruma$)|(^xterm$)|(^xterm-addon-search$)|(^xterm-addon-unicode11$)|(^xterm-addon-webgl$)|(^iconv-lite-umd$)|(^jschardet$)|(^@vscode\/vscode-languagedetection$)|(^tas-client-umd$)|(^ansi_up$)/; // {{SQL CARBON EDIT}} include sql and ansi_up in regex
|
||||
}
|
||||
|
||||
// Signal before require.config()
|
||||
|
||||
Reference in New Issue
Block a user