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:
Charles Gagnon
2022-01-06 09:06:56 -08:00
committed by GitHub
co-authored by ADS Merger
parent fd2736b6a6
commit 2bc6a0cd01
2099 changed files with 79520 additions and 43813 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ const bootstrapNode = require('./bootstrap-node');
bootstrapNode.removeGlobalNodeModuleLookupPaths();
// Enable ASAR in our forked processes
bootstrap.enableASARSupport(undefined);
bootstrap.enableASARSupport();
if (process.env['VSCODE_INJECT_NODE_MODULE_LOOKUP_PATH']) {
bootstrapNode.injectNodeModuleLookupPath(process.env['VSCODE_INJECT_NODE_MODULE_LOOKUP_PATH']);
+6 -16
View File
@@ -8,34 +8,24 @@
// Setup current working directory in all our node & electron processes
// - Windows: call `process.chdir()` to always set application folder as cwd
// - Posix: allow to change the current working dir via `VSCODE_CWD` if defined
// - all OS: store the `process.cwd()` inside `VSCODE_CWD` for consistent lookups
// TODO@bpasero revisit if chdir() on Windows is needed in the future still
// (find all users of `chdir` in code, there are more locations)
function setupCurrentWorkingDirectory() {
const path = require('path');
try {
let cwd = process.env['VSCODE_CWD'];
// remember current working directory in environment
// unless it was given to us already from outside
if (typeof cwd !== 'string') {
cwd = process.cwd();
process.env['VSCODE_CWD'] = cwd;
// Store the `process.cwd()` inside `VSCODE_CWD`
// for consistent lookups, but make sure to only
// do this once unless defined already from e.g.
// a parent process.
if (typeof process.env['VSCODE_CWD'] !== 'string') {
process.env['VSCODE_CWD'] = process.cwd();
}
// Windows: always set application folder as current working dir
if (process.platform === 'win32') {
process.chdir(path.dirname(process.execPath));
}
// Linux/macOS: allow to change current working dir based on env
else {
if (cwd !== process.cwd()) {
process.chdir(cwd);
}
}
} catch (err) {
console.error(err);
}
+36 -43
View File
@@ -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()
+38 -10
View File
@@ -42,25 +42,42 @@
//#region Add support for using node_modules.asar
/**
* @param {string | undefined} appRoot
* TODO@sandbox remove the support for passing in `appRoot` once
* sandbox is fully enabled
*
* @param {string=} appRoot
*/
function enableASARSupport(appRoot) {
if (!path || !Module || typeof process === 'undefined') {
console.warn('enableASARSupport() is only available in node.js environments'); // TODO@sandbox ASAR is currently non-sandboxed only
console.warn('enableASARSupport() is only available in node.js environments');
return;
}
let NODE_MODULES_PATH = appRoot ? path.join(appRoot, 'node_modules') : undefined;
if (!NODE_MODULES_PATH) {
NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
} else {
// use the drive letter casing of __dirname
if (process.platform === 'win32') {
NODE_MODULES_PATH = __dirname.substr(0, 1) + NODE_MODULES_PATH.substr(1);
const NODE_MODULES_PATH = appRoot ? path.join(appRoot, 'node_modules') : path.join(__dirname, '../node_modules');
// Windows only:
// use both lowercase and uppercase drive letter
// as a way to ensure we do the right check on
// the node modules path: node.js might internally
// use a different case compared to what we have
let NODE_MODULES_ALTERNATIVE_PATH;
if (appRoot /* only used from renderer until `sandbox` enabled */ && process.platform === 'win32') {
const driveLetter = appRoot.substr(0, 1);
let alternativeDriveLetter;
if (driveLetter.toLowerCase() !== driveLetter) {
alternativeDriveLetter = driveLetter.toLowerCase();
} else {
alternativeDriveLetter = driveLetter.toUpperCase();
}
NODE_MODULES_ALTERNATIVE_PATH = alternativeDriveLetter + NODE_MODULES_PATH.substr(1);
} else {
NODE_MODULES_ALTERNATIVE_PATH = undefined;
}
const NODE_MODULES_ASAR_PATH = `${NODE_MODULES_PATH}.asar`;
const NODE_MODULES_ASAR_ALTERNATIVE_PATH = NODE_MODULES_ALTERNATIVE_PATH ? `${NODE_MODULES_ALTERNATIVE_PATH}.asar` : undefined;
// @ts-ignore
const originalResolveLookupPaths = Module._resolveLookupPaths;
@@ -69,12 +86,23 @@
Module._resolveLookupPaths = function (request, parent) {
const paths = originalResolveLookupPaths(request, parent);
if (Array.isArray(paths)) {
let asarPathAdded = false;
for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === NODE_MODULES_PATH) {
asarPathAdded = true;
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
break;
} else if (paths[i] === NODE_MODULES_ALTERNATIVE_PATH) {
asarPathAdded = true;
paths.splice(i, 0, NODE_MODULES_ASAR_ALTERNATIVE_PATH);
break;
}
}
if (!asarPathAdded && appRoot) {
// Assuming that adding just `NODE_MODULES_ASAR_PATH` is sufficient
// because nodejs should find it even if it has a different driver letter case
paths.push(NODE_MODULES_ASAR_PATH);
}
}
return paths;
@@ -93,7 +121,7 @@
*/
function fileUriFromPath(path, config) {
// Since we are building a URI, we normalize any backlsash
// Since we are building a URI, we normalize any backslash
// to slashes and we ensure that the path begins with a '/'.
let pathName = path.replace(/\\/g, '/');
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
+8 -9
View File
@@ -3,9 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function entrypoint(name) {
return [{ name: name, include: [], exclude: ['vs/css', 'vs/nls'] }];
}
const { createModuleDescription, createEditorWorkerModuleDescription } = require('./vs/base/buildfile');
exports.base = [{
name: 'vs/base/common/worker/simpleWorker',
@@ -15,18 +13,19 @@ exports.base = [{
dest: 'vs/base/worker/workerMain.js'
}];
exports.workerExtensionHost = [entrypoint('vs/workbench/services/extensions/worker/extensionHostWorker')];
exports.workerNotebook = [entrypoint('vs/workbench/contrib/notebook/common/services/notebookSimpleWorker')];
exports.workerExtensionHost = [createEditorWorkerModuleDescription('vs/workbench/services/extensions/worker/extensionHostWorker')];
exports.workerNotebook = [createEditorWorkerModuleDescription('vs/workbench/contrib/notebook/common/services/notebookSimpleWorker')];
exports.workerLanguageDetection = [createEditorWorkerModuleDescription('vs/workbench/services/languageDetection/browser/languageDetectionSimpleWorker')];
exports.workbenchDesktop = require('./vs/workbench/buildfile.desktop').collectModules();
exports.workbenchWeb = require('./vs/workbench/buildfile.web').collectModules();
exports.keyboardMaps = [
entrypoint('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux'),
entrypoint('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin'),
entrypoint('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win')
createModuleDescription('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux'),
createModuleDescription('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin'),
createModuleDescription('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win')
];
exports.code = require('./vs/code/buildfile').collectModules();
exports.entrypoint = entrypoint;
exports.entrypoint = createModuleDescription;
+9 -1
View File
@@ -6,6 +6,14 @@
//@ts-check
'use strict';
// Delete `VSCODE_CWD` very early even before
// importing bootstrap files. We have seen
// reports where `code .` would use the wrong
// current working directory due to our variable
// somehow escaping to the parent shell
// (https://github.com/microsoft/vscode/issues/126399)
delete process.env['VSCODE_CWD'];
const bootstrap = require('./bootstrap');
const bootstrapNode = require('./bootstrap-node');
const product = require('../product.json');
@@ -17,7 +25,7 @@ bootstrap.avoidMonkeyPatchFromAppInsights();
bootstrapNode.configurePortable(product);
// Enable ASAR support
bootstrap.enableASARSupport(undefined);
bootstrap.enableASARSupport();
// Signal processes that we got launched as CLI
process.env['VSCODE_CLI'] = '1';
+34 -36
View File
@@ -33,7 +33,7 @@ app.allowRendererProcessReuse = false;
const portable = bootstrapNode.configurePortable(product);
// Enable ASAR support
bootstrap.enableASARSupport(undefined);
bootstrap.enableASARSupport();
// Set userData path before app 'ready' event
const args = parseCLIArgs();
@@ -55,7 +55,18 @@ const argvConfig = configureCommandlineSwitchesSync(args);
// Configure crash reporter
perf.mark('code/willStartCrashReporter');
configureCrashReporter();
// If a crash-reporter-directory is specified we store the crash reports
// in the specified directory and don't upload them to the crash server.
//
// Appcenter crash reporting is enabled if
// * enable-crash-reporter runtime argument is set to 'true'
// * --disable-crash-reporter command line parameter is not set
//
// Disable crash reporting in all other cases.
if (args['crash-reporter-directory'] ||
(argvConfig['enable-crash-reporter'] && !args['disable-crash-reporter'])) {
configureCrashReporter();
}
perf.mark('code/didStartCrashReporter');
// Set logs path before app 'ready' event if running portable
@@ -170,10 +181,6 @@ function configureCommandlineSwitchesSync(cliArgs) {
// Persistently enable proposed api via argv.json: https://github.com/microsoft/vscode/issues/99775
'enable-proposed-api',
// TODO@sandbox remove me once testing is done on `vscode-file` protocol
// (all traces of `enable-browser-code-loading` and `VSCODE_BROWSER_CODE_LOADING`)
'enable-browser-code-loading',
// Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'.
'log-level'
];
@@ -181,8 +188,6 @@ function configureCommandlineSwitchesSync(cliArgs) {
// Read argv config
const argvConfig = readArgvConfigSync();
let browserCodeLoadingStrategy = undefined; // {{SQL CARBON EDIT}} Set to undefined by default
Object.keys(argvConfig).forEach(argvKey => {
const argvValue = argvConfig[argvKey];
@@ -217,14 +222,6 @@ function configureCommandlineSwitchesSync(cliArgs) {
}
break;
case 'enable-browser-code-loading':
if (argvValue === false) {
browserCodeLoadingStrategy = undefined;
} else if (typeof argvValue === 'string') {
browserCodeLoadingStrategy = argvValue;
}
break;
case 'log-level':
if (typeof argvValue === 'string') {
process.argv.push('--log', argvValue);
@@ -240,11 +237,6 @@ function configureCommandlineSwitchesSync(cliArgs) {
app.commandLine.appendSwitch('js-flags', jsFlags);
}
// Configure vscode-file:// code loading environment
if (cliArgs.__sandbox || browserCodeLoadingStrategy) {
process.env['VSCODE_BROWSER_CODE_LOADING'] = browserCodeLoadingStrategy || 'bypassHeatCheck';
}
return argvConfig;
}
@@ -328,8 +320,6 @@ function getArgvConfigPath() {
function configureCrashReporter() {
// If a crash-reporter-directory is specified we store the crash reports
// in the specified directory and don't upload them to the crash server.
let crashReporterDirectory = args['crash-reporter-directory'];
let submitURL = '';
if (crashReporterDirectory) {
@@ -358,11 +348,7 @@ function configureCrashReporter() {
// Otherwise we configure the crash reporter from product.json
else {
const appCenter = product.appCenter;
// Disable Appcenter crash reporting if
// * --crash-reporter-directory is specified
// * enable-crash-reporter runtime argument is set to 'false'
// * --disable-crash-reporter command line parameter is set
if (appCenter && argvConfig['enable-crash-reporter'] && !args['disable-crash-reporter']) {
if (appCenter) {
const isWindows = (process.platform === 'win32');
const isLinux = (process.platform === 'linux');
const isDarwin = (process.platform === 'darwin');
@@ -415,15 +401,27 @@ function configureCrashReporter() {
}
// Start crash reporter for all processes
/* {{SQL CARBON EDIT}} Disable crash reporting until we're actually set up to use it
const productName = (product.crashReporter ? product.crashReporter.productName : undefined) || product.nameShort;
const companyName = (product.crashReporter ? product.crashReporter.companyName : undefined) || 'Microsoft';
crashReporter.start({
companyName: companyName,
productName: process.env['VSCODE_DEV'] ? `${productName} Dev` : productName,
submitURL,
uploadToServer: !crashReporterDirectory,
compress: true
});
if (process.env['VSCODE_DEV']) {
crashReporter.start({
companyName: companyName,
productName: `${productName} Dev`,
submitURL,
uploadToServer: false,
compress: true
});
} else {
crashReporter.start({
companyName: companyName,
productName: productName,
submitURL,
uploadToServer: !crashReporterDirectory,
compress: true
});
}
*/
}
/**
@@ -582,7 +580,7 @@ async function resolveNlsConfiguration() {
nlsConfiguration = { locale: 'en', availableLanguages: {} };
} else {
// See above the comment about the loader and case sensitiviness
// See above the comment about the loader and case sensitiveness
appLocale = appLocale.toLowerCase();
const { getNLSConfiguration } = require('./vs/base/node/languagePacks');
@@ -15,7 +15,6 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { Button, IButtonStyles } from 'sql/base/browser/ui/button/button';
import { onUnexpectedError } from 'vs/base/common/errors';
export interface IDropdownStyles {
backgroundColor?: Color;
@@ -43,14 +42,14 @@ export class DropdownList extends Dropdown {
this.button = new Button(_contentContainer);
this.button.label = action.label;
this._register(DOM.addDisposableListener(this.button.element, DOM.EventType.CLICK, () => {
action.run().catch(e => onUnexpectedError(e));
action.run();
this.hide();
}));
this._register(DOM.addDisposableListener(this.button.element, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Enter)) {
e.stopPropagation();
action.run().catch(e => onUnexpectedError(e));
action.run();
this.hide();
}
}));
@@ -11,10 +11,10 @@ import { Scrollable, ScrollbarVisibility, INewScrollDimensions, ScrollEvent } fr
import { getOrDefault } from 'vs/base/common/objects';
import * as DOM from 'vs/base/browser/dom';
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
import { domEvent } from 'vs/base/browser/event';
import { Event } from 'vs/base/common/event';
import { Range, IRange } from 'vs/base/common/range';
import { clamp } from 'vs/base/common/numbers';
import { DomEmitter } from 'vs/base/browser/event';
export interface IScrollableViewOptions {
useShadows?: boolean;
@@ -89,8 +89,8 @@ export class ScrollableView extends Disposable {
// Prevent the monaco-scrollable-element from scrolling
// https://github.com/Microsoft/vscode/issues/44181
this._register(domEvent(this.scrollableElement.getDomNode(), 'scroll')
(e => (e.target as HTMLElement).scrollTop = 0));
this._register(new DomEmitter(this.scrollableElement.getDomNode(), 'scroll')).event
(e => (e.target as HTMLElement).scrollTop = 0);
}
elementTop(index: number): number {
@@ -10,7 +10,6 @@ import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElemen
import { Event } from 'vs/base/common/event';
import { ScrollEvent, ScrollbarVisibility, INewScrollDimensions } from 'vs/base/common/scrollable';
import * as DOM from 'vs/base/browser/dom';
import { domEvent } from 'vs/base/browser/event';
import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async';
import { isWindows } from 'vs/base/common/platform';
import * as browser from 'vs/base/browser/browser';
@@ -22,6 +21,7 @@ import { Sash, Orientation, ISashEvent as IBaseSashEvent } from 'vs/base/browser
import { CellCache, ICell } from 'sql/base/browser/ui/table/highPerf/cellCache';
import { ITableRenderer, ITableDataSource, ITableMouseEvent, IStaticTableRenderer, ITableColumn } from 'sql/base/browser/ui/table/highPerf/table';
import { GridPosition } from 'sql/base/common/gridPosition';
import { DomEmitter, DOMEventMap, EventHandler } from 'vs/base/browser/event';
export interface IAriaSetProvider<T> {
getSetSize(element: T, index: number, listLength: number): number;
@@ -212,8 +212,9 @@ export class TableView<T> implements IDisposable {
// Prevent the monaco-scrollable-element from scrolling
// https://github.com/Microsoft/vscode/issues/44181
domEvent(this.scrollableElement.getDomNode(), 'scroll')
(e => (e.target as HTMLElement).scrollTop = 0, null, this.disposables);
const scrollEmitter = new DomEmitter(this.scrollableElement.getDomNode(), 'scroll');
this.disposables.push(scrollEmitter);
scrollEmitter.event(e => (e.target as HTMLElement).scrollTop = 0, null, this.disposables);
this.updateScrollWidth();
this.layout();
@@ -635,15 +636,37 @@ export class TableView<T> implements IDisposable {
delete this.visibleRows[index];
}
@memoize get onMouseClick(): Event<ITableMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'click'), e => this.toMouseEvent(e)); }
@memoize get onMouseDblClick(): Event<ITableMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'dblclick'), e => this.toMouseEvent(e)); }
@memoize get onMouseMiddleClick(): Event<ITableMouseEvent<T>> { return Event.filter(Event.map(domEvent(this.domNode, 'auxclick'), e => this.toMouseEvent(e as MouseEvent)), e => e.browserEvent.button === 1); }
@memoize get onMouseUp(): Event<ITableMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'mouseup'), e => this.toMouseEvent(e)); }
@memoize get onMouseDown(): Event<ITableMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'mousedown'), e => this.toMouseEvent(e)); }
@memoize get onMouseOver(): Event<ITableMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'mouseover'), e => this.toMouseEvent(e)); }
@memoize get onMouseMove(): Event<ITableMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'mousemove'), e => this.toMouseEvent(e)); }
@memoize get onMouseOut(): Event<ITableMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'mouseout'), e => this.toMouseEvent(e)); }
@memoize get onContextMenu(): Event<ITableMouseEvent<T>> { return Event.map(domEvent(this.domNode, 'contextmenu'), e => this.toMouseEvent(e)); }
@memoize get onMouseClick(): Event<ITableMouseEvent<T>> { return Event.map(this.createAndRegisterDomEmitter(this.domNode, 'click').event, e => this.toMouseEvent(e)); }
@memoize get onMouseDblClick(): Event<ITableMouseEvent<T>> {
return Event.map(this.createAndRegisterDomEmitter(this.domNode, 'dblclick').event, e => this.toMouseEvent(e));
}
@memoize get onMouseMiddleClick(): Event<ITableMouseEvent<T>> {
return Event.filter(Event.map(this.createAndRegisterDomEmitter(this.domNode, 'auxclick').event, e => this.toMouseEvent(e as MouseEvent)), e => e.browserEvent.button === 1);
}
@memoize get onMouseUp(): Event<ITableMouseEvent<T>> {
return Event.map(this.createAndRegisterDomEmitter(this.domNode, 'mouseup').event, e => this.toMouseEvent(e));
}
@memoize get onMouseDown(): Event<ITableMouseEvent<T>> {
return Event.map(this.createAndRegisterDomEmitter(this.domNode, 'mousedown').event, e => this.toMouseEvent(e));
}
@memoize get onMouseOver(): Event<ITableMouseEvent<T>> {
return Event.map(this.createAndRegisterDomEmitter(this.domNode, 'mouseover').event, e => this.toMouseEvent(e));
}
@memoize get onMouseMove(): Event<ITableMouseEvent<T>> {
return Event.map(this.createAndRegisterDomEmitter(this.domNode, 'mousemove').event, e => this.toMouseEvent(e));
}
@memoize get onMouseOut(): Event<ITableMouseEvent<T>> {
return Event.map(this.createAndRegisterDomEmitter(this.domNode, 'mouseout').event, e => this.toMouseEvent(e));
}
@memoize get onContextMenu(): Event<ITableMouseEvent<T>> {
return Event.map(this.createAndRegisterDomEmitter(this.domNode, 'contextmenu').event, e => this.toMouseEvent(e));
}
private createAndRegisterDomEmitter<K extends keyof DOMEventMap>(eventHandler: EventHandler, type: K): DomEmitter<K> {
const emitter = new DomEmitter(eventHandler, type);
this.disposables.push(emitter);
return emitter;
}
public toMouseEvent(browserEvent: MouseEvent): ITableMouseEvent<T> {
const index = this.getItemIndexFromEventTarget(browserEvent.target || null);
@@ -12,7 +12,7 @@ import * as DOM from 'vs/base/browser/dom';
import { TableView, ITableViewOptions } from 'sql/base/browser/ui/table/highPerf/tableView';
import { ScrollEvent } from 'vs/base/common/scrollable';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { domEvent } from 'vs/base/browser/event';
import { DomEmitter } from 'vs/base/browser/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import * as platform from 'vs/base/common/platform';
import { IListStyles, IStyleController } from 'vs/base/browser/ui/list/listWidget';
@@ -92,9 +92,9 @@ class DOMFocusController<T> implements IDisposable {
private list: Table<T>,
private view: TableView<T>
) {
this.disposables = [];
const onKeyDown = Event.chain(domEvent(view.domNode, 'keydown'))
const emitter = new DomEmitter(view.domNode, 'keydown');
this.disposables.push(emitter);
const onKeyDown = Event.chain(emitter.event)
.map(e => new StandardKeyboardEvent(e));
onKeyDown.filter(e => e.keyCode === KeyCode.Tab && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey)
@@ -323,7 +323,7 @@ function rowCountFilter(column: ITableColumn<any, any>): boolean {
class KeyboardController<T> implements IDisposable {
private disposables: IDisposable[];
private disposables: IDisposable[] = [];
// private openController: IOpenController;
constructor(
@@ -332,11 +332,11 @@ class KeyboardController<T> implements IDisposable {
options?: ITableOptions<T>
) {
// const multipleSelectionSupport = !(options.multipleSelectionSupport === false);
this.disposables = [];
// this.openController = options.openController || DefaultOpenController;
const onKeyDown = Event.chain(domEvent(view.domNode, 'keydown'))
const emitter = new DomEmitter(view.domNode, 'keydown');
this.disposables.push(emitter);
const onKeyDown = Event.chain(emitter.event)
// .filter(e => !isInputElement(e.target as HTMLElement))
.map(e => new StandardKeyboardEvent(e));
@@ -732,13 +732,13 @@ export class Table<T> implements IDisposable {
private didJustPressContextMenuKey: boolean = false;
@memoize get onContextMenu(): Event<ITableContextMenuEvent<T>> {
const fromKeydown = Event.chain(domEvent(this.view.domNode, 'keydown'))
const fromKeydown = Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, 'keydown')).event)
.map(e => new StandardKeyboardEvent(e))
.filter(e => this.didJustPressContextMenuKey = e.keyCode === KeyCode.ContextMenu || (e.shiftKey && e.keyCode === KeyCode.F10))
.filter(e => { e.preventDefault(); e.stopPropagation(); return false; })
.event as Event<any>;
const fromKeyup = Event.chain(domEvent(this.view.domNode, 'keyup'))
const fromKeyup = Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, 'keyup')).event)
.filter(() => {
const didJustPressContextMenuKey = this.didJustPressContextMenuKey;
this.didJustPressContextMenuKey = false;
@@ -761,9 +761,9 @@ export class Table<T> implements IDisposable {
return Event.any<ITableContextMenuEvent<T>>(fromKeydown, fromKeyup, fromMouse);
}
get onKeyDown(): Event<KeyboardEvent> { return domEvent(this.view.domNode, 'keydown'); }
get onKeyUp(): Event<KeyboardEvent> { return domEvent(this.view.domNode, 'keyup'); }
get onKeyPress(): Event<KeyboardEvent> { return domEvent(this.view.domNode, 'keypress'); }
get onKeyDown(): Event<KeyboardEvent> { return this.disposables.add(new DomEmitter(this.view.domNode, 'keydown')).event; }
get onKeyUp(): Event<KeyboardEvent> { return this.disposables.add(new DomEmitter(this.view.domNode, 'keyup')).event; }
get onKeyPress(): Event<KeyboardEvent> { return this.disposables.add(new DomEmitter(this.view.domNode, 'keypress')).event; }
readonly onDidFocus: Event<void>;
readonly onDidBlur: Event<void>;
@@ -809,8 +809,8 @@ export class Table<T> implements IDisposable {
this.disposables.add(controller);
}
this.onDidFocus = Event.map(domEvent(this.view.domNode, 'focus', true), () => null!);
this.onDidBlur = Event.map(domEvent(this.view.domNode, 'blur', true), () => null!);
this.onDidFocus = Event.map(this.disposables.add(new DomEmitter(this.view.domNode, 'focus', true)).event, () => null!);
this.onDidBlur = Event.map(this.disposables.add(new DomEmitter(this.view.domNode, 'blur', true)).event, () => null!);
this.disposables.add(this.createMouseController());
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
import { getCodeForKeyCode } from 'vs/base/browser/keyboardEvent';
+2 -2
View File
@@ -373,8 +373,8 @@ export class ActionBar extends ActionRunner implements IActionRunner {
//this.emit('cancel');
}
public override run(action: IAction, context?: any): Promise<any> {
return this._actionRunner.run(action, context);
public override async run(action: IAction, context?: any): Promise<void> {
this._actionRunner.run(action, context);
}
public override dispose(): void {
@@ -349,9 +349,9 @@ export class OverflowActionBar extends ActionBar {
}
}
public override run(action: IAction, context?: any): Promise<any> {
public override async run(action: IAction, context?: any): Promise<void> {
this.hideOverflowDisplay();
return this._actionRunner.run(action, context);
this._actionRunner.run(action, context);
}
public get actionsList(): HTMLElement {
+1 -1
View File
@@ -39,7 +39,7 @@ export const fileActionsContributionNewQuery = localize('newQuery', "New Query")
export const fileActionsContributionMiNewQuery = localize({ key: 'miNewQuery', comment: ['&& denotes a mnemonic'] }, "New &&Query");
export const fileActionsContributionMiNewNotebook = localize({ key: 'miNewNotebook', comment: ['&& denotes a mnemonic'] }, "&&New Notebook");
export const filesContributionMaxMemoryForLargeFilesMB = localize('maxMemoryForLargeFilesMB', "Controls the memory available to Azure Data Studio after restart when trying to open large files. Same effect as specifying `--max-memory=NEWSIZE` on the command line.");
export const watcherExclude = localize('sql.watcherExclude', "Configure glob patterns of file paths to exclude from file watching. Patterns must match on absolute paths (i.e. prefix with ** or the full path to match properly). Changing this setting requires a restart. When you experience Azure Data Studio consuming lots of CPU time on startup, you can exclude large folders to reduce the initial load.");
export const watcherExclude = localize('sql.watcherExclude', "Configure glob patterns of file paths to exclude from file watching. Patterns must match on absolute paths, i.e. prefix with `**/` or the full path to match properly and suffix with `/**` to match files within a path (for example `**/build/output/**` or `/Users/name/workspaces/project/build/output/**`). Changing this setting requires a restart. When you experience Azure Data Studio consuming lots of CPU time on startup, you can exclude large folders to reduce the initial load.");
export function localizationsContributionUpdateLocale(locale: string): string { return localize('updateLocale', "Would you like to change Azure Data Studio's UI language to {0} and restart?", locale); }
export function localizationsContributionActivateLanguagePack(locale: string): string { return localize('activateLanguagePack', "In order to use Azure Data Studio in {0}, Azure Data Studio needs to restart.", locale); }
export const watermarkNewSqlFile = localize('watermark.newSqlFile', "New SQL File");
@@ -11,6 +11,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { MenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
const ids = new IdGenerator('menu-item-action-item-icon-');
@@ -26,11 +27,12 @@ export class LabeledMenuItemActionItem extends MenuEntryActionViewItem {
constructor(
_action: MenuItemAction,
private readonly _defaultCSSClassToAdd: string | undefined,
@IKeybindingService labeledkeybindingService: IKeybindingService,
@INotificationService _notificationService: INotificationService,
private readonly _defaultCSSClassToAdd: string = ''
@IContextKeyService _contextKeyService: IContextKeyService,
) {
super(_action, labeledkeybindingService, _notificationService);
super(_action, undefined, labeledkeybindingService, _notificationService, _contextKeyService);
}
override updateLabel(): void {
@@ -98,12 +100,12 @@ export class MaskedLabeledMenuItemActionItem extends MenuEntryActionViewItem {
private _labeledItemClassDispose?: IDisposable;
constructor(
_action: MenuItemAction,
@IKeybindingService labeledkeybindingService: IKeybindingService,
@INotificationService _notificationService: INotificationService,
private readonly _defaultCSSClassToAdd: string = ''
action: MenuItemAction,
@IKeybindingService keybindingService: IKeybindingService,
@INotificationService notificationService: INotificationService,
@IContextKeyService contextKeyService: IContextKeyService
) {
super(_action, labeledkeybindingService, _notificationService);
super(action, undefined, keybindingService, notificationService, contextKeyService);
}
override updateLabel(): void {
@@ -138,9 +140,6 @@ export class MaskedLabeledMenuItemActionItem extends MenuEntryActionViewItem {
if (this.label) {
const iconClasses = iconClass.split(' ');
if (this._defaultCSSClassToAdd) {
iconClasses.push(this._defaultCSSClassToAdd);
}
this.label.classList.add('codicon', ...iconClasses);
this.label.classList.add('masked-icon', ...iconClasses);
this._labeledItemClassDispose = toDisposable(() => {
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Action } from 'vs/base/common/actions';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { FocusedViewContext, IViewDescriptorService, IViewsService, ViewContainerLocation } from 'vs/workbench/common/views';
@@ -14,14 +14,14 @@ import * as azdata from 'azdata';
import { TitledComponent } from 'sql/workbench/browser/modelComponents/titledComponent';
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
import { registerThemingParticipant, IColorTheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
import { textLinkForeground, textLinkActiveForeground, focusBorder } from 'vs/platform/theme/common/colorRegistry';
import { textLinkForeground, textLinkActiveForeground } from 'vs/platform/theme/common/colorRegistry';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import * as DOM from 'vs/base/browser/dom';
import { ILogService } from 'vs/platform/log/common/log';
import { domEvent } from 'vs/base/browser/event';
import { Event } from 'vs/base/common/event';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { DomEmitter } from 'vs/base/browser/event';
@Component({
selector: 'modelview-hyperlink',
@@ -41,12 +41,13 @@ export default class HyperlinkComponent extends TitledComponent<azdata.Hyperlink
}
ngAfterViewInit(): void {
const onClick = domEvent(this._el.nativeElement, 'click');
const onEnter = Event.chain(domEvent(this._el.nativeElement, 'keydown'))
const onClick = this._register(new DomEmitter(this._el.nativeElement, 'click'));
const keydown = this._register(new DomEmitter(this._el.nativeElement, 'keydown'));
const onEnter = Event.chain(keydown.event)
.map(e => new StandardKeyboardEvent(e))
.filter(e => e.keyCode === KeyCode.Enter)
.event;
const onOpen = Event.any<DOM.EventLike>(onClick, onEnter);
const onOpen = Event.any<DOM.EventLike>(onClick.event, onEnter);
this._register(onOpen(e => {
this.open(e);
@@ -121,13 +122,4 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
}
`);
}
const outlineColor = theme.getColor(focusBorder);
if (outlineColor) {
collector.addRule(`
modelview-hyperlink a {
outline-color: ${outlineColor};
}
`);
}
});
@@ -9,9 +9,3 @@ modelview-hyperlink .link-with-icon::after {
margin-left: 5px;
vertical-align: bottom;
}
modelview-hyperlink a:focus {
outline-width: 1px;
outline-style: solid;
outline-offset: 1px;
}
@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ModelViewInput } from 'sql/workbench/browser/modelComponents/modelViewInput';
@@ -11,11 +11,11 @@ import { ModelViewEditor } from 'sql/workbench/browser/modelComponents/modelView
import { EditorExtensions } from 'vs/workbench/common/editor';
// Model View editor registration
const viewModelEditorDescriptor = EditorDescriptor.create(
const viewModelEditorDescriptor = EditorPaneDescriptor.create(
ModelViewEditor,
ModelViewEditor.ID,
'ViewModel'
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(viewModelEditorDescriptor, [new SyncDescriptor(ModelViewInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(viewModelEditorDescriptor, [new SyncDescriptor(ModelViewInput)]);
@@ -63,7 +63,7 @@ export class TreeViewDataProvider extends vsTreeView.TreeViewDataProvider implem
* @override
* @param elements The elements to map
*/
protected override async postGetChildren(elements: ITreeComponentItem[]): Promise<ResolvableTreeComponentItem[]> {
protected override async postGetChildren(elements: ResolvableTreeItem[] | undefined): Promise<ResolvableTreeComponentItem[]> {
const result: ResolvableTreeComponentItem[] = [];
const hasResolve = await this.hasResolve;
if (elements) {
@@ -44,7 +44,6 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { TaskRegistry } from 'sql/workbench/services/tasks/browser/tasksRegistry';
import { MenuRegistry, IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
import { fillInActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { NAV_SECTION } from 'sql/workbench/contrib/dashboard/browser/containers/dashboardNavSection.contribution';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { EDITOR_PANE_BACKGROUND } from 'vs/workbench/common/theme';
@@ -54,6 +53,7 @@ import { focusBorder } from 'vs/platform/theme/common/colorRegistry';
import { LabeledMenuItemActionItem } from 'sql/platform/actions/browser/menuEntryActionViewItem';
import { DASHBOARD_BORDER, TOOLBAR_OVERFLOW_SHADOW } from 'sql/workbench/common/theme';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
const dashboardRegistry = Registry.as<IDashboardRegistry>(DashboardExtensions.DashboardContributions);
const homeTabGroupId = 'home';
@@ -125,8 +125,8 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
@Inject(ICommandService) private commandService: ICommandService,
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
@Inject(IMenuService) private menuService: IMenuService,
@Inject(IKeybindingService) private keybindingService: IKeybindingService,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(IInstantiationService) private instantiationService: IInstantiationService
) {
super();
this._tabName = DashboardPage.tabName.bindTo(contextKeyService);
@@ -278,7 +278,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
private createActionItemProvider(action: Action): IActionViewItem {
// Create ActionItem for actions contributed by extensions
if (action instanceof MenuItemAction) {
return new LabeledMenuItemActionItem(action, this.keybindingService, this.notificationService);
return this.instantiationService.createInstance(LabeledMenuItemActionItem, action, undefined);
}
return undefined;
}
@@ -7,7 +7,7 @@ import { DashboardEditor } from 'sql/workbench/contrib/dashboard/browser/dashboa
import { DashboardInput } from 'sql/workbench/browser/editor/profiler/dashboardInput';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { EditorExtensions } from 'vs/workbench/common/editor';
import { Registry } from 'vs/platform/registry/common/platform';
import { localize } from 'vs/nls';
@@ -58,11 +58,11 @@ MenuRegistry.appendMenuItem(MenuId.ObjectExplorerItemContext, {
when: ContextKeyExpr.or(ContextKeyExpr.and(TreeNodeContextKey.Status.notEqualsTo('Unavailable'), TreeNodeContextKey.NodeType.isEqualTo('Server')), ContextKeyExpr.and(TreeNodeContextKey.Status.notEqualsTo('Unavailable'), TreeNodeContextKey.NodeType.isEqualTo('Database')))
});
const dashboardEditorDescriptor = EditorDescriptor.create(
const dashboardEditorDescriptor = EditorPaneDescriptor.create(
DashboardEditor,
DashboardEditor.ID,
localize('dashboard.editor.label', "Dashboard")
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(dashboardEditorDescriptor, [new SyncDescriptor(DashboardInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(dashboardEditorDescriptor, [new SyncDescriptor(DashboardInput)]);
@@ -20,8 +20,8 @@ import { ILogService } from 'vs/platform/log/common/log';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IMenuService } from 'vs/platform/actions/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
export class DatabaseDashboardPage extends DashboardPage implements OnInit {
protected propertiesWidget: WidgetConfig = {
@@ -51,10 +51,10 @@ export class DatabaseDashboardPage extends DashboardPage implements OnInit {
@Inject(ICommandService) commandService: ICommandService,
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
@Inject(IMenuService) menuService: IMenuService,
@Inject(IKeybindingService) keybindingService: IKeybindingService,
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService,
@Inject(IInstantiationService) instantiationService: IInstantiationService
) {
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, keybindingService, themeService);
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, themeService, instantiationService);
this._register(dashboardService.onUpdatePage(() => {
this.refresh(true);
this._cd.detectChanges();
@@ -21,10 +21,9 @@ import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IMenuService } from 'vs/platform/actions/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
export class ServerDashboardPage extends DashboardPage implements OnInit {
protected propertiesWidget: WidgetConfig = {
@@ -55,11 +54,10 @@ export class ServerDashboardPage extends DashboardPage implements OnInit {
@Inject(ICommandService) commandService: ICommandService,
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
@Inject(IMenuService) menuService: IMenuService,
@Inject(IKeybindingService) keybindingService: IKeybindingService,
@Inject(IContextMenuService) contextMenuService: IContextMenuService,
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService,
@Inject(IInstantiationService) instantiationService: IInstantiationService
) {
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, keybindingService, themeService);
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, themeService, instantiationService);
// special-case handling for MSSQL data provider
const connInfo = this.dashboardService.connectionManagementService.connectionInfo;
@@ -8,7 +8,7 @@ import { EditDataInput } from 'sql/workbench/browser/editData/editDataInput';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { EditDataResultsEditor } from 'sql/workbench/contrib/editData/browser/editDataResultsEditor';
import { EditDataResultsInput } from 'sql/workbench/browser/editData/editDataResultsInput';
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { EditorExtensions } from 'vs/workbench/common/editor';
import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -18,7 +18,7 @@ import * as editDataActions from 'sql/workbench/contrib/editData/browser/editDat
import * as nls from 'vs/nls';
// Editor
const editDataEditorDescriptor = EditorDescriptor.create(
const editDataEditorDescriptor = EditorPaneDescriptor.create(
EditDataEditor,
EditDataEditor.ID,
'EditData'
@@ -38,18 +38,18 @@ configurationRegistry.registerConfiguration({
}
});
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(editDataEditorDescriptor, [new SyncDescriptor(EditDataInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(editDataEditorDescriptor, [new SyncDescriptor(EditDataInput)]);
// Editor
const editDataResultsEditorDescriptor = EditorDescriptor.create(
const editDataResultsEditorDescriptor = EditorPaneDescriptor.create(
EditDataResultsEditor,
EditDataResultsEditor.ID,
'EditDataResults'
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(editDataResultsEditorDescriptor, [new SyncDescriptor(EditDataResultsInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(editDataResultsEditorDescriptor, [new SyncDescriptor(EditDataResultsInput)]);
// Keybinding for toggling the query pane
KeybindingsRegistry.registerCommandAndKeybindingRule({
@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Action, IActionRunner } from 'vs/base/common/actions';
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
import { Disposable } from 'vs/base/common/lifecycle';
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
@@ -157,6 +157,7 @@ export class ChangeMaxRowsActionItem extends Disposable implements IActionViewIt
constructor(
private _editor: EditDataEditor,
public action: IAction,
@IContextViewService contextViewService: IContextViewService,
@IThemeService private _themeService: IThemeService) {
super();
@@ -371,7 +371,7 @@ export class EditDataEditor extends EditorPane {
let actionID = ChangeMaxRowsAction.ID;
if (action.id === actionID) {
if (!this._changeMaxRowsActionItem) {
this._changeMaxRowsActionItem = this._instantiationService.createInstance(ChangeMaxRowsActionItem, this);
this._changeMaxRowsActionItem = this._instantiationService.createInstance(ChangeMaxRowsActionItem, this, action);
}
return this._changeMaxRowsActionItem;
}
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewPaneContainer } from 'vs/workbench/contrib/extensions/common/extensions';
import { IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IExtensionRecommendation } from 'sql/workbench/services/extensionManagement/common/extensionManagement';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { URI } from 'vs/base/common/uri';
import { CancellationToken } from 'vs/base/common/cancellation';
@@ -9,7 +9,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { localize } from 'vs/nls';
import { IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IExtensionRecommendation } from 'sql/workbench/services/extensionManagement/common/extensionManagement';
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { visualizerExtensions } from 'sql/workbench/contrib/extensions/common/constants';
@@ -106,6 +106,7 @@ export class CellToolbarComponent {
);
}
taskbarContent.push(
{ action: splitCellButton },
{ element: addCellDropdownContainer },
{ action: moveCellDownButton },
{ action: moveCellUpButton },
@@ -10,10 +10,9 @@ import { Event, Emitter } from 'vs/base/common/event';
import * as types from 'vs/base/common/types';
import { NotebookFindMatch, NotebookFindDecorations } from 'sql/workbench/contrib/notebook/browser/find/notebookFindDecorations';
import * as model from 'vs/editor/common/model';
import { ModelDecorationOptions, DidChangeDecorationsEmitter, createTextBuffer } from 'vs/editor/common/model/textModel';
import { ModelDecorationOptions, DidChangeDecorationsEmitter, createTextBuffer, TextModel } from 'vs/editor/common/model/textModel';
import { IModelDecorationsChangedEvent } from 'vs/editor/common/model/textModelEvents';
import { IntervalNode } from 'vs/editor/common/model/intervalTree';
import { EDITOR_MODEL_DEFAULTS } from 'vs/editor/common/config/editorOptions';
import { Range, IRange } from 'vs/editor/common/core/range';
import { onUnexpectedError } from 'vs/base/common/errors';
import { singleLetterHash, isHighSurrogate } from 'vs/base/common/strings';
@@ -55,7 +54,7 @@ export class NotebookFindModel extends Disposable implements INotebookFindModel
public findExpression: string;
//#region Decorations
private readonly _onDidChangeDecorations: DidChangeDecorationsEmitter = this._register(new DidChangeDecorationsEmitter());
private readonly _onDidChangeDecorations: DidChangeDecorationsEmitter = this._register(new DidChangeDecorationsEmitter(affectedInjectedTextLines => { } /* this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines) */)); // Do we need this event?
public readonly onDidChangeDecorations: Event<IModelDecorationsChangedEvent> = this._onDidChangeDecorations.event;
private _decorations: { [decorationId: string]: NotebookIntervalNode; };
//#endregion
@@ -72,7 +71,7 @@ export class NotebookFindModel extends Disposable implements INotebookFindModel
this._decorations = Object.create(null);
const { textBuffer, } = createTextBuffer('', NotebookFindModel.DEFAULT_CREATION_OPTIONS.defaultEOL);
const { textBuffer, } = createTextBuffer('', TextModel.DEFAULT_CREATION_OPTIONS.defaultEOL);
this._buffer = textBuffer;
this._versionId = 1;
this.id = '$model' + MODEL_ID;
@@ -100,17 +99,6 @@ export class NotebookFindModel extends Disposable implements INotebookFindModel
this.clearFind();
}
public static DEFAULT_CREATION_OPTIONS: model.ITextModelCreationOptions = {
isForSimpleWidget: false,
tabSize: EDITOR_MODEL_DEFAULTS.tabSize,
indentSize: EDITOR_MODEL_DEFAULTS.indentSize,
insertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,
detectIndentation: false,
defaultEOL: model.DefaultEndOfLine.LF,
trimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
largeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,
};
public get onFindCountChange(): Event<number> { return this._onFindCountChange.event; }
public get VersionId(): number {
@@ -289,7 +277,7 @@ export class NotebookFindModel extends Disposable implements INotebookFindModel
*/
private _validateRangeRelaxedNoAllocations(range: IRange): NotebookRange {
if (range instanceof NotebookRange) {
const { textBuffer, } = createTextBuffer(range.cell.source instanceof Array ? range.cell.source.join('\n') : range.cell.source, NotebookFindModel.DEFAULT_CREATION_OPTIONS.defaultEOL);
const { textBuffer, } = createTextBuffer(range.cell.source instanceof Array ? range.cell.source.join('\n') : range.cell.source, TextModel.DEFAULT_CREATION_OPTIONS.defaultEOL);
this._buffer = textBuffer;
}
@@ -24,8 +24,8 @@ export class DiffNotebookInput extends SideBySideEditorInput {
@INotebookService notebookService: INotebookService,
@ILogService logService: ILogService
) {
let originalInput = instantiationService.createInstance(FileNotebookInput, diffInput.primary.getName(), diffInput.primary.resource, diffInput.originalInput as FileEditorInput, false);
let modifiedInput = instantiationService.createInstance(FileNotebookInput, diffInput.secondary.getName(), diffInput.secondary.resource, diffInput.modifiedInput as FileEditorInput, false);
let originalInput = instantiationService.createInstance(FileNotebookInput, diffInput.primary.getName(), diffInput.primary.resource, diffInput.original as FileEditorInput, false);
let modifiedInput = instantiationService.createInstance(FileNotebookInput, diffInput.secondary.getName(), diffInput.secondary.resource, diffInput.modified as FileEditorInput, false);
super(title, diffInput.getTitle(), modifiedInput, originalInput);
this._notebookService = notebookService;
this._logService = logService;
@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IEditorInputFactoryRegistry, IEditorInput, IEditorInputSerializer, EditorExtensions } from 'vs/workbench/common/editor';
import { IEditorFactoryRegistry, IEditorInput, IEditorSerializer, EditorExtensions } from 'vs/workbench/common/editor';
import { Registry } from 'vs/platform/registry/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { FILE_EDITOR_INPUT_ID } from 'vs/workbench/contrib/files/common/files';
@@ -18,9 +18,9 @@ import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { DiffNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/diffNotebookInput';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const editorInputFactoryRegistry = Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories);
const editorFactoryRegistry = Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory);
export class NotebookEditorInputAssociation implements ILanguageAssociation {
export class NotebookEditorLanguageAssociation implements ILanguageAssociation {
/**
* The language IDs that are associated with Notebooks. These are case sensitive for comparing with what's
* registered in the ModeService registry.
@@ -53,9 +53,9 @@ export class NotebookEditorInputAssociation implements ILanguageAssociation {
}
}
export class FileNoteBookEditorInputSerializer implements IEditorInputSerializer {
export class FileNoteBookEditorSerializer implements IEditorSerializer {
serialize(editorInput: FileNotebookInput): string {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
if (factory) {
return factory.serialize(editorInput.textInput); // serialize based on the underlying input
}
@@ -63,7 +63,7 @@ export class FileNoteBookEditorInputSerializer implements IEditorInputSerializer
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileNotebookInput | undefined {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
return instantiationService.createInstance(FileNotebookInput, fileEditorInput.getName(), fileEditorInput.resource, fileEditorInput, true);
}
@@ -73,9 +73,9 @@ export class FileNoteBookEditorInputSerializer implements IEditorInputSerializer
}
}
export class UntitledNotebookEditorInputSerializer implements IEditorInputSerializer {
export class UntitledNotebookEditorSerializer implements IEditorSerializer {
serialize(editorInput: UntitledNotebookInput): string {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
if (factory) {
return factory.serialize(editorInput.textInput); // serialize based on the underlying input
}
@@ -83,7 +83,7 @@ export class UntitledNotebookEditorInputSerializer implements IEditorInputSerial
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledNotebookInput | undefined {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
return instantiationService.createInstance(UntitledNotebookInput, untitledEditorInput.getName(), untitledEditorInput.resource, untitledEditorInput);
}
@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IRevertOptions, GroupIdentifier, IEditorInput, EditorInputCapabilities } from 'vs/workbench/common/editor';
import { IRevertOptions, GroupIdentifier, IEditorInput, EditorInputCapabilities, IUntypedEditorInput } from 'vs/workbench/common/editor';
import { Emitter, Event } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import * as resources from 'vs/base/common/resources';
@@ -513,7 +513,7 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
return this._model.updateModel();
}
public override matches(otherInput: any): boolean {
public override matches(otherInput: IEditorInput | IUntypedEditorInput): boolean {
if (otherInput instanceof NotebookInput) {
return this.textInput.matches(otherInput.textInput);
} else {
@@ -17,7 +17,6 @@ import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { MenuId, IMenuService, MenuItemAction } from 'vs/platform/actions/common/actions';
import { IAction, Action, SubmenuAction } from 'vs/base/common/actions';
import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import * as DOM from 'vs/base/browser/dom';
import { AngularDisposable } from 'sql/base/browser/lifecycle';
@@ -104,7 +103,6 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
@Inject(IConnectionDialogService) private connectionDialogService: IConnectionDialogService,
@Inject(IContextKeyService) private contextKeyService: IContextKeyService,
@Inject(IMenuService) private menuService: IMenuService,
@Inject(IKeybindingService) private keybindingService: IKeybindingService,
@Inject(ICapabilitiesService) private capabilitiesService: ICapabilitiesService,
@Inject(ITextFileService) private textFileService: ITextFileService,
@Inject(ILogService) private readonly logService: ILogService,
@@ -624,7 +622,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
action.tooltip = action.label;
action.label = '';
}
return new MaskedLabeledMenuItemActionItem(action, this.keybindingService, this.notificationService);
return this.instantiationService.createInstance(MaskedLabeledMenuItemActionItem, action);
}
return undefined;
}
@@ -3,16 +3,16 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { localize } from 'vs/nls';
import { IEditorInputFactoryRegistry, ActiveEditorContext, IEditorInput, EditorExtensions } from 'vs/workbench/common/editor';
import { IEditorFactoryRegistry, ActiveEditorContext, IEditorInput, EditorExtensions } from 'vs/workbench/common/editor';
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
import { UntitledNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/untitledNotebookInput';
import { FileNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/fileNotebookInput';
import { FileNoteBookEditorInputSerializer, NotebookEditorInputAssociation, UntitledNotebookEditorInputSerializer } from 'sql/workbench/contrib/notebook/browser/models/notebookInputFactory';
import { FileNoteBookEditorSerializer, NotebookEditorLanguageAssociation, UntitledNotebookEditorSerializer } from 'sql/workbench/contrib/notebook/browser/models/notebookEditorFactory';
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionsExtensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor, registerAction2, MenuRegistry, MenuId, Action2 } from 'vs/platform/actions/common/actions';
@@ -56,7 +56,7 @@ import { INotebookModel } from 'sql/workbench/services/notebook/browser/models/m
import { DEFAULT_NOTEBOOK_FILETYPE, IExecuteManager, SQL_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/browser/notebookService';
import { NotebookExplorerViewletViewsContribution } from 'sql/workbench/contrib/notebook/browser/notebookExplorer/notebookExplorerViewlet';
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { ContributedEditorPriority, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
import { IEditorResolverService, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService';
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILogService } from 'vs/platform/log/common/log';
@@ -65,17 +65,17 @@ import { useNewMarkdownRendererKey } from 'sql/workbench/contrib/notebook/common
import { JUPYTER_PROVIDER_ID, NotebookLanguage } from 'sql/workbench/common/constants';
import { INotebookProviderRegistry, NotebookProviderRegistryId } from 'sql/workbench/services/notebook/common/notebookRegistry';
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
.registerEditorInputSerializer(FileNotebookInput.ID, FileNoteBookEditorInputSerializer);
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
.registerEditorSerializer(FileNotebookInput.ID, FileNoteBookEditorSerializer);
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
.registerEditorInputSerializer(UntitledNotebookInput.ID, UntitledNotebookEditorInputSerializer);
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
.registerEditorSerializer(UntitledNotebookInput.ID, UntitledNotebookEditorSerializer);
Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.LanguageAssociations)
.registerLanguageAssociation(NotebookEditorInputAssociation.languages, NotebookEditorInputAssociation);
.registerLanguageAssociation(NotebookEditorLanguageAssociation.languages, NotebookEditorLanguageAssociation);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(EditorDescriptor.create(NotebookEditor, NotebookEditor.ID, NotebookEditor.LABEL), [new SyncDescriptor(UntitledNotebookInput), new SyncDescriptor(FileNotebookInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(EditorPaneDescriptor.create(NotebookEditor, NotebookEditor.ID, NotebookEditor.LABEL), [new SyncDescriptor(UntitledNotebookInput), new SyncDescriptor(FileNotebookInput)]);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(NotebookThemingContribution, LifecyclePhase.Restored);
@@ -701,7 +701,7 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
constructor(
@ILogService private _logService: ILogService,
@IEditorService private _editorService: IEditorService,
@IEditorOverrideService private _editorOverrideService: IEditorOverrideService,
@IEditorResolverService private _editorResolverService: IEditorResolverService,
@IModeService private _modeService: IModeService
) {
super();
@@ -726,7 +726,7 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
let allExtensions: string[] = [];
// List of built-in language IDs to associate the query editor for. These are case sensitive.
NotebookEditorInputAssociation.languages.forEach(lang => {
NotebookEditorLanguageAssociation.languages.forEach(lang => {
const langExtensions = this._modeService.getExtensions(lang);
allExtensions = allExtensions.concat(langExtensions);
});
@@ -737,37 +737,37 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
// Create the selector from the list of all the language extensions we want to associate with the
// notebook editor
const selector = `*{${allExtensions.join(',')}}`;
this._registeredOverrides.add(this._editorOverrideService.registerEditor(
this._registeredOverrides.add(this._editorResolverService.registerEditor(
selector,
{
id: NotebookEditor.ID,
label: NotebookEditor.LABEL,
describes: (currentEditor) => currentEditor instanceof FileNotebookInput,
priority: ContributedEditorPriority.builtin
priority: RegisteredEditorPriority.builtin
},
{},
(resource, options, group) => {
const fileInput = this._editorService.createEditorInput({
resource: resource
}) as FileEditorInput;
(editorInput, group) => {
const fileInput = this._editorService.createEditorInput(editorInput) as FileEditorInput;
// Try to convert the input, falling back to just a plain file input if we're unable to
const newInput = this.tryConvertInput(fileInput) ?? fileInput;
return { editor: newInput, options: options, group: group };
const newInput = this.convertInput(fileInput);
return { editor: newInput, options: editorInput.options, group: group };
},
(diffEditorInput, options, group) => {
undefined,
(diffEditorInput, group) => {
const diffEditorInputImpl = this._editorService.createEditorInput(diffEditorInput) as DiffEditorInput;
// Try to convert the input, falling back to the original input if we're unable to
const newInput = this.tryConvertInput(diffEditorInput) ?? diffEditorInput;
return { editor: newInput, options: options, group: group };
const newInput = this.convertInput(diffEditorInputImpl);
return { editor: newInput, options: diffEditorInput.options, group: group };
}
));
}
private tryConvertInput(input: IEditorInput): IEditorInput | undefined {
private convertInput(input: IEditorInput): IEditorInput {
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(NotebookLanguage.Ipynb);
const notebookEditorInput = langAssociation?.syncConvertInput?.(input);
if (!notebookEditorInput) {
this._logService.warn('Unable to create input for overriding editor ', input instanceof DiffEditorInput ? `${input.primary.resource.toString()} <-> ${input.secondary.resource.toString()}` : input.resource.toString());
return undefined;
// Fall back to original input if we failed to convert
this._logService.warn('Unable to create input for resolving editor ', input instanceof DiffEditorInput ? `${input.primary.resource.toString()} <-> ${input.secondary.resource.toString()}` : input.resource.toString());
return input;
}
return notebookEditorInput;
}
@@ -14,7 +14,6 @@ import { IBootstrapParams } from 'sql/workbench/services/bootstrap/common/bootst
import { Action } from 'vs/base/common/actions';
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
import { MenuItemAction } from 'vs/platform/actions/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { onUnexpectedError } from 'vs/base/common/errors';
@@ -71,7 +70,6 @@ export class NotebookViewComponent extends AngularDisposable implements INoteboo
@Inject(IBootstrapParams) private _notebookParams: INotebookParams,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(IInstantiationService) private _instantiationService: IInstantiationService,
@Inject(IKeybindingService) private _keybindingService: IKeybindingService,
@Inject(IContextMenuService) private _contextMenuService: IContextMenuService,
@Inject(INotificationService) private _notificationService: INotificationService,
@Inject(INotebookService) private _notebookService: INotebookService,
@@ -315,7 +313,7 @@ export class NotebookViewComponent extends AngularDisposable implements INoteboo
action.tooltip = action.label;
action.label = '';
}
return new LabeledMenuItemActionItem(action, this._keybindingService, this._notificationService, 'notebook-button fixed-width');
return this._instantiationService.createInstance(LabeledMenuItemActionItem, action, 'notebook-button fixed-width');
}
return undefined;
}
@@ -87,7 +87,7 @@ suite('MarkdownTextTransformer', () => {
assert(!isUndefinedOrNull(widget), 'widget is undefined');
// Create new text model
textModel = new TextModel('', { isForSimpleWidget: true, defaultEOL: DefaultEndOfLine.LF, detectIndentation: true, indentSize: 0, insertSpaces: false, largeFileOptimizations: false, tabSize: 4, trimAutoWhitespace: false }, null, undefined, undoRedoService);
textModel = new TextModel('', { isForSimpleWidget: true, defaultEOL: DefaultEndOfLine.LF, detectIndentation: true, indentSize: 0, insertSpaces: false, largeFileOptimizations: false, tabSize: 4, trimAutoWhitespace: false, bracketPairColorizationOptions: { enabled: true } }, null, undefined, undoRedoService);
// Couple widget with newly created text model
widget.setModel(textModel);
@@ -33,7 +33,7 @@ import { FindReplaceStateChangedEvent, INewFindReplaceState } from 'vs/editor/co
import { getRandomString } from 'vs/editor/test/common/model/linesTextBuffer/textBufferAutoTestUtils';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { ContextViewService } from 'vs/platform/contextview/browser/contextViewService';
import { DidInstallExtensionEvent, DidUninstallExtensionEvent, IExtensionManagementService, InstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
import { DidUninstallExtensionEvent, IExtensionManagementService, InstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import { IFileService } from 'vs/platform/files/common/files';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
@@ -672,7 +672,6 @@ async function findStateChangeSetup(instantiationService: TestInstantiationServi
function setupServices(arg: { workbenchThemeService?: WorkbenchThemeService, instantiationService?: TestInstantiationService } = {}) {
const installEvent: Emitter<InstallExtensionEvent> = new Emitter<InstallExtensionEvent>();
const didInstallEvent = new Emitter<DidInstallExtensionEvent>();
const uninstallEvent = new Emitter<IExtensionIdentifier>();
const didUninstallEvent = new Emitter<DidUninstallExtensionEvent>();
@@ -684,7 +683,6 @@ function setupServices(arg: { workbenchThemeService?: WorkbenchThemeService, ins
instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
instantiationService.stub(IExtensionManagementService, 'onInstallExtension', installEvent.event);
instantiationService.stub(IExtensionManagementService, 'onDidInstallExtension', didInstallEvent.event);
instantiationService.stub(IExtensionManagementService, 'onUninstallExtension', uninstallEvent.event);
instantiationService.stub(IExtensionManagementService, 'onDidUninstallExtension', didUninstallEvent.event);
@@ -173,8 +173,6 @@ suite('Notebook Input', function (): void {
});
test('Matches other input', async function (): Promise<void> {
assert.strictEqual(untitledNotebookInput.matches(undefined), false, 'Input should not match undefined.');
assert.ok(untitledNotebookInput.matches(untitledNotebookInput), 'Input should match itself.');
let otherTestUri = URI.from({ scheme: Schemas.untitled, path: 'OtherTestPath' });
@@ -20,7 +20,7 @@ import * as TypeMoq from 'typemoq';
import { errorHandler, onUnexpectedError } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { DidInstallExtensionEvent, DidUninstallExtensionEvent, IExtensionIdentifier, IExtensionManagementService, InstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
import { DidUninstallExtensionEvent, IExtensionIdentifier, IExtensionManagementService, InstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
@@ -154,7 +154,6 @@ suite.skip('NotebookService:', function (): void {
let editorGroupsService: IEditorGroupsService;
let installExtensionEmitter: Emitter<InstallExtensionEvent>,
didInstallExtensionEmitter: Emitter<DidInstallExtensionEvent>,
uninstallExtensionEmitter: Emitter<IExtensionIdentifier>,
didUninstallExtensionEmitter: Emitter<DidUninstallExtensionEvent>;
let configurationService: IConfigurationService;
@@ -178,14 +177,12 @@ suite.skip('NotebookService:', function (): void {
instantiationService = new TestInstantiationService();
installExtensionEmitter = new Emitter<InstallExtensionEvent>();
didInstallExtensionEmitter = new Emitter<DidInstallExtensionEvent>();
uninstallExtensionEmitter = new Emitter<IExtensionIdentifier>();
didUninstallExtensionEmitter = new Emitter<DidUninstallExtensionEvent>();
configurationService = new TestConfigurationService();
instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
instantiationService.stub(IExtensionManagementService, 'onInstallExtension', installExtensionEmitter.event);
instantiationService.stub(IExtensionManagementService, 'onDidInstallExtension', didInstallExtensionEmitter.event);
instantiationService.stub(IExtensionManagementService, 'onUninstallExtension', uninstallExtensionEmitter.event);
instantiationService.stub(IExtensionManagementService, 'onDidUninstallExtension', didUninstallExtensionEmitter.event);
extensionManagementService = instantiationService.get(IExtensionManagementService);
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { TestFileDialogService, TestLayoutService, TestPathService } from 'vs/workbench/test/browser/workbenchTestServices';
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { ILinkCalloutDialogOptions, LinkCalloutDialog } from 'sql/workbench/contrib/notebook/browser/calloutDialog/linkCalloutDialog';
@@ -555,22 +555,22 @@ export class NodeStub implements Node {
get baseURI(): string {
throw new Error('Method not implemented.');
}
get childNodes(): NodeListOf<ChildNode> {
get childNodes(): NodeListOf<ChildNode & Node> {
throw new Error('Method not implemented.');
}
get firstChild(): ChildNode {
get firstChild(): ChildNode & Node {
throw new Error('Method not implemented.');
}
get isConnected(): boolean {
throw new Error('Method not implemented.');
}
get lastChild(): ChildNode {
get lastChild(): ChildNode & Node {
throw new Error('Method not implemented.');
}
get namespaceURI(): string {
throw new Error('Method not implemented.');
}
get nextSibling(): ChildNode {
get nextSibling(): ChildNode & Node {
throw new Error('Method not implemented.');
}
get nodeName(): string {
@@ -588,7 +588,7 @@ export class NodeStub implements Node {
get parentNode(): Node & ParentNode {
throw new Error('Method not implemented.');
}
get previousSibling(): ChildNode {
get previousSibling(): ChildNode & Node {
throw new Error('Method not implemented.');
}
nodeValue: string;
@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { EditorExtensions } from 'vs/workbench/common/editor';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -15,14 +15,14 @@ import { ProfilerInput } from 'sql/workbench/browser/editor/profiler/profilerInp
import { ProfilerEditor } from 'sql/workbench/contrib/profiler/browser/profilerEditor';
import { PROFILER_VIEW_TEMPLATE_SETTINGS, PROFILER_SESSION_TEMPLATE_SETTINGS, IProfilerViewTemplate, IProfilerSessionTemplate, EngineType, PROFILER_FILTER_SETTINGS } from 'sql/workbench/services/profiler/browser/interfaces';
const profilerDescriptor = EditorDescriptor.create(
const profilerDescriptor = EditorPaneDescriptor.create(
ProfilerEditor,
ProfilerEditor.ID,
'ProfilerEditor'
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(profilerDescriptor, [new SyncDescriptor(ProfilerInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(profilerDescriptor, [new SyncDescriptor(ProfilerInput)]);
const profilerViewTemplateSchema: IJSONSchema = {
description: nls.localize('profiler.settings.viewTemplates', "Specifies view templates"),
@@ -518,7 +518,8 @@ export class ProfilerEditor extends EditorPane {
shouldFocus: FindStartFocusAction.FocusFindInput,
shouldAnimate: true,
updateSearchScope: false,
loop: true
loop: true,
seedSearchStringFromNonEmptySelection: false
});
}
} else {
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
import { IConfigurationRegistry, Extensions as ConfigExtensions, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry';
@@ -29,9 +29,9 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWo
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { TimeElapsedStatusBarContributions, RowCountStatusBarContributions, QueryStatusStatusBarContributions, QueryResultSelectionSummaryStatusBarContribution } from 'sql/workbench/contrib/query/browser/statusBarItems';
import { SqlFlavorStatusbarItem, ChangeFlavorAction } from 'sql/workbench/contrib/query/browser/flavorStatus';
import { EditorExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
import { EditorExtensions, IEditorFactoryRegistry } from 'vs/workbench/common/editor';
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/browser/fileQueryEditorInput';
import { FileQueryEditorInputSerializer, QueryEditorLanguageAssociation, UntitledQueryEditorInputSerializer } from 'sql/workbench/contrib/query/browser/queryInputFactory';
import { FileQueryEditorSerializer, QueryEditorLanguageAssociation, UntitledQueryEditorSerializer } from 'sql/workbench/contrib/query/browser/queryEditorFactory';
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
import { NewQueryTask, OE_NEW_QUERY_ACTION_ID, DE_NEW_QUERY_COMMAND_ID } from 'sql/workbench/contrib/query/browser/queryActions';
@@ -44,7 +44,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IModeService } from 'vs/editor/common/services/modeService';
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
import { IEditorOverrideService, ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
import { IEditorResolverService, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ILogService } from 'vs/platform/log/common/log';
@@ -52,20 +52,20 @@ export const QueryEditorVisibleCondition = ContextKeyExpr.has(queryContext.query
export const ResultsGridFocusCondition = ContextKeyExpr.and(ContextKeyExpr.has(queryContext.resultsVisibleId), ContextKeyExpr.has(queryContext.resultsGridFocussedId));
export const ResultsMessagesFocusCondition = ContextKeyExpr.and(ContextKeyExpr.has(queryContext.resultsVisibleId), ContextKeyExpr.has(queryContext.resultsMessagesFocussedId));
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
.registerEditorInputSerializer(FileQueryEditorInput.ID, FileQueryEditorInputSerializer);
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
.registerEditorSerializer(FileQueryEditorInput.ID, FileQueryEditorSerializer);
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
.registerEditorInputSerializer(UntitledQueryEditorInput.ID, UntitledQueryEditorInputSerializer);
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
.registerEditorSerializer(UntitledQueryEditorInput.ID, UntitledQueryEditorSerializer);
Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.LanguageAssociations)
.registerLanguageAssociation(QueryEditorLanguageAssociation.languages, QueryEditorLanguageAssociation, QueryEditorLanguageAssociation.isDefault);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(EditorDescriptor.create(QueryResultsEditor, QueryResultsEditor.ID, localize('queryResultsEditor.name', "Query Results")), [new SyncDescriptor(QueryResultsInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(EditorPaneDescriptor.create(QueryResultsEditor, QueryResultsEditor.ID, localize('queryResultsEditor.name', "Query Results")), [new SyncDescriptor(QueryResultsInput)]);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(EditorDescriptor.create(QueryEditor, QueryEditor.ID, QueryEditor.LABEL), [new SyncDescriptor(FileQueryEditorInput), new SyncDescriptor(UntitledQueryEditorInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(EditorPaneDescriptor.create(QueryEditor, QueryEditor.ID, QueryEditor.LABEL), [new SyncDescriptor(FileQueryEditorInput), new SyncDescriptor(UntitledQueryEditorInput)]);
const actionRegistry = <IWorkbenchActionRegistry>Registry.as(ActionExtensions.WorkbenchActions);
@@ -500,7 +500,7 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
constructor(
@ILogService private _logService: ILogService,
@IEditorService private _editorService: IEditorService,
@IEditorOverrideService private _editorOverrideService: IEditorOverrideService,
@IEditorResolverService private _editorResolverService: IEditorResolverService,
@IModeService private _modeService: IModeService
) {
super();
@@ -523,26 +523,23 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
// Create the selector from the list of all the language extensions we want to associate with the
// query editor (filtering out any languages which didn't have any extensions registered yet)
const selector = `*{${langExtensions.join(',')}}`;
this._registeredOverrides.add(this._editorOverrideService.registerEditor(
this._registeredOverrides.add(this._editorResolverService.registerEditor(
selector,
{
id: QueryEditor.ID,
label: QueryEditor.LABEL,
describes: (currentEditor) => currentEditor instanceof FileQueryEditorInput,
priority: ContributedEditorPriority.builtin
priority: RegisteredEditorPriority.builtin
},
{},
(resource, options, group) => {
const fileInput = this._editorService.createEditorInput({
resource: resource
}) as FileEditorInput;
(editorInput, group) => {
const fileInput = this._editorService.createEditorInput(editorInput) as FileEditorInput;
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(lang);
const queryEditorInput = langAssociation?.syncConvertInput?.(fileInput);
if (!queryEditorInput) {
this._logService.warn('Unable to create input for overriding editor ', resource);
this._logService.warn('Unable to create input for resolving editor ', editorInput.resource);
return undefined;
}
return { editor: queryEditorInput, options: options, group: group };
return { editor: queryEditorInput, options: editorInput.options, group: group };
}
));
});
@@ -5,7 +5,7 @@
import 'vs/css!./media/queryActions';
import * as nls from 'vs/nls';
import { Action, IActionRunner } from 'vs/base/common/actions';
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -583,6 +583,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
// CONSTRUCTOR /////////////////////////////////////////////////////////
constructor(
private _editor: QueryEditor,
public action: IAction,
@IContextViewService contextViewProvider: IContextViewService,
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
@INotificationService private readonly notificationService: INotificationService,
@@ -42,6 +42,7 @@ import { IRange } from 'vs/editor/common/core/range';
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { ConnectionOptionSpecialType } from 'sql/platform/connection/common/interfaces';
@@ -109,11 +110,12 @@ export class QueryEditor extends EditorPane {
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IModeService private readonly modeService: IModeService,
@ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService,
@ICapabilitiesService private readonly capabilitiesService: ICapabilitiesService
) {
super(QueryEditor.ID, telemetryService, themeService, storageService);
this.editorMemento = this.getEditorMemento<IQueryEditorViewState>(editorGroupService, QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
this.editorMemento = this.getEditorMemento<IQueryEditorViewState>(editorGroupService, textResourceConfigurationService, QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
this.queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
@@ -122,14 +124,21 @@ export class QueryEditor extends EditorPane {
}
private onFilesChanged(e: FileChangesEvent): void {
const deleted = e.getDeleted();
if (deleted && deleted.length) {
this.clearTextEditorViewState(deleted.map(d => d.resource));
const deleted = e.rawDeleted;
if (!deleted) {
return;
}
const changes = [];
for (const [, change] of deleted) {
changes.push(change);
}
if (changes.length) {
this.clearTextEditorViewState(changes.map(d => d.resource));
}
}
protected override getEditorMemento<T>(editorGroupService: IEditorGroupsService, key: string, limit: number = 10): IEditorMemento<T> {
return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService); // do not persist in storage as results are never persisted
protected override getEditorMemento<T>(editorGroupService: IEditorGroupsService, configurationService: ITextResourceConfigurationService, key: string, limit: number = 10): IEditorMemento<T> {
return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService, configurationService); // do not persist in storage as results are never persisted
}
// PUBLIC METHODS ////////////////////////////////////////////////////////////
@@ -222,9 +231,9 @@ export class QueryEditor extends EditorPane {
this._changeConnectionAction.enabled = this.input.state.connected;
this.setTaskbarContent();
if (this.input.state.connected) {
this.listDatabasesActionItem.onConnected();
this.listDatabasesActionItem?.onConnected();
} else {
this.listDatabasesActionItem.onDisconnect();
this.listDatabasesActionItem?.onDisconnect();
}
}
@@ -259,17 +268,17 @@ export class QueryEditor extends EditorPane {
*/
private _getActionItemForAction(action: IAction): IActionViewItem {
if (action.id === actions.ListDatabasesAction.ID) {
return this.listDatabasesActionItem;
if (!this._listDatabasesActionItem) {
this._listDatabasesActionItem = this.instantiationService.createInstance(actions.ListDatabasesActionItem, this, action);
this._register(this._listDatabasesActionItem.attachStyler(this.themeService));
}
return this._listDatabasesActionItem;
}
return null;
}
private get listDatabasesActionItem(): actions.ListDatabasesActionItem {
if (!this._listDatabasesActionItem) {
this._listDatabasesActionItem = this.instantiationService.createInstance(actions.ListDatabasesActionItem, this);
this._register(this._listDatabasesActionItem.attachStyler(this.themeService));
}
private get listDatabasesActionItem(): actions.ListDatabasesActionItem | undefined {
return this._listDatabasesActionItem;
}
@@ -324,7 +333,7 @@ export class QueryEditor extends EditorPane {
public override async setInput(newInput: QueryEditorInput, options: IEditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
const oldInput = this.input;
if (newInput.matches(oldInput)) {
if (oldInput && newInput.matches(oldInput)) {
return Promise.resolve();
}
@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IEditorInputFactoryRegistry, IEditorInput, IEditorInputSerializer, EditorExtensions } from 'vs/workbench/common/editor';
import { IEditorFactoryRegistry, IEditorInput, IEditorSerializer, EditorExtensions } from 'vs/workbench/common/editor';
import { Registry } from 'vs/platform/registry/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
@@ -24,7 +24,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
const editorInputFactoryRegistry = Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories);
const editorFactoryRegistry = Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory);
export class QueryEditorLanguageAssociation implements ILanguageAssociation {
static readonly isDefault = true;
@@ -99,13 +99,13 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
}
}
export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
export class FileQueryEditorSerializer implements IEditorSerializer {
constructor(@IFileService private readonly fileService: IFileService) {
}
serialize(editorInput: FileQueryEditorInput): string {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
if (factory) {
return factory.serialize(editorInput.text); // serialize based on the underlying input
}
@@ -113,7 +113,7 @@ export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileQueryEditorInput | undefined {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
// only successfully deserilize the file if the resource actually exists
if (this.fileService.exists(fileEditorInput.resource)) {
@@ -130,11 +130,11 @@ export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
}
}
export class UntitledQueryEditorInputSerializer implements IEditorInputSerializer {
export class UntitledQueryEditorSerializer implements IEditorSerializer {
constructor(@IConfigurationService private readonly configurationService: IConfigurationService) { }
serialize(editorInput: UntitledQueryEditorInput): string {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
// only serialize non-dirty files if the user has that setting
if (factory && (editorInput.isDirty() || this.configurationService.getValue<IQueryEditorConfiguration>('queryEditor').promptToSaveGeneratedFiles)) {
return factory.serialize(editorInput.text); // serialize based on the underlying input
@@ -143,7 +143,7 @@ export class UntitledQueryEditorInputSerializer implements IEditorInputSerialize
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledQueryEditorInput | undefined {
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
const queryResultsInput = instantiationService.createInstance(QueryResultsInput, untitledEditorInput.resource.toString());
return instantiationService.createInstance(UntitledQueryEditorInput, '', untitledEditorInput, queryResultsInput);
@@ -21,7 +21,7 @@ import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import * as TypeMoq from 'typemoq';
import * as assert from 'assert';
import { TestFileService, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
import { TestFileService, TestTextResourceConfigurationService, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
@@ -51,7 +51,7 @@ suite('SQL QueryAction Tests', () => {
// Setup a reusable mock QueryEditor
editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
editor.setup(x => x.input).returns(() => testQueryInput.object);
editor.setup(x => x.getSelection()).returns(() => undefined);
@@ -101,7 +101,7 @@ suite('SQL QueryAction Tests', () => {
// Setup a reusable mock QueryEditor
editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
editor.setup(x => x.input).returns(() => testQueryInput.object);
// If I create a QueryTaskbarAction and I pass a non-connected editor to _getConnectedQueryEditorUri
@@ -193,7 +193,7 @@ suite('SQL QueryAction Tests', () => {
// Setup a reusable mock QueryEditor
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
queryEditor.setup(x => x.input).returns(() => queryInput.object);
queryEditor.setup(x => x.getSelection()).returns(() => undefined);
queryEditor.setup(x => x.getSelection(false)).returns(() => undefined);
@@ -248,7 +248,7 @@ suite('SQL QueryAction Tests', () => {
// Setup a reusable mock QueryEditor
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
queryEditor.setup(x => x.input).returns(() => queryInput.object);
queryEditor.setup(x => x.isSelectionEmpty()).returns(() => false);
queryEditor.setup(x => x.getSelection()).returns(() => {
@@ -472,7 +472,7 @@ suite('SQL QueryAction Tests', () => {
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
// If I query without having initialized anything, state should be clear
listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
assert.strictEqual(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
assert.strictEqual(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
@@ -505,7 +505,7 @@ suite('SQL QueryAction Tests', () => {
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
// ... Create a database dropdown that has been connected
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
listItem.onConnected();
// If: I raise a connection changed event
@@ -529,7 +529,7 @@ suite('SQL QueryAction Tests', () => {
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
// ... Create a database dropdown that has been connected
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
listItem.onConnected();
// If: I raise a connection changed event for the 'wrong' URI
@@ -554,7 +554,7 @@ suite('SQL QueryAction Tests', () => {
connectionManagementService.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
// ... Create a database dropdown
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
// If: I raise a connection changed event
let eventParams = <IConnectionParams>{
@@ -579,7 +579,7 @@ suite('SQL QueryAction Tests', () => {
// mocking query editor
const contextkeyservice = new MockContextKeyService();
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(),
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
queryEditor.setup(x => x.input).returns(() => testQueryInput.object);
queryEditor.setup(x => x.getSelection(false)).returns(() => { return predefinedSelection; });
@@ -636,7 +636,7 @@ suite('SQL QueryAction Tests', () => {
// mocking query editor
const contextkeyservice = new MockContextKeyService();
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(),
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
queryEditor.setup(x => x.input).returns(() => testQueryInput.object);
// mocking isConnected in ConnectionManagementService
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { IEditorDescriptor } from 'vs/workbench/browser/editor';
import { IEditorPaneDescriptor } from 'vs/workbench/browser/editor';
import { URI } from 'vs/base/common/uri';
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
@@ -64,7 +64,7 @@ suite('SQL QueryEditor Tests', () => {
instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => {
if (classDef.ID) {
if (classDef.ID === 'listDatabaseQueryActionItem') {
return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, undefined);
return new ListDatabasesActionItem(editor, action, undefined, connectionManagementService.object, undefined, undefined);
}
}
// Default
@@ -72,7 +72,7 @@ suite('SQL QueryEditor Tests', () => {
});
// Mock EditorDescriptorService to give us a mock editor description
let descriptor: IEditorDescriptor = {
let descriptor: IEditorPaneDescriptor = {
typeId: 'id',
name: 'name',
describes: function (obj: any): boolean { return true; },
@@ -292,7 +292,7 @@ suite('SQL QueryEditor Tests', () => {
queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
.returns((definition, editor, action, selectBox) => {
if (definition.ID === 'listDatabaseQueryActionItem') {
let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, undefined);
let item = new ListDatabasesActionItem(editor, action, undefined, connectionManagementService.object, undefined, undefined);
return item;
}
// Default
@@ -11,7 +11,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IEditorInput } from 'vs/workbench/common/editor';
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
import { workbenchInstantiationService } from 'sql/workbench/test/workbenchTestServices';
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryInputFactory';
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryEditorFactory';
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { TestObjectExplorerService } from 'sql/workbench/services/objectExplorer/test/browser/testObjectExplorerService';
@@ -4,50 +4,49 @@
*--------------------------------------------------------------------------------------------*/
import { QueryPlanInput } from 'sql/workbench/contrib/queryPlan/common/queryPlanInput';
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { EditorExtensions } from 'vs/workbench/common/editor';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { Registry } from 'vs/platform/registry/common/platform';
import { QueryPlanEditor } from 'sql/workbench/contrib/queryPlan/browser/queryPlanEditor';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { ContributedEditorPriority, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
import { IEditorResolverService, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { Disposable } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
// Query Plan editor registration
const queryPlanEditorDescriptor = EditorDescriptor.create(
const queryPlanEditorDescriptor = EditorPaneDescriptor.create(
QueryPlanEditor,
QueryPlanEditor.ID,
QueryPlanEditor.LABEL
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(queryPlanEditorDescriptor, [new SyncDescriptor(QueryPlanInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(queryPlanEditorDescriptor, [new SyncDescriptor(QueryPlanInput)]);
export class QueryPlanEditorOverrideContribution extends Disposable implements IWorkbenchContribution {
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IEditorOverrideService private _editorOverrideService: IEditorOverrideService
@IEditorResolverService private _editorResolverService: IEditorResolverService
) {
super();
this.registerEditorOverride();
}
private registerEditorOverride(): void {
this._editorOverrideService.registerEditor(
this._editorResolverService.registerEditor(
'*.sqlplan',
{
id: QueryPlanEditor.ID,
label: QueryPlanEditor.LABEL,
describes: (currentEditor) => currentEditor instanceof QueryPlanInput,
priority: ContributedEditorPriority.builtin
priority: RegisteredEditorPriority.builtin
},
{},
(resource, options, group) => {
const queryPlanInput = this._instantiationService.createInstance(QueryPlanInput, resource);
return { editor: queryPlanInput };
(editorInput, group) => {
const queryPlanInput = this._instantiationService.createInstance(QueryPlanInput, editorInput.resource);
return { editor: queryPlanInput, options: editorInput.options, group: group };
}
);
}
@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { EditorExtensions } from 'vs/workbench/common/editor';
import { Registry } from 'vs/platform/registry/common/platform';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
@@ -39,14 +39,14 @@ CommandsRegistry.registerCommand({
}
});
const resourceViewerDescriptor = EditorDescriptor.create(
const resourceViewerDescriptor = EditorPaneDescriptor.create(
ResourceViewerEditor,
ResourceViewerEditor.ID,
'ResourceViewerEditor'
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(resourceViewerDescriptor, [new SyncDescriptor(ResourceViewerInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(resourceViewerDescriptor, [new SyncDescriptor(ResourceViewerInput)]);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ResourceViewResourcesExtensionHandler, LifecyclePhase.Ready);
@@ -7,19 +7,19 @@ import { TableDesignerInput } from 'sql/workbench/browser/editor/tableDesigner/t
import { TableDesignerEditor } from 'sql/workbench/contrib/tableDesigner/browser/tableDesignerEditor';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { Registry } from 'vs/platform/registry/common/platform';
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { EditorExtensions } from 'vs/workbench/common/editor';
import { localize } from 'vs/nls';
import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry';
const tableDesignerDescriptor = EditorDescriptor.create(
const tableDesignerDescriptor = EditorPaneDescriptor.create(
TableDesignerEditor,
TableDesignerEditor.ID,
'TableDesignerEditor'
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(tableDesignerDescriptor, [new SyncDescriptor(TableDesignerInput)]);
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
.registerEditorPane(tableDesignerDescriptor, [new SyncDescriptor(TableDesignerInput)]);
Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration).registerConfiguration({
id: 'tableDesigner',
@@ -382,9 +382,9 @@ export class TreeView extends Disposable implements ITreeView {
private createTree() {
const actionViewItemProvider = (action: IAction) => {
if (action instanceof MenuItemAction) {
return this.instantiationService.createInstance(MenuEntryActionViewItem, action);
return this.instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
} else if (action instanceof SubmenuItemAction) {
return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action);
return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action, undefined);
}
return undefined;
@@ -30,7 +30,7 @@ import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/com
import { tileBorder, gradientOne, gradientTwo, gradientBackground, extensionPackHeaderShadow, extensionPackGradientColorOneColor, extensionPackGradientColorTwoColor, tileBoxShadow, hoverShadow } from 'sql/platform/theme/common/colorRegistry';
import { registerColor, foreground, textLinkActiveForeground, descriptionForeground, activeContrastBorder, buttonForeground, menuBorder, menuForeground, editorWidgetBorder, selectBackground, buttonHoverBackground, selectBorder, iconForeground, textLinkForeground, inputBackground, focusBorder, listFocusBackground, listFocusForeground, buttonSecondaryBackground, buttonSecondaryBorder, buttonDisabledForeground, buttonDisabledBackground, buttonSecondaryForeground, buttonSecondaryHoverBackground } from 'vs/platform/theme/common/colorRegistry';
import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
import { IEditorInputSerializer } from 'vs/workbench/common/editor';
import { IEditorSerializer } from 'vs/workbench/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { TimeoutTimer } from 'vs/base/common/async';
@@ -821,7 +821,7 @@ class WelcomePage extends Disposable {
}
}
export class WelcomeInputSerializer implements IEditorInputSerializer {
export class WelcomeInputSerializer implements IEditorSerializer {
static readonly ID = welcomeInputTypeId;
@@ -156,7 +156,7 @@ export class ConnectionBrowserView extends Disposable implements IPanelView {
this.treeMenus = this.instantiationService.createInstance(ConnectionBrowseTreeMenuProvider);
const actionViewItemProvider = (action: IAction) => {
if (action instanceof MenuItemAction) {
return this.instantiationService.createInstance(MenuEntryActionViewItem, action);
return this.instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
}
return undefined;
};
@@ -368,9 +368,9 @@ export class TreeView extends Disposable implements ITreeView {
private createTree() {
const actionViewItemProvider = (action: IAction) => {
if (action instanceof MenuItemAction) {
return this.instantiationService.createInstance(MenuEntryActionViewItem, action);
return this.instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
} else if (action instanceof SubmenuItemAction) {
return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action);
return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action, undefined);
}
return undefined;
@@ -851,7 +851,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
targetElements: [this],
dispose: () => { }
};
hoverOptions = { text: tooltip, target };
hoverOptions = { content: tooltip, target };
}
if (mouseX !== undefined) {
(<IHoverTarget>hoverOptions.target).x = mouseX;
@@ -98,7 +98,7 @@ export class ErrorMessageDialog extends Modal {
this.ok();
// Run the action if possible
if (this._actions && index < this._actions.length) {
this._actions[index].run().catch(err => onUnexpectedError(err));
this._actions[index].run();
}
}
@@ -0,0 +1,25 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { IWorkspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
export interface IExtensionsConfigContent {
recommendations: string[];
unwantedRecommendations: string[];
}
export type DynamicRecommendation = 'dynamic';
export type ConfigRecommendation = 'config';
export type ExecutableRecommendation = 'executable';
export type CachedRecommendation = 'cached';
export type ApplicationRecommendation = 'application';
export type ExperimentalRecommendation = 'experimental';
export type ExtensionRecommendationSource = IWorkspace | IWorkspaceFolder | URI | DynamicRecommendation | ExecutableRecommendation | CachedRecommendation | ApplicationRecommendation | ExperimentalRecommendation | ConfigRecommendation;
export interface IExtensionRecommendation {
extensionId: string;
sources: ExtensionRecommendationSource[];
}
@@ -7,8 +7,9 @@ import { URI } from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { IContentLoader } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
import { IStandardKernelWithProvider } from 'sql/workbench/services/notebook/browser/models/notebookUtils';
import { IEditorInput } from 'vs/workbench/common/editor';
export interface INotebookInput {
export interface INotebookInput extends IEditorInput {
defaultKernel?: azdata.nb.IKernelSpec,
connectionProfile?: azdata.IConnectionProfile,
isDirty(): boolean;
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { nb } from 'azdata';
import { ICellModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
import { INotebookView } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViews';
@@ -5,7 +5,7 @@
import { EditorExtensions } from 'vs/workbench/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IEditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
import { IEditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
import { Registry } from 'vs/platform/registry/common/platform';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
@@ -13,7 +13,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
export interface IEditorDescriptorService {
_serviceBrand: undefined;
getEditor(input: EditorInput): IEditorDescriptor | undefined;
getEditor(input: EditorInput): IEditorPaneDescriptor | undefined;
}
export class EditorDescriptorService implements IEditorDescriptorService {
@@ -22,8 +22,8 @@ export class EditorDescriptorService implements IEditorDescriptorService {
constructor() {
}
public getEditor(input: EditorInput): IEditorDescriptor | undefined {
return Registry.as<IEditorRegistry>(EditorExtensions.Editors).getEditor(input);
public getEditor(input: EditorInput): IEditorPaneDescriptor | undefined {
return Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane).getEditorPane(input);
}
}
@@ -21,7 +21,7 @@ export class TestQueryEditorService implements IQueryEditorService {
}
newSqlEditor(options?: INewSqlEditorOptions): Promise<IUntitledQueryEditorInput> {
const base = this.editorService.createEditorInput({ forceUntitled: true }) as UntitledTextEditorInput;
const base = this.editorService.createEditorInput({ resource: undefined, forceUntitled: true }) as UntitledTextEditorInput;
return Promise.resolve(this.instantiationService.createInstance(UntitledQueryEditorInput, '', base, new QueryResultsInput(base.resource.toString(true))));
}
@@ -7,8 +7,8 @@ import * as assert from 'assert';
import * as sinon from 'sinon';
import { setMode } from 'sql/workbench/browser/parts/editor/editorStatusModeSelect';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryInputFactory';
import { NotebookEditorInputAssociation } from 'sql/workbench/contrib/notebook/browser/models/notebookInputFactory';
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryEditorFactory';
import { NotebookEditorLanguageAssociation } from 'sql/workbench/contrib/notebook/browser/models/notebookEditorFactory';
import { workbenchInstantiationService } from 'sql/workbench/test/workbenchTestServices';
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -45,7 +45,7 @@ suite('set mode', () => {
setup(() => {
disposables.push(languageAssociations.registerLanguageAssociation(QueryEditorLanguageAssociation.languages, QueryEditorLanguageAssociation, QueryEditorLanguageAssociation.isDefault));
disposables.push(languageAssociations.registerLanguageAssociation(NotebookEditorInputAssociation.languages, NotebookEditorInputAssociation));
disposables.push(languageAssociations.registerLanguageAssociation(NotebookEditorLanguageAssociation.languages, NotebookEditorLanguageAssociation));
instantiationService = workbenchInstantiationService();
instantiationService.stub(INotebookService, new NotebookServiceStub());
const editorService = new MockEditorService(instantiationService);
+18 -3
View File
@@ -12,7 +12,7 @@
"strictNullChecks": false,
// Disable since without strictNullChecks this has lots of errors in both vs and our code
"noImplicitAny": false,
"strictOptionalProperties": false,
"exactOptionalPropertyTypes": false,
"useUnknownInCatchVariables": false,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
@@ -25,10 +25,25 @@
]
},
"lib": [
"ES2015",
"ES2016.Array.Include",
"ES2016",
"ES2017.Object",
"ES2017.String",
"ES2017.Intl",
"ES2017.TypedArrays",
"ES2018.AsyncIterable",
"ES2018.AsyncGenerator",
"ES2018.Promise",
"ES2018.Regexp",
"ES2018.Intl",
"ES2019.Array",
"ES2019.Object",
"ES2019.String",
"ES2019.Symbol",
"ES2020.BigInt",
"ES2020.Promise",
"ES2020.String",
"ES2020.Symbol.WellKnown",
"ES2020.Intl",
"DOM",
"DOM.Iterable",
"WebWorker.ImportScripts"
+1 -1
View File
@@ -5,7 +5,7 @@
"preserveConstEnums": true,
"sourceMap": false,
"outDir": "../out/vs",
"target": "es2017",
"target": "es2020",
"types": [
"keytar",
"mocha",
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"noEmit": true,
"module": "None",
"experimentalDecorators": false,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noUnusedLocals": true,
"allowUnreachableCode": false,
"strict": true,
"exactOptionalPropertyTypes": false,
"useUnknownInCatchVariables": false,
"forceConsistentCasingInFileNames": true,
"types": [],
"lib": [
"es5",
],
},
"include": [
"vs/vscode.d.ts"
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.vscode-dts.json",
"include": [
"vs/vscode.d.ts",
"vs/vscode.proposed.d.ts",
]
}
-172
View File
@@ -1,172 +0,0 @@
{
"compilerOptions": {
"target": "es2017",
"module": "amd",
"moduleResolution": "node",
"experimentalDecorators": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": false,
"noEmit": true,
"skipLibCheck": true,
"paths": {
"vs/*": [
"./vs/*"
],
"sql/*": [
"./sql/*"
]
},
"lib": [
"ES2015",
"ES2017.String",
"ES2018.Promise",
"DOM",
"DOM.Iterable",
"WebWorker.ImportScripts"
],
"types": [
"keytar",
"mocha",
"semver",
"sinon",
"winreg",
"trusted-types",
"wicg-file-system-access"
]
},
"files": [
"./vs/workbench/contrib/debug/common/debugProtocol.d.ts"
],
"include": [
"./**/*.d.ts",
"./sql/**/*.ts",
"./vs/base/**/*.ts",
// "./vs/code/**/*.ts",
"./vs/editor/**/*.ts",
"./vs/platform/**/*.ts",
"./vs/workbench/api/**/*.ts",
// "./vs/workbench/browser/**/*.ts", // 2646 errors
"./vs/workbench/common/**/*.ts",
"./vs/workbench/contrib/**/*.ts",
// "./vs/workbench/electron-browser/**/*.ts", // 2646 errors
// "./vs/workbench/electron-sandbox/**/*.ts", // 2646 errors
"./vs/workbench/services/**/*.ts"
],
"exclude": [
"./sql/workbench/api/browser/**/*.ts", // 942 errors
"./sql/workbench/api/common/**/*.ts", // 236 errors
"./sql/workbench/browser/**/*.ts", // 2646 errors
"./sql/workbench/contrib/assessment/**/*.ts", // 62 errors
"./sql/workbench/contrib/assessment/test/**/*.ts",
"./sql/workbench/contrib/charts/test/**/*.ts",
"./sql/workbench/contrib/commandLine/**/*.ts", // 292 errors
"./sql/workbench/contrib/commandLine/test/**/*.ts",
"./sql/workbench/contrib/connection/**/*.ts", // 174 errors
"./sql/workbench/contrib/dashboard/**/*.ts", // 1015 errors
"./sql/workbench/contrib/dataExplorer/**/*.ts", // 2667 errors
"./sql/workbench/contrib/editData/**/*.ts", // 441 errors
"./sql/workbench/contrib/editorReplacement/test/**/*.ts",
"./sql/workbench/contrib/jobManagement/**/*.ts", // 315 errors
"./sql/workbench/contrib/modelView/**/*.ts", // 2646 errors
"./sql/workbench/contrib/notebook/**/*.ts", // 2648 errors
"./sql/workbench/contrib/notebook/test/**/*.ts",
"./sql/workbench/contrib/objectExplorer/test/**/*.ts",
"./sql/workbench/contrib/profiler/**/*.ts", // 101 errors
"./sql/workbench/contrib/query/**/*.ts", // 483 errors
"./sql/workbench/contrib/query/test/**/*.ts",
"./sql/workbench/contrib/queryHistory/**/*.ts", // 291 errors
"./sql/workbench/contrib/welcome/**/*.ts", // 66 errors
"./sql/workbench/services/connection/**/*.ts", // 253 errors
"./sql/workbench/services/connection/test/**/*.ts",
"./sql/workbench/services/dialog/**/*.ts", // 82 errors
"./sql/workbench/services/dialog/test/**/*.ts",
"./sql/workbench/services/fileBrowser/**/*.ts", // 2646 errors
"./sql/workbench/services/insights/**/*.ts", // 67 errors
"./sql/workbench/services/insights/test/**/*.ts",
"./sql/workbench/services/notebook/**/*.ts", // 200 errors
"./sql/workbench/services/objectExplorer/**/*.ts", // 185 errors
"./sql/workbench/services/query/test/**/*.ts",
"./sql/workbench/services/queryEditor/test/**/*.ts",
"./sql/workbench/test/**/*.ts", // 2975 errors
"./sql/workbench/update/**/*.ts", // 2646 errors
"./vs/workbench/api/browser/**/*.ts", // 3187 errors
"./vs/workbench/api/common/**/*.ts", // 323 errors
"./vs/workbench/api/node/**/*.ts", // 328 errors
"./vs/workbench/api/worker/**/*.ts", // 294 errors
"./vs/workbench/contrib/backup/**/*.ts", // 3162 errors
"./vs/workbench/contrib/bulkEdit/**/*.ts",
"./vs/workbench/contrib/codeEditor/**/*.ts", // 3162 errors
"./vs/workbench/contrib/comments/**/*.ts", // 64 errors
"./vs/workbench/contrib/configExporter/**/*.ts", // 3162 errors
"./vs/workbench/contrib/customEditor/**/*.ts", // 99 errors
"./vs/workbench/contrib/debug/**/*.ts", // 3052 errors
"./vs/workbench/contrib/experiments/**/*.ts", // 3162 errors
"./vs/workbench/contrib/extensions/**/*.ts", // 3162 errors
"./vs/workbench/contrib/files/**/*.ts", // 3162 errors
"./vs/workbench/contrib/issue/**/*.ts", // 3162 errors
"./vs/workbench/contrib/logs/**/*.ts", // 3162 errors
"./vs/workbench/contrib/notebook/**/*.ts", // 3162 errors
"./vs/workbench/contrib/outline/**/*.ts", // 3162 errors
"./vs/workbench/contrib/performance/**/*.ts", // 3162 errors
"./vs/workbench/contrib/preferences/**/*.ts", // 3162 errors
"./vs/workbench/contrib/relauncher/**/*.ts", // 3162 errors
"./vs/workbench/contrib/remote/**/*.ts", // 3162 errors
"./vs/workbench/contrib/search/**/*.ts", // 3162 errors
"./vs/workbench/contrib/searchEditor/**/*.ts", // 3162 errors
"./vs/workbench/contrib/splash/**/*.ts", // 3162 errors
"./vs/workbench/contrib/tags/**/*.ts", // 3162 errors
"./vs/workbench/contrib/tasks/**/*.ts", // 3162 errors
"./vs/workbench/contrib/telemetry/**/*.ts", // 3162 errors
"./vs/workbench/contrib/terminal/**/*.ts", // 3162 errors
"./vs/workbench/contrib/timeline/**/*.ts", // 3162 errors
"./vs/workbench/contrib/update/**/*.ts", // 3162 errors
"./vs/workbench/contrib/url/**/*.ts", // 3162 errors
"./vs/workbench/contrib/userDataSync/**/*.ts", // 3162 errors
"./vs/workbench/contrib/watermark/**/*.ts", // 3162 errors
"./vs/workbench/contrib/webview/**/*.ts", // 3162 errors
"./vs/workbench/contrib/welcome/**/*.ts", // 65 errors
"./vs/workbench/services/accessibility/**/*.ts", // 3162 errors
"./vs/workbench/services/authentication/**/*.ts", // 3162 errors
"./vs/workbench/services/backup/**/*.ts", // 3162 errors
"./vs/workbench/services/configuration/**/*.ts", // 3162 errors
"./vs/workbench/services/configurationResolver/**/*.ts", // 3162 errors
"./vs/workbench/services/credentials/**/*.ts", // 3162 errors
"./vs/workbench/services/dialogs/**/*.ts", // 3162 errors
"./vs/workbench/services/editor/**/*.ts", // 3162 errors
"./vs/workbench/services/environment/**/*.ts", // 3162 errors
"./vs/workbench/services/extensionManagement/**/*.ts", // 3162 errors
"./vs/workbench/services/extensions/**/*.ts", // 3162 errors
"./vs/workbench/services/history/**/*.ts", // 3162 errors
"./vs/workbench/services/host/**/*.ts", // 3162 errors
"./vs/workbench/services/keybinding/**/*.ts", // 3162 errors
"./vs/workbench/services/label/**/*.ts", // 3162 errors
"./vs/workbench/services/log/**/*.ts", // 3162 errors
"./vs/workbench/services/output/**/*.ts", // 3162 errors
"./vs/workbench/services/path/**/*.ts", // 3162 errors
"./vs/workbench/services/progress/**/*.ts", // 3162 errors
"./vs/workbench/services/remote/**/*.ts", // 3162 errors
"./vs/workbench/services/sharedProcess/**/*.ts", // 3162 errors
"./vs/workbench/services/telemetry/**/*.ts", // 3162 errors
"./vs/workbench/services/textfile/**/*.ts", // 3162 errors
"./vs/workbench/services/textMate/**/*.ts", // 3162 errors
"./vs/workbench/services/textmodelResolver/**/*.ts", // 3162 errors
"./vs/workbench/services/textresourceProperties/**/*.ts", // 3162 errors
"./vs/workbench/services/themes/**/*.ts", // 3162 errors
"./vs/workbench/services/timer/**/*.ts", // 3162 errors
"./vs/workbench/services/title/**/*.ts", // 3162 errors
"./vs/workbench/services/untitled/**/*.ts", // 3162 errors
"./vs/workbench/services/update/**/*.ts", // 3162 errors
"./vs/workbench/services/url/**/*.ts", // 3162 errors
"./vs/workbench/services/userData/**/*.ts", // 3162 errors
"./vs/workbench/services/userDataSync/**/*.ts", // 3162 errors
"./vs/workbench/services/views/**/*.ts", // 3162 errors
"./vs/workbench/services/workingCopy/**/*.ts", // 3162 errors
"./vs/workbench/services/workspaces/**/*.ts", // 3162 errors
]
}
+2 -5
View File
@@ -1,13 +1,11 @@
{
"ban-eval-calls": [
"vs/workbench/api/worker/extHostExtensionService.ts",
"vs/base/worker/workerMain",
"vs/workbench/services/extensions/worker/extensionHostWorkerMain"
"vs/base/worker/workerMain"
],
"ban-function-calls": [
"vs/workbench/api/worker/extHostExtensionService.ts",
"vs/base/worker/workerMain",
"vs/workbench/services/extensions/worker/extensionHostWorkerMain",
"vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts",
"vs/workbench/services/keybinding/test/electron-browser/keyboardMapperTestUtils.ts"
],
@@ -26,8 +24,7 @@
"vs/workbench/api/worker/extHostExtensionService.ts",
"vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts",
"vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts",
"vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts",
"vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts"
"vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts"
],
"ban-worker-calls": [
"vs/base/worker/defaultWorkerFactory.ts",
+2 -2
View File
@@ -5,7 +5,7 @@
/**
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
* and others. This API makes no assumption about what promise libary is being used which
* and others. This API makes no assumption about what promise library is being used which
* enables reusing existing code without migrating to a specific promise implementation. Still,
* we recommend the use of native promises which are available in VS Code.
*/
@@ -18,4 +18,4 @@ interface Thenable<T> {
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
}
}
+2 -2
View File
@@ -41,6 +41,6 @@ export const BrowserFeatures = {
// 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be
// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast
touch: 'ontouchstart' in window || navigator.maxTouchPoints > 0 || (window as Window).navigator.msMaxTouchPoints > 0,
pointerEvents: window.PointerEvent && ('ontouchstart' in window || (window as Window).navigator.maxTouchPoints > 0 || navigator.maxTouchPoints > 0 || (window as Window).navigator.msMaxTouchPoints > 0)
touch: 'ontouchstart' in window || navigator.maxTouchPoints > 0,
pointerEvents: window.PointerEvent && ('ontouchstart' in window || (window as Window).navigator.maxTouchPoints > 0 || navigator.maxTouchPoints > 0)
};
+2 -2
View File
@@ -3,10 +3,10 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { AnchorAlignment, AnchorAxisAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { IAction, IActionRunner } from 'vs/base/common/actions';
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { AnchorAlignment, AnchorAxisAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
export interface IContextMenuEvent {
readonly shiftKey?: boolean;
+8 -2
View File
@@ -3,8 +3,9 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Disposable } from 'vs/base/common/lifecycle';
import { addDisposableListener } from 'vs/base/browser/dom';
import { Disposable } from 'vs/base/common/lifecycle';
import { Mimes } from 'vs/base/common/mime';
/**
* A helper that will execute a provided function when the provided HTMLElement receives
@@ -70,7 +71,12 @@ export const DataTransfers = {
/**
* Typically transfer type for copy/paste transfers.
*/
TEXT: 'text/plain'
TEXT: Mimes.text,
/**
* Application specific terminal transfer type.
*/
TERMINALS: 'Terminals'
};
export function applyDragImage(event: DragEvent, label: string | null, clazz: string): void {
+34 -24
View File
@@ -4,20 +4,19 @@
*--------------------------------------------------------------------------------------------*/
import * as browser from 'vs/base/browser/browser';
import { domEvent } from 'vs/base/browser/event';
import { BrowserFeatures } from 'vs/base/browser/canIUse';
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { TimeoutTimer } from 'vs/base/common/async';
import { onUnexpectedError } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
import { FileAccess, RemoteAuthorities } from 'vs/base/common/network';
import { BrowserFeatures } from 'vs/base/browser/canIUse';
import { insane, InsaneOptions } from 'vs/base/common/insane/insane';
import { KeyCode } from 'vs/base/common/keyCodes';
import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { FileAccess, RemoteAuthorities } from 'vs/base/common/network';
import * as platform from 'vs/base/common/platform';
import { withNullAsUndefined } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
export function clearNode(node: HTMLElement): void {
while (node.firstChild) {
@@ -671,7 +670,7 @@ function getParentFlowToElement(node: HTMLElement): HTMLElement | null {
}
/**
* Check if `testAncestor` is an ancessor of `testChild`, observing the explicit
* Check if `testAncestor` is an ancestor of `testChild`, observing the explicit
* parents set by `setParentFlowTo`.
*/
export function isAncestorUsingFlowTo(testChild: Node, testAncestor: Node): boolean {
@@ -975,8 +974,8 @@ class FocusTracker extends Disposable implements IFocusTracker {
}
};
this._register(domEvent(element, EventType.FOCUS, true)(onFocus));
this._register(domEvent(element, EventType.BLUR, true)(onBlur));
this._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));
this._register(addDisposableListener(element, EventType.BLUR, onBlur, true));
}
refreshState() {
@@ -1180,7 +1179,7 @@ export function computeScreenAwareSize(cssPx: number): number {
/**
* Open safely a new window. This is the best way to do so, but you cannot tell
* if the window was opened or if it was blocked by the brower's popup blocker.
* if the window was opened or if it was blocked by the browser's popup blocker.
* If you want to tell if the browser blocked the new window, use `windowOpenNoOpenerWithSuccess`.
*
* See https://github.com/microsoft/monaco-editor/issues/601
@@ -1200,7 +1199,7 @@ export function windowOpenNoOpener(url: string): void {
}
/**
* Open safely a new window. This technique is not appropiate in certain contexts,
* Open safely a new window. This technique is not appropriate in certain contexts,
* like for example when the JS context is executing inside a sandboxed iframe.
* If it is not necessary to know if the browser blocked the new window, use
* `windowOpenNoOpener`.
@@ -1306,7 +1305,7 @@ export enum DetectedFullscreenMode {
DOCUMENT = 1,
/**
* The browser is fullsreen, e.g. because the user enabled
* The browser is fullscreen, e.g. because the user enabled
* native window fullscreen for it.
*/
BROWSER
@@ -1393,7 +1392,7 @@ const _ttpSafeInnerHtml = window.trustedTypes?.createPolicy('safeInnerHtml', {
export function safeInnerHtml(node: HTMLElement, value: string): void {
const options = _extInsaneOptions({
allowedTags: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'i', 'img', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'], // {{SQL CARBON EDIT}} Add tags for welcome page support
allowedTags: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'], // {{SQL CARBON EDIT}} Add i & img tags for welcome page support
allowedAttributes: {
'a': ['href', 'x-dispatch'],
'button': ['data-href', 'x-dispatch'],
@@ -1481,7 +1480,7 @@ export class ModifierKeyEmitter extends Emitter<IModifierKeyStatus> {
metaKey: false
};
this._subscriptions.add(domEvent(window, 'keydown', true)(e => {
this._subscriptions.add(addDisposableListener(window, 'keydown', e => {
if (e.defaultPrevented) {
return;
}
@@ -1516,9 +1515,9 @@ export class ModifierKeyEmitter extends Emitter<IModifierKeyStatus> {
this._keyStatus.event = e;
this.fire(this._keyStatus);
}
}));
}, true));
this._subscriptions.add(domEvent(window, 'keyup', true)(e => {
this._subscriptions.add(addDisposableListener(window, 'keyup', e => {
if (e.defaultPrevented) {
return;
}
@@ -1548,23 +1547,23 @@ export class ModifierKeyEmitter extends Emitter<IModifierKeyStatus> {
this._keyStatus.event = e;
this.fire(this._keyStatus);
}
}));
}, true));
this._subscriptions.add(domEvent(document.body, 'mousedown', true)(e => {
this._subscriptions.add(addDisposableListener(document.body, 'mousedown', () => {
this._keyStatus.lastKeyPressed = undefined;
}));
}, true));
this._subscriptions.add(domEvent(document.body, 'mouseup', true)(e => {
this._subscriptions.add(addDisposableListener(document.body, 'mouseup', () => {
this._keyStatus.lastKeyPressed = undefined;
}));
}, true));
this._subscriptions.add(domEvent(document.body, 'mousemove', true)(e => {
this._subscriptions.add(addDisposableListener(document.body, 'mousemove', e => {
if (e.buttons) {
this._keyStatus.lastKeyPressed = undefined;
}
}));
}, true));
this._subscriptions.add(domEvent(window, 'blur')(e => {
this._subscriptions.add(addDisposableListener(window, 'blur', () => {
this.resetKeyStatus();
}));
}
@@ -1623,3 +1622,14 @@ export function addMatchMediaChangeListener(query: string, callback: () => void)
mediaQueryList.addListener(callback);
}
}
export const enum ZIndex {
SASH = 35,
SuggestWidget = 40,
Hover = 50,
DragImage = 1000,
MenubarMenuItemsHolder = 2000, // quick-input-widget
ContextView = 2500,
ModalDialog = 2600,
PaneDropOverlay = 10000
}
+4 -19
View File
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { GestureEvent } from 'vs/base/browser/touch';
import { Event as BaseEvent, Emitter } from 'vs/base/common/event';
import { Emitter, Event as BaseEvent } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
export type EventHandler = HTMLElement | HTMLDocument | Window;
@@ -14,24 +14,7 @@ export interface IDomEvent {
(element: EventHandler, type: string, useCapture?: boolean): BaseEvent<unknown>;
}
/**
* @deprecated Use `DomEmitter` instead
*/
export const domEvent: IDomEvent = (element: EventHandler, type: string, useCapture?: boolean) => {
const fn = (e: Event) => emitter.fire(e);
const emitter = new Emitter<Event>({
onFirstListenerAdd: () => {
element.addEventListener(type, fn, useCapture);
},
onLastListenerRemove: () => {
element.removeEventListener(type, fn, useCapture);
}
});
return emitter.event;
};
export interface DOMEventMap extends HTMLElementEventMap {
export interface DOMEventMap extends HTMLElementEventMap, DocumentEventMap {
'-monaco-gesturetap': GestureEvent;
'-monaco-gesturechange': GestureEvent;
'-monaco-gesturestart': GestureEvent;
@@ -47,6 +30,8 @@ export class DomEmitter<K extends keyof DOMEventMap> implements IDisposable {
return this.emitter.event;
}
constructor(element: Document, type: DocumentEventMap, useCapture?: boolean);
constructor(element: EventHandler, type: K, useCapture?: boolean);
constructor(element: EventHandler, type: K, useCapture?: boolean) {
const fn = (e: Event) => this.emitter.fire(e as DOMEventMap[K]);
this.emitter = new Emitter({
+4 -4
View File
@@ -9,14 +9,14 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
export interface IContentActionHandler {
callback: (content: string, event?: IMouseEvent) => void;
readonly disposeables: DisposableStore;
readonly disposables: DisposableStore;
}
export interface FormattedTextRenderOptions {
readonly className?: string;
readonly inline?: boolean;
readonly actionHandler?: IContentActionHandler;
readonly renderCodeSegements?: boolean;
readonly renderCodeSegments?: boolean;
}
export function renderText(text: string, options: FormattedTextRenderOptions = {}): HTMLElement {
@@ -27,7 +27,7 @@ export function renderText(text: string, options: FormattedTextRenderOptions = {
export function renderFormattedText(formattedText: string, options: FormattedTextRenderOptions = {}): HTMLElement {
const element = createElement(options);
_renderFormattedText(element, parseFormattedText(formattedText, !!options.renderCodeSegements), options.actionHandler, options.renderCodeSegements);
_renderFormattedText(element, parseFormattedText(formattedText, !!options.renderCodeSegments), options.actionHandler, options.renderCodeSegments);
return element;
}
@@ -101,7 +101,7 @@ function _renderFormattedText(element: Node, treeNode: IFormatParseTree, actionH
} else if (treeNode.type === FormatType.Action && actionHandler) {
const a = document.createElement('a');
a.href = '#';
actionHandler.disposeables.add(DOM.addStandardDisposableListener(a, 'click', (event) => {
actionHandler.disposables.add(DOM.addStandardDisposableListener(a, 'click', (event) => {
actionHandler.callback(String(treeNode.index), event);
}));
@@ -6,7 +6,7 @@
import * as dom from 'vs/base/browser/dom';
import { IframeUtils } from 'vs/base/browser/iframe';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
import { isIOS } from 'vs/base/common/platform';
export interface IStandardMouseMoveEventData {
+20 -17
View File
@@ -4,23 +4,23 @@
*--------------------------------------------------------------------------------------------*/
import * as DOM from 'vs/base/browser/dom';
import { DomEmitter } from 'vs/base/browser/event';
import { createElement, FormattedTextRenderOptions } from 'vs/base/browser/formattedTextRenderer';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IMarkdownString, parseHrefAndDimensions, removeMarkdownEscapes } from 'vs/base/common/htmlContent';
import { defaultGenerator } from 'vs/base/common/idGenerator';
import * as marked from 'vs/base/common/marked/marked';
import { insane, InsaneOptions } from 'vs/base/common/insane/insane';
import { parse } from 'vs/base/common/marshalling';
import { cloneAndChange } from 'vs/base/common/objects';
import { escape } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { FileAccess, Schemas } from 'vs/base/common/network';
import { markdownEscapeEscapedIcons } from 'vs/base/common/iconLabels';
import { resolvePath } from 'vs/base/common/resources';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { onUnexpectedError } from 'vs/base/common/errors';
import { Event } from 'vs/base/common/event';
import { domEvent } from 'vs/base/browser/event';
import { IMarkdownString, parseHrefAndDimensions, removeMarkdownEscapes } from 'vs/base/common/htmlContent';
import { markdownEscapeEscapedIcons } from 'vs/base/common/iconLabels';
import { defaultGenerator } from 'vs/base/common/idGenerator';
import { insane, InsaneOptions } from 'vs/base/common/insane/insane';
import * as marked from 'vs/base/common/marked/marked';
import { parse } from 'vs/base/common/marshalling';
import { FileAccess, Schemas } from 'vs/base/common/network';
import { cloneAndChange } from 'vs/base/common/objects';
import { resolvePath } from 'vs/base/common/resources';
import { escape } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
export interface MarkedOptions extends marked.MarkedOptions {
baseUrl?: never;
@@ -73,9 +73,6 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
return href; // no uri exists
}
let uri = URI.revive(data);
if (URI.parse(href).toString() === uri.toString()) {
return href; // no tranformation performed
}
if (isDomUri) {
// this URI will end up as "src"-attribute of a dom node
// and because of that special rewriting needs to be done
@@ -83,6 +80,9 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
// browsers (like http or https)
return FileAccess.asBrowserUri(uri).toString(true);
}
if (URI.parse(href).toString() === uri.toString()) {
return href; // no transformation performed
}
if (uri.query) {
uri = uri.with({ query: _uriMassage(uri.query) });
}
@@ -189,7 +189,9 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
}
if (options.actionHandler) {
options.actionHandler.disposeables.add(Event.any<MouseEvent>(domEvent(element, 'click'), domEvent(element, 'auxclick'))(e => {
const onClick = options.actionHandler.disposables.add(new DomEmitter(element, 'click'));
const onAuxClick = options.actionHandler.disposables.add(new DomEmitter(element, 'auxclick'));
options.actionHandler.disposables.add(Event.any(onClick.event, onAuxClick.event)(e => {
const mouseEvent = new StandardMouseEvent(e);
if (!mouseEvent.leftButton && !mouseEvent.middleButton) {
return;
@@ -276,6 +278,7 @@ function getInsaneOptions(options: { readonly isTrusted?: boolean }): InsaneOpti
Schemas.mailto,
Schemas.data,
Schemas.file,
Schemas.vscodeFileResource,
Schemas.vscodeRemote,
Schemas.vscodeRemoteResource,
];
+4 -4
View File
@@ -3,10 +3,10 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as arrays from 'vs/base/common/arrays';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import * as DomUtils from 'vs/base/browser/dom';
import * as arrays from 'vs/base/common/arrays';
import { memoize } from 'vs/base/common/decorators';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
export namespace EventType {
export const Tap = '-monaco-gesturetap';
@@ -130,10 +130,10 @@ export class Gesture extends Disposable {
}
@memoize
private static isTouchDevice(): boolean {
static isTouchDevice(): boolean {
// `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be
// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || (window as Window).navigator.msMaxTouchPoints > 0;
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
}
public override dispose(): void {
@@ -3,19 +3,19 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./actionbar';
import * as platform from 'vs/base/common/platform';
import * as nls from 'vs/nls';
import { Disposable } from 'vs/base/common/lifecycle';
import { SelectBox, ISelectOptionItem, ISelectBoxOptions } from 'vs/base/browser/ui/selectBox/selectBox';
import { IAction, IActionRunner, Action, IActionChangeEvent, ActionRunner, Separator } from 'vs/base/common/actions';
import * as types from 'vs/base/common/types';
import { EventType as TouchEventType, Gesture } from 'vs/base/browser/touch';
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { DataTransfers } from 'vs/base/browser/dnd';
import { isFirefox } from 'vs/base/browser/browser';
import { DataTransfers } from 'vs/base/browser/dnd';
import { $, addDisposableListener, append, EventHelper, EventLike, EventType } from 'vs/base/browser/dom';
import { EventType as TouchEventType, Gesture } from 'vs/base/browser/touch';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { ISelectBoxOptions, ISelectOptionItem, SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { Action, ActionRunner, IAction, IActionChangeEvent, IActionRunner, Separator } from 'vs/base/common/actions';
import { Disposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import * as types from 'vs/base/common/types';
import 'vs/css!./actionbar';
import * as nls from 'vs/nls';
export interface IBaseActionViewItemOptions {
draggable?: boolean;
@@ -30,6 +30,10 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
_context: unknown;
_action: IAction;
get action() {
return this._action;
}
private _actionRunner: IActionRunner | undefined;
constructor(context: unknown, action: IAction, protected options: IBaseActionViewItemOptions = {}) {
@@ -117,7 +121,7 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
}
}
this._register(addDisposableListener(element, TouchEventType.Tap, e => this.onClick(e)));
this._register(addDisposableListener(element, TouchEventType.Tap, e => this.onClick(e, true))); // Preserve focus on tap #125470
this._register(addDisposableListener(element, EventType.MOUSE_DOWN, e => {
if (!enableDragging) {
@@ -162,10 +166,10 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
});
}
onClick(event: EventLike): void {
onClick(event: EventLike, preserveFocus = false): void {
EventHelper.stop(event, true);
const context = types.isUndefinedOrNull(this._context) ? this.options?.useEventAsContext ? event : undefined : this._context;
const context = types.isUndefinedOrNull(this._context) ? this.options?.useEventAsContext ? event : { preserveFocus } : this._context;
this.actionRunner.run(this._action, context);
}
+11 -6
View File
@@ -3,17 +3,18 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./actionbar';
import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IAction, IActionRunner, ActionRunner, IRunEvent, Separator } from 'vs/base/common/actions';
import * as DOM from 'vs/base/browser/dom';
import * as types from 'vs/base/common/types';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { ActionViewItem, BaseActionViewItem, IActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { ActionRunner, IAction, IActionRunner, IRunEvent, Separator } from 'vs/base/common/actions';
import { Emitter } from 'vs/base/common/event';
import { IActionViewItemOptions, ActionViewItem, BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as types from 'vs/base/common/types';
import 'vs/css!./actionbar';
export interface IActionViewItem extends IDisposable {
action: IAction;
actionRunner: IActionRunner;
setActionContext(context: unknown): void;
render(element: HTMLElement): void;
@@ -292,6 +293,10 @@ export class ActionBar extends Disposable implements IActionRunner {
return this._actionIds.includes(action.id);
}
getAction(index: number): IAction {
return this.viewItems[index].action;
}
push(arg: IAction | ReadonlyArray<IAction>, options: IActionOptions = {}): void {
const actions: ReadonlyArray<IAction> = Array.isArray(arg) ? arg : [arg];
+2 -2
View File
@@ -3,9 +3,9 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./aria';
import { isMacintosh } from 'vs/base/common/platform';
import * as dom from 'vs/base/browser/dom';
import { isMacintosh } from 'vs/base/common/platform';
import 'vs/css!./aria';
// Use a max length since we are inserting the whole msg in the DOM and that can cause browsers to freeze for long messages #94233
const MAX_MESSAGE_LENGTH = 20000;
@@ -7,11 +7,11 @@ import * as dom from 'vs/base/browser/dom';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { commonPrefixLength } from 'vs/base/common/arrays';
import { Codicon, registerCodicon } from 'vs/base/common/codicons';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose, IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { DisposableStore, dispose, IDisposable } from 'vs/base/common/lifecycle';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { Codicon, registerCodicon } from 'vs/base/common/codicons';
import 'vs/css!./breadcrumbsWidget';
export abstract class BreadcrumbsItem {
+11 -11
View File
@@ -3,19 +3,19 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./button';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects';
import { Event as BaseEvent, Emitter } from 'vs/base/common/event';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { Gesture, EventType as TouchEventType } from 'vs/base/browser/touch';
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { addDisposableListener, IFocusTracker, EventType, EventHelper, trackFocus, reset, removeTabIndexAndUpdateFocus } from 'vs/base/browser/dom'; // {{SQL CARBON EDIT}}
import { IContextMenuProvider } from 'vs/base/browser/contextmenu';
import { addDisposableListener, EventHelper, EventType, IFocusTracker, removeTabIndexAndUpdateFocus, reset, trackFocus } from 'vs/base/browser/dom'; // {{SQL CARBON EDIT}} Add removeTabIndexAndUpdateFocus
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { EventType as TouchEventType, Gesture } from 'vs/base/browser/touch';
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
import { CSSIcon, Codicon } from 'vs/base/common/codicons';
import { Codicon, CSSIcon } from 'vs/base/common/codicons';
import { Color } from 'vs/base/common/color';
import { Emitter, Event as BaseEvent } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { mixin } from 'vs/base/common/objects';
import 'vs/css!./button';
export interface IButtonOptions extends IButtonStyles {
readonly title?: boolean | string;
@@ -3,13 +3,13 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SplitView, Orientation, ISplitViewStyles, IView as ISplitViewView } from 'vs/base/browser/ui/splitview/splitview';
import { $ } from 'vs/base/browser/dom';
import { Event } from 'vs/base/common/event';
import { IView, IViewSize } from 'vs/base/browser/ui/grid/grid';
import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { Color } from 'vs/base/common/color';
import { IBoundarySashes } from 'vs/base/browser/ui/grid/gridview';
import { ISplitViewStyles, IView as ISplitViewView, Orientation, SplitView } from 'vs/base/browser/ui/splitview/splitview';
import { Color } from 'vs/base/common/color';
import { Event } from 'vs/base/common/event';
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
export interface CenteredViewState {
leftMarginRatio: number;
+24 -35
View File
@@ -3,15 +3,15 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./checkbox';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { BaseActionViewItem, IActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { Widget } from 'vs/base/browser/ui/widget';
import { IAction } from 'vs/base/common/actions';
import { Codicon, CSSIcon } from 'vs/base/common/codicons';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { Codicon, CSSIcon } from 'vs/base/common/codicons';
import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
import 'vs/css!./checkbox';
export interface ICheckboxOpts extends ICheckboxStyles {
readonly actionClassName?: string;
@@ -41,21 +41,21 @@ const defaultOpts = {
export class CheckboxActionViewItem extends BaseActionViewItem {
protected checkbox: Checkbox | undefined;
protected readonly disposables = new DisposableStore();
protected readonly checkbox: Checkbox;
constructor(context: any, action: IAction, options: IActionViewItemOptions | undefined) {
super(context, action, options);
this.checkbox = this._register(new Checkbox({
actionClassName: this._action.class,
isChecked: this._action.checked,
title: (<IActionViewItemOptions>this.options).keybinding ? `${this._action.label} (${(<IActionViewItemOptions>this.options).keybinding})` : this._action.label,
notFocusable: true
}));
this._register(this.checkbox.onChange(() => this._action.checked = !!this.checkbox && this.checkbox.checked));
}
override render(container: HTMLElement): void {
this.element = container;
this.disposables.clear();
this.checkbox = new Checkbox({
actionClassName: this._action.class,
isChecked: this._action.checked,
title: this._action.label,
notFocusable: true
});
this.disposables.add(this.checkbox);
this.disposables.add(this.checkbox.onChange(() => this._action.checked = !!this.checkbox && this.checkbox.checked, this));
this.element.appendChild(this.checkbox.domNode);
}
@@ -70,35 +70,23 @@ export class CheckboxActionViewItem extends BaseActionViewItem {
}
override updateChecked(): void {
if (this.checkbox) {
this.checkbox.checked = this._action.checked;
}
this.checkbox.checked = this._action.checked;
}
override focus(): void {
if (this.checkbox) {
this.checkbox.domNode.tabIndex = 0;
this.checkbox.focus();
}
this.checkbox.domNode.tabIndex = 0;
this.checkbox.focus();
}
override blur(): void {
if (this.checkbox) {
this.checkbox.domNode.tabIndex = -1;
this.checkbox.domNode.blur();
}
this.checkbox.domNode.tabIndex = -1;
this.checkbox.domNode.blur();
}
override setFocusable(focusable: boolean): void {
if (this.checkbox) {
this.checkbox.domNode.tabIndex = focusable ? 0 : -1;
}
this.checkbox.domNode.tabIndex = focusable ? 0 : -1;
}
override dispose(): void {
this.disposables.dispose();
super.dispose();
}
}
export class Checkbox extends Widget {
@@ -185,7 +173,7 @@ export class Checkbox extends Widget {
}
width(): number {
return 2 /*marginleft*/ + 2 /*border*/ + 2 /*padding*/ + 16 /* icon width */;
return 2 /*margin left*/ + 2 /*border*/ + 2 /*padding*/ + 16 /* icon width */;
}
style(styles: ICheckboxStyles): void {
@@ -216,6 +204,7 @@ export class Checkbox extends Widget {
disable(): void {
this.domNode.setAttribute('aria-disabled', String(true));
}
}
export class SimpleCheckbox extends Widget {
Binary file not shown.
@@ -3,10 +3,10 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Codicon } from 'vs/base/common/codicons';
import 'vs/css!./codicon/codicon';
import 'vs/css!./codicon/codicon-modifiers';
import { Codicon } from 'vs/base/common/codicons';
export function formatRule(c: Codicon) {
let def = c.definition;
@@ -3,12 +3,12 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./contextview';
import * as DOM from 'vs/base/browser/dom';
import * as platform from 'vs/base/common/platform';
import { IDisposable, toDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { Range } from 'vs/base/common/range';
import { BrowserFeatures } from 'vs/base/browser/canIUse';
import * as DOM from 'vs/base/browser/dom';
import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import { Range } from 'vs/base/common/range';
import 'vs/css!./contextview';
export const enum ContextViewDOMPosition {
ABSOLUTE = 1,
@@ -3,12 +3,12 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./countBadge';
import { $, append } from 'vs/base/browser/dom';
import { format } from 'vs/base/common/strings';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects';
import { format } from 'vs/base/common/strings';
import { IThemable } from 'vs/base/common/styler';
import 'vs/css!./countBadge';
export interface ICountBadgeOptions extends ICountBadgetyles {
count?: number;
+5
View File
@@ -118,6 +118,11 @@
flex: 1;
}
/** Dialog: File Path */
.monaco-dialog-box code {
font-family: var(--monaco-monospace-font);
}
/** Dialog: Buttons Row */
.monaco-dialog-box > .dialog-buttons-row {
display: flex;
+26 -24
View File
@@ -3,22 +3,21 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { $, addDisposableListener, clearNode, EventHelper, EventType, hide, isAncestor, show } from 'vs/base/browser/dom';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { ButtonBar, ButtonWithDescription, IButtonStyles } from 'vs/base/browser/ui/button/button';
import { ISimpleCheckboxStyles, SimpleCheckbox } from 'vs/base/browser/ui/checkbox/checkbox';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { Action } from 'vs/base/common/actions';
import { Codicon, registerCodicon } from 'vs/base/common/codicons';
import { Color } from 'vs/base/common/color';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
import { Disposable } from 'vs/base/common/lifecycle';
import { isLinux, isMacintosh } from 'vs/base/common/platform';
import 'vs/css!./dialog';
import * as nls from 'vs/nls';
import { Disposable } from 'vs/base/common/lifecycle';
import { $, hide, show, EventHelper, clearNode, isAncestor, addDisposableListener, EventType } from 'vs/base/browser/dom';
import { domEvent } from 'vs/base/browser/event';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { Color } from 'vs/base/common/color';
import { ButtonBar, ButtonWithDescription, IButtonStyles } from 'vs/base/browser/ui/button/button';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
import { isMacintosh, isLinux } from 'vs/base/common/platform';
import { SimpleCheckbox, ISimpleCheckboxStyles } from 'vs/base/browser/ui/checkbox/checkbox';
import { Codicon, registerCodicon } from 'vs/base/common/codicons';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
export interface IDialogInputOptions {
readonly placeholder?: string;
@@ -94,6 +93,7 @@ export class Dialog extends Disposable {
this.shadowElement = this.modalElement.appendChild($('.dialog-shadow'));
this.element = this.shadowElement.appendChild($('.monaco-dialog-box'));
this.element.setAttribute('role', 'dialog');
this.element.tabIndex = -1;
hide(this.element);
this.buttons = Array.isArray(buttons) && buttons.length ? buttons : [nls.localize('ok', "OK")]; // If no button is provided, default to OK
@@ -219,8 +219,8 @@ export class Dialog extends Disposable {
}));
});
// Handle keyboard events gloably: Tab, Arrow-Left/Right
this._register(domEvent(window, 'keydown', true)((e: KeyboardEvent) => {
// Handle keyboard events globally: Tab, Arrow-Left/Right
this._register(addDisposableListener(window, 'keydown', e => {
const evt = new StandardKeyboardEvent(e);
if (evt.equals(KeyMod.Alt)) {
@@ -321,9 +321,9 @@ export class Dialog extends Disposable {
} else if (this.options.keyEventProcessor) {
this.options.keyEventProcessor(evt);
}
}));
}, true));
this._register(domEvent(window, 'keyup', true)((e: KeyboardEvent) => {
this._register(addDisposableListener(window, 'keyup', e => {
EventHelper.stop(e, true);
const evt = new StandardKeyboardEvent(e);
@@ -333,10 +333,10 @@ export class Dialog extends Disposable {
checkboxChecked: this.checkbox ? this.checkbox.checked : undefined
});
}
}));
}, true));
// Detect focus out
this._register(domEvent(this.element, 'focusout', false)((e: FocusEvent) => {
this._register(addDisposableListener(this.element, 'focusout', e => {
if (!!e.relatedTarget && !!this.element) {
if (!isAncestor(e.relatedTarget as HTMLElement, this.element)) {
this.focusToReturn = e.relatedTarget as HTMLElement;
@@ -347,7 +347,7 @@ export class Dialog extends Disposable {
}
}
}
}));
}, false));
const spinModifierClassName = 'codicon-modifier-spin';
@@ -391,7 +391,9 @@ export class Dialog extends Disposable {
this.applyStyles();
this.element.setAttribute('aria-labelledby', 'monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body');
this.element.setAttribute('aria-modal', 'true');
this.element.setAttribute('aria-labelledby', 'monaco-dialog-icon monaco-dialog-message-text');
this.element.setAttribute('aria-describedby', 'monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body');
show(this.element);
// Focus first element (input or button)
@@ -493,9 +495,9 @@ export class Dialog extends Disposable {
buttonMap.push({ label: button, index });
});
// macOS/linux: reverse button order
// macOS/linux: reverse button order if `cancelId` is defined
if (isMacintosh || isLinux) {
if (cancelId !== undefined) {
if (cancelId !== undefined && cancelId < buttons.length) {
const cancelButton = buttonMap.splice(cancelId, 1)[0];
buttonMap.reverse();
buttonMap.splice(buttonMap.length - 1, 0, cancelButton);
+1 -1
View File
@@ -35,7 +35,7 @@
padding-left: 0px;
padding-right: 0px;
line-height: 16px;
margin-left: -4px;
margin-left: -3px;
}
.monaco-dropdown-with-primary > .dropdown-action-container > .monaco-dropdown > .dropdown-label > .action-label {
+8 -8
View File
@@ -3,17 +3,17 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./dropdown';
import { Gesture, EventType as GestureEventType } from 'vs/base/browser/touch';
import { ActionRunner, IAction } from 'vs/base/common/actions';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IContextViewProvider, IAnchor, AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { IMenuOptions } from 'vs/base/browser/ui/menu/menu';
import { KeyCode } from 'vs/base/common/keyCodes';
import { EventHelper, EventType, append, $, addDisposableListener, DOMEvent } from 'vs/base/browser/dom';
import { IContextMenuProvider } from 'vs/base/browser/contextmenu';
import { $, addDisposableListener, append, DOMEvent, EventHelper, EventType } from 'vs/base/browser/dom';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { EventType as GestureEventType, Gesture } from 'vs/base/browser/touch';
import { AnchorAlignment, IAnchor, IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { IMenuOptions } from 'vs/base/browser/ui/menu/menu';
import { ActionRunner, IAction } from 'vs/base/common/actions';
import { Emitter } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import { IDisposable } from 'vs/base/common/lifecycle';
import 'vs/css!./dropdown';
export interface ILabelRenderer {
(container: HTMLElement): IDisposable | null;
@@ -3,19 +3,19 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./dropdown';
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
import { IDisposable } from 'vs/base/common/lifecycle';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { KeyCode, ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { append, $, addDisposableListener, EventType } from 'vs/base/browser/dom';
import { Emitter } from 'vs/base/common/event';
import { ActionViewItem, BaseActionViewItem, IActionViewItemOptions, IBaseActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { IActionProvider, DropdownMenu, IDropdownMenuOptions, ILabelRenderer } from 'vs/base/browser/ui/dropdown/dropdown';
import { IContextMenuProvider } from 'vs/base/browser/contextmenu';
import { Codicon } from 'vs/base/common/codicons';
import { IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { $, addDisposableListener, append, EventType } from 'vs/base/browser/dom';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionViewItem, BaseActionViewItem, IActionViewItemOptions, IBaseActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { DropdownMenu, IActionProvider, IDropdownMenuOptions, ILabelRenderer } from 'vs/base/browser/ui/dropdown/dropdown';
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
import { Codicon } from 'vs/base/common/codicons';
import { Emitter } from 'vs/base/common/event';
import { KeyCode, ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { IDisposable } from 'vs/base/common/lifecycle';
import 'vs/css!./dropdown';
export interface IKeybindingProvider {
(action: IAction): ResolvedKeybinding | undefined;

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