Archived
Merge VS Code 1.30.1 (#4092)
This commit is contained in:
Vendored
+26
-61
@@ -3,88 +3,53 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var loader = require('./vs/loader');
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
function uriFromPath(_path) {
|
||||
var pathName = path.resolve(_path).replace(/\\/g, '/');
|
||||
const loader = require('./vs/loader');
|
||||
const bootstrap = require('./bootstrap');
|
||||
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
pathName = '/' + pathName;
|
||||
}
|
||||
|
||||
return encodeURI('file://' + pathName);
|
||||
}
|
||||
|
||||
function readFile(file) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
fs.readFile(file, 'utf8', function (err, data) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const writeFile = (file, content) => new Promise((c, e) => fs.writeFile(file, content, 'utf8', err => err ? e(err) : c()));
|
||||
|
||||
var rawNlsConfig = process.env['VSCODE_NLS_CONFIG'];
|
||||
var nlsConfig = rawNlsConfig ? JSON.parse(rawNlsConfig) : { availableLanguages: {} };
|
||||
|
||||
// We have a special location of the nls files. They come from a language pack
|
||||
if (nlsConfig._resolvedLanguagePackCoreLocation) {
|
||||
let bundles = Object.create(null);
|
||||
nlsConfig.loadBundle = function (bundle, language, cb) {
|
||||
let result = bundles[bundle];
|
||||
if (result) {
|
||||
cb(undefined, result);
|
||||
return;
|
||||
}
|
||||
let bundleFile = path.join(nlsConfig._resolvedLanguagePackCoreLocation, bundle.replace(/\//g, '!') + '.nls.json');
|
||||
readFile(bundleFile).then(function (content) {
|
||||
let json = JSON.parse(content);
|
||||
bundles[bundle] = json;
|
||||
cb(undefined, json);
|
||||
}).catch((error) => {
|
||||
try {
|
||||
if (nlsConfig._corruptedFile) {
|
||||
writeFile(nlsConfig._corruptedFile, 'corrupted').catch(function (error) { console.error(error); });
|
||||
}
|
||||
} finally {
|
||||
cb(error, undefined);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
// Bootstrap: NLS
|
||||
const nlsConfig = bootstrap.setupNLS();
|
||||
|
||||
// Bootstrap: Loader
|
||||
loader.config({
|
||||
baseUrl: uriFromPath(__dirname),
|
||||
baseUrl: bootstrap.uriFromPath(__dirname),
|
||||
catchError: true,
|
||||
nodeRequire: require,
|
||||
nodeMain: __filename,
|
||||
'vs/nls': nlsConfig,
|
||||
nodeCachedDataDir: process.env['VSCODE_NODE_CACHED_DATA_DIR_' + process.pid]
|
||||
'vs/nls': nlsConfig
|
||||
});
|
||||
|
||||
if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions.electron) {
|
||||
// running in Electron
|
||||
loader.define('fs', ['original-fs'], function (originalFS) { return originalFS; }); // replace the patched electron fs with the original node fs for all AMD code
|
||||
// Running in Electron
|
||||
if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {
|
||||
loader.define('fs', ['original-fs'], function (originalFS) {
|
||||
return originalFS; // replace the patched electron fs with the original node fs for all AMD code
|
||||
});
|
||||
}
|
||||
|
||||
// Pseudo NLS support
|
||||
if (nlsConfig.pseudo) {
|
||||
loader(['vs/nls'], function (nlsPlugin) {
|
||||
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
|
||||
});
|
||||
}
|
||||
|
||||
exports.bootstrap = function (entrypoint, onLoad, onError) {
|
||||
exports.load = function (entrypoint, onLoad, onError) {
|
||||
if (!entrypoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
// cached data config
|
||||
if (process.env['VSCODE_NODE_CACHED_DATA_DIR']) {
|
||||
loader.config({
|
||||
nodeCachedData: {
|
||||
path: process.env['VSCODE_NODE_CACHED_DATA_DIR'],
|
||||
seed: entrypoint
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onLoad = onLoad || function () { };
|
||||
onError = onError || function (err) { console.error(err); };
|
||||
|
||||
|
||||
Vendored
+197
@@ -0,0 +1,197 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
const bootstrap = require('./bootstrap');
|
||||
|
||||
// Enable ASAR in our forked processes
|
||||
bootstrap.enableASARSupport();
|
||||
|
||||
// Configure: pipe logging to parent process
|
||||
if (!!process.send && process.env.PIPE_LOGGING === 'true') {
|
||||
pipeLoggingToParent();
|
||||
}
|
||||
|
||||
// Disable IO if configured
|
||||
if (!process.env['VSCODE_ALLOW_IO']) {
|
||||
disableSTDIO();
|
||||
}
|
||||
|
||||
// Handle Exceptions
|
||||
if (!process.env['VSCODE_HANDLES_UNCAUGHT_ERRORS']) {
|
||||
handleExceptions();
|
||||
}
|
||||
|
||||
// Terminate when parent terminates
|
||||
if (process.env['VSCODE_PARENT_PID']) {
|
||||
terminateWhenParentTerminates();
|
||||
}
|
||||
|
||||
// Configure Crash Reporter
|
||||
configureCrashReporter();
|
||||
|
||||
// Load AMD entry point
|
||||
require('./bootstrap-amd').load(process.env['AMD_ENTRYPOINT']);
|
||||
|
||||
//#region Helpers
|
||||
|
||||
function pipeLoggingToParent() {
|
||||
const MAX_LENGTH = 100000;
|
||||
|
||||
// Prevent circular stringify and convert arguments to real array
|
||||
function safeToArray(args) {
|
||||
const seen = [];
|
||||
const argsArray = [];
|
||||
|
||||
let res;
|
||||
|
||||
// Massage some arguments with special treatment
|
||||
if (args.length) {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
|
||||
// Any argument of type 'undefined' needs to be specially treated because
|
||||
// JSON.stringify will simply ignore those. We replace them with the string
|
||||
// 'undefined' which is not 100% right, but good enough to be logged to console
|
||||
if (typeof args[i] === 'undefined') {
|
||||
args[i] = 'undefined';
|
||||
}
|
||||
|
||||
// Any argument that is an Error will be changed to be just the error stack/message
|
||||
// itself because currently cannot serialize the error over entirely.
|
||||
else if (args[i] instanceof Error) {
|
||||
const errorObj = args[i];
|
||||
if (errorObj.stack) {
|
||||
args[i] = errorObj.stack;
|
||||
} else {
|
||||
args[i] = errorObj.toString();
|
||||
}
|
||||
}
|
||||
|
||||
argsArray.push(args[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the stack trace as payload if we are told so. We remove the message and the 2 top frames
|
||||
// to start the stacktrace where the console message was being written
|
||||
if (process.env.VSCODE_LOG_STACK === 'true') {
|
||||
const stack = new Error().stack;
|
||||
argsArray.push({ __$stack: stack.split('\n').slice(3).join('\n') });
|
||||
}
|
||||
|
||||
try {
|
||||
res = JSON.stringify(argsArray, function (key, value) {
|
||||
|
||||
// Objects get special treatment to prevent circles
|
||||
if (isObject(value) || Array.isArray(value)) {
|
||||
if (seen.indexOf(value) !== -1) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
seen.push(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
});
|
||||
} catch (error) {
|
||||
return 'Output omitted for an object that cannot be inspected (' + error.toString() + ')';
|
||||
}
|
||||
|
||||
if (res && res.length > MAX_LENGTH) {
|
||||
return 'Output omitted for a large object that exceeds the limits';
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
function safeSend(arg) {
|
||||
try {
|
||||
process.send(arg);
|
||||
} catch (error) {
|
||||
// Can happen if the parent channel is closed meanwhile
|
||||
}
|
||||
}
|
||||
|
||||
function isObject(obj) {
|
||||
return typeof obj === 'object'
|
||||
&& obj !== null
|
||||
&& !Array.isArray(obj)
|
||||
&& !(obj instanceof RegExp)
|
||||
&& !(obj instanceof Date);
|
||||
}
|
||||
|
||||
// Pass console logging to the outside so that we have it in the main side if told so
|
||||
if (process.env.VERBOSE_LOGGING === 'true') {
|
||||
console.log = function () { safeSend({ type: '__$console', severity: 'log', arguments: safeToArray(arguments) }); };
|
||||
console.info = function () { safeSend({ type: '__$console', severity: 'log', arguments: safeToArray(arguments) }); };
|
||||
console.warn = function () { safeSend({ type: '__$console', severity: 'warn', arguments: safeToArray(arguments) }); };
|
||||
} else {
|
||||
console.log = function () { /* ignore */ };
|
||||
console.warn = function () { /* ignore */ };
|
||||
console.info = function () { /* ignore */ };
|
||||
}
|
||||
|
||||
console.error = function () { safeSend({ type: '__$console', severity: 'error', arguments: safeToArray(arguments) }); };
|
||||
}
|
||||
|
||||
function disableSTDIO() {
|
||||
|
||||
// const stdout, stderr and stdin be no-op streams. This prevents an issue where we would get an EBADF
|
||||
// error when we are inside a forked process and this process tries to access those channels.
|
||||
const stream = require('stream');
|
||||
const writable = new stream.Writable({
|
||||
write: function () { /* No OP */ }
|
||||
});
|
||||
|
||||
process['__defineGetter__']('stdout', function () { return writable; });
|
||||
process['__defineGetter__']('stderr', function () { return writable; });
|
||||
process['__defineGetter__']('stdin', function () { return writable; });
|
||||
}
|
||||
|
||||
function handleExceptions() {
|
||||
|
||||
// Handle uncaught exceptions
|
||||
// @ts-ignore
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.error('Uncaught Exception: ', err);
|
||||
});
|
||||
|
||||
// Handle unhandled promise rejections
|
||||
// @ts-ignore
|
||||
process.on('unhandledRejection', function (reason) {
|
||||
console.error('Unhandled Promise Rejection: ', reason);
|
||||
});
|
||||
}
|
||||
|
||||
function terminateWhenParentTerminates() {
|
||||
const parentPid = Number(process.env['VSCODE_PARENT_PID']);
|
||||
|
||||
if (typeof parentPid === 'number' && !isNaN(parentPid)) {
|
||||
setInterval(function () {
|
||||
try {
|
||||
process.kill(parentPid, 0); // throws an exception if the main process doesn't exist anymore.
|
||||
} catch (e) {
|
||||
process.exit();
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
function configureCrashReporter() {
|
||||
const crashReporterOptionsRaw = process.env['CRASH_REPORTER_START_OPTIONS'];
|
||||
if (typeof crashReporterOptionsRaw === 'string') {
|
||||
try {
|
||||
const crashReporterOptions = JSON.parse(crashReporterOptionsRaw);
|
||||
if (crashReporterOptions) {
|
||||
process['crashReporter'].start(crashReporterOptions);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
Vendored
+255
@@ -0,0 +1,255 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
const bootstrap = require('./bootstrap');
|
||||
|
||||
/**
|
||||
* @param {object} destination
|
||||
* @param {object} source
|
||||
* @returns {object}
|
||||
*/
|
||||
exports.assign = function assign(destination, source) {
|
||||
return Object.keys(source).reduce(function (r, key) { r[key] = source[key]; return r; }, destination);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string[]} modulePaths
|
||||
* @param {(result, configuration: object) => any} resultCallback
|
||||
* @param {{ forceEnableDeveloperKeybindings?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean, canModifyDOM?: (config: object) => void, beforeLoaderConfig?: (config: object, loaderConfig: object) => void, beforeRequire?: () => void }=} options
|
||||
*/
|
||||
exports.load = function (modulePaths, resultCallback, options) {
|
||||
|
||||
// @ts-ignore
|
||||
const webFrame = require('electron').webFrame;
|
||||
const path = require('path');
|
||||
|
||||
const args = parseURLQueryArgs();
|
||||
const configuration = JSON.parse(args['config'] || '{}') || {};
|
||||
|
||||
// Error handler
|
||||
// @ts-ignore
|
||||
process.on('uncaughtException', function (error) {
|
||||
onUnexpectedError(error, enableDeveloperTools);
|
||||
});
|
||||
|
||||
// Developer tools
|
||||
const enableDeveloperTools = (process.env['VSCODE_DEV'] || !!configuration.extensionDevelopmentPath) && !configuration.extensionTestsPath;
|
||||
let developerToolsUnbind;
|
||||
if (enableDeveloperTools || (options && options.forceEnableDeveloperKeybindings)) {
|
||||
developerToolsUnbind = registerDeveloperKeybindings();
|
||||
}
|
||||
|
||||
// Correctly inherit the parent's environment
|
||||
exports.assign(process.env, configuration.userEnv);
|
||||
|
||||
// Enable ASAR support
|
||||
bootstrap.enableASARSupport(path.join(configuration.appRoot, 'node_modules'));
|
||||
|
||||
// disable pinch zoom & apply zoom level early to avoid glitches
|
||||
const zoomLevel = configuration.zoomLevel;
|
||||
webFrame.setVisualZoomLevelLimits(1, 1);
|
||||
if (typeof zoomLevel === 'number' && zoomLevel !== 0) {
|
||||
webFrame.setZoomLevel(zoomLevel);
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// Load the loader and start loading the workbench
|
||||
function createScript(src, onload) {
|
||||
const script = document.createElement('script');
|
||||
script.src = src;
|
||||
script.addEventListener('load', onload);
|
||||
|
||||
const head = document.getElementsByTagName('head')[0];
|
||||
head.insertBefore(script, head.lastChild);
|
||||
}
|
||||
|
||||
function uriFromPath(_path) {
|
||||
var pathName = path.resolve(_path).replace(/\\/g, '/');
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
pathName = '/' + pathName;
|
||||
}
|
||||
|
||||
return encodeURI('file://' + pathName);
|
||||
}
|
||||
|
||||
const appRoot = uriFromPath(configuration.appRoot);
|
||||
|
||||
createScript(appRoot + '/node_modules/chart.js/dist/Chart.js', undefined);
|
||||
// {{SQL CARBON EDIT}} - End
|
||||
|
||||
if (options && typeof options.canModifyDOM === 'function') {
|
||||
options.canModifyDOM(configuration);
|
||||
}
|
||||
|
||||
// Get the nls configuration into the process.env as early as possible.
|
||||
const nlsConfig = bootstrap.setupNLS();
|
||||
|
||||
let locale = nlsConfig.availableLanguages['*'] || 'en';
|
||||
if (locale === 'zh-tw') {
|
||||
locale = 'zh-Hant';
|
||||
} else if (locale === 'zh-cn') {
|
||||
locale = 'zh-Hans';
|
||||
}
|
||||
|
||||
window.document.documentElement.setAttribute('lang', locale);
|
||||
|
||||
// Load the loader
|
||||
const amdLoader = require(configuration.appRoot + '/out/vs/loader.js');
|
||||
const amdRequire = amdLoader.require;
|
||||
const amdDefine = amdLoader.require.define;
|
||||
const nodeRequire = amdLoader.require.nodeRequire;
|
||||
|
||||
window['nodeRequire'] = nodeRequire;
|
||||
window['require'] = amdRequire;
|
||||
|
||||
// replace the patched electron fs with the original node fs for all AMD code
|
||||
amdDefine('fs', ['original-fs'], function (originalFS) { return originalFS; });
|
||||
|
||||
window['MonacoEnvironment'] = {};
|
||||
|
||||
const loaderConfig = {
|
||||
baseUrl: bootstrap.uriFromPath(configuration.appRoot) + '/out',
|
||||
'vs/nls': nlsConfig,
|
||||
nodeModules: [/*BUILD->INSERT_NODE_MODULES*/]
|
||||
};
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
require('reflect-metadata');
|
||||
loaderConfig.nodeModules = loaderConfig.nodeModules.concat([
|
||||
'@angular/common',
|
||||
'@angular/core',
|
||||
'@angular/forms',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'angular2-grid',
|
||||
'ansi_up',
|
||||
'pretty-data',
|
||||
'html-query-plan',
|
||||
'ng2-charts/ng2-charts',
|
||||
'rxjs/Observable',
|
||||
'rxjs/Subject',
|
||||
'rxjs/Observer',
|
||||
'htmlparser2',
|
||||
'sanitize'
|
||||
]);
|
||||
// {{SQL CARBON EDIT}} - End
|
||||
|
||||
// cached data config
|
||||
if (configuration.nodeCachedDataDir) {
|
||||
loaderConfig.nodeCachedData = {
|
||||
path: configuration.nodeCachedDataDir,
|
||||
seed: modulePaths.join('')
|
||||
};
|
||||
}
|
||||
|
||||
if (options && typeof options.beforeLoaderConfig === 'function') {
|
||||
options.beforeLoaderConfig(configuration, loaderConfig);
|
||||
}
|
||||
|
||||
amdRequire.config(loaderConfig);
|
||||
|
||||
if (nlsConfig.pseudo) {
|
||||
amdRequire(['vs/nls'], function (nlsPlugin) {
|
||||
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
|
||||
});
|
||||
}
|
||||
|
||||
if (options && typeof options.beforeRequire === 'function') {
|
||||
options.beforeRequire();
|
||||
}
|
||||
|
||||
amdRequire(modulePaths, result => {
|
||||
try {
|
||||
const callbackResult = resultCallback(result, configuration);
|
||||
if (callbackResult && typeof callbackResult.then === 'function') {
|
||||
callbackResult.then(() => {
|
||||
if (developerToolsUnbind && options && options.removeDeveloperKeybindingsAfterLoad) {
|
||||
developerToolsUnbind();
|
||||
}
|
||||
}, error => {
|
||||
onUnexpectedError(error, enableDeveloperTools);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
onUnexpectedError(error, enableDeveloperTools);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {{[param: string]: string }}
|
||||
*/
|
||||
function parseURLQueryArgs() {
|
||||
const search = window.location.search || '';
|
||||
|
||||
return search.split(/[?&]/)
|
||||
.filter(function (param) { return !!param; })
|
||||
.map(function (param) { return param.split('='); })
|
||||
.filter(function (param) { return param.length === 2; })
|
||||
.reduce(function (r, param) { r[param[0]] = decodeURIComponent(param[1]); return r; }, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {() => void}
|
||||
*/
|
||||
function registerDeveloperKeybindings() {
|
||||
|
||||
// @ts-ignore
|
||||
const ipc = require('electron').ipcRenderer;
|
||||
|
||||
const extractKey = function (e) {
|
||||
return [
|
||||
e.ctrlKey ? 'ctrl-' : '',
|
||||
e.metaKey ? 'meta-' : '',
|
||||
e.altKey ? 'alt-' : '',
|
||||
e.shiftKey ? 'shift-' : '',
|
||||
e.keyCode
|
||||
].join('');
|
||||
};
|
||||
|
||||
// Devtools & reload support
|
||||
const TOGGLE_DEV_TOOLS_KB = (process.platform === 'darwin' ? 'meta-alt-73' : 'ctrl-shift-73'); // mac: Cmd-Alt-I, rest: Ctrl-Shift-I
|
||||
const TOGGLE_DEV_TOOLS_KB_ALT = '123'; // F12
|
||||
const RELOAD_KB = (process.platform === 'darwin' ? 'meta-82' : 'ctrl-82'); // mac: Cmd-R, rest: Ctrl-R
|
||||
|
||||
let listener = function (e) {
|
||||
const key = extractKey(e);
|
||||
if (key === TOGGLE_DEV_TOOLS_KB || key === TOGGLE_DEV_TOOLS_KB_ALT) {
|
||||
ipc.send('vscode:toggleDevTools');
|
||||
} else if (key === RELOAD_KB) {
|
||||
ipc.send('vscode:reloadWindow');
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', listener);
|
||||
|
||||
return function () {
|
||||
if (listener) {
|
||||
window.removeEventListener('keydown', listener);
|
||||
listener = void 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function onUnexpectedError(error, enableDeveloperTools) {
|
||||
|
||||
// @ts-ignore
|
||||
const ipc = require('electron').ipcRenderer;
|
||||
|
||||
if (enableDeveloperTools) {
|
||||
ipc.send('vscode:openDevTools');
|
||||
}
|
||||
|
||||
console.error('[uncaught exception]: ' + error);
|
||||
|
||||
if (error.stack) {
|
||||
console.error(error.stack);
|
||||
}
|
||||
}
|
||||
Vendored
+186
-124
@@ -3,14 +3,43 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
//#region global bootstrapping
|
||||
|
||||
// increase number of stack frames(from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
|
||||
Error.stackTraceLimit = 100;
|
||||
|
||||
// Workaround for Electron not installing a handler to ignore SIGPIPE
|
||||
// (https://github.com/electron/electron/issues/13254)
|
||||
// @ts-ignore
|
||||
process.on('SIGPIPE', () => {
|
||||
console.error(new Error('Unexpected SIGPIPE'));
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Add support for using node_modules.asar
|
||||
(function () {
|
||||
const path = require('path');
|
||||
/**
|
||||
* @param {string=} nodeModulesPath
|
||||
*/
|
||||
exports.enableASARSupport = function (nodeModulesPath) {
|
||||
|
||||
// @ts-ignore
|
||||
const Module = require('module');
|
||||
const NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
|
||||
const path = require('path');
|
||||
|
||||
let NODE_MODULES_PATH = nodeModulesPath;
|
||||
if (!NODE_MODULES_PATH) {
|
||||
NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
|
||||
}
|
||||
|
||||
const NODE_MODULES_ASAR_PATH = NODE_MODULES_PATH + '.asar';
|
||||
|
||||
// @ts-ignore
|
||||
const originalResolveLookupPaths = Module._resolveLookupPaths;
|
||||
// @ts-ignore
|
||||
Module._resolveLookupPaths = function (request, parent, newReturn) {
|
||||
const result = originalResolveLookupPaths(request, parent, newReturn);
|
||||
|
||||
@@ -24,149 +53,182 @@
|
||||
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
};
|
||||
//#endregion
|
||||
|
||||
// Will be defined if we got forked from another node process
|
||||
// In that case we override console.log/warn/error to be able
|
||||
// to send loading issues to the main side for logging.
|
||||
if (!!process.send && process.env.PIPE_LOGGING === 'true') {
|
||||
var MAX_LENGTH = 100000;
|
||||
//#region URI helpers
|
||||
/**
|
||||
* @param {string} _path
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.uriFromPath = function (_path) {
|
||||
const path = require('path');
|
||||
|
||||
// Prevent circular stringify and convert arguments to real array
|
||||
function safeToArray(args) {
|
||||
var seen = [];
|
||||
var res;
|
||||
var argsArray = [];
|
||||
let pathName = path.resolve(_path).replace(/\\/g, '/');
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
pathName = '/' + pathName;
|
||||
}
|
||||
|
||||
// Massage some arguments with special treatment
|
||||
if (args.length) {
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
return encodeURI('file://' + pathName).replace(/#/g, '%23');
|
||||
};
|
||||
//#endregion
|
||||
|
||||
// Any argument of type 'undefined' needs to be specially treated because
|
||||
// JSON.stringify will simply ignore those. We replace them with the string
|
||||
// 'undefined' which is not 100% right, but good enough to be logged to console
|
||||
if (typeof args[i] === 'undefined') {
|
||||
args[i] = 'undefined';
|
||||
}
|
||||
//#region FS helpers
|
||||
/**
|
||||
* @param {string} file
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
exports.readFile = function (file) {
|
||||
const fs = require('fs');
|
||||
|
||||
// Any argument that is an Error will be changed to be just the error stack/message
|
||||
// itself because currently cannot serialize the error over entirely.
|
||||
else if (args[i] instanceof Error) {
|
||||
var errorObj = args[i];
|
||||
if (errorObj.stack) {
|
||||
args[i] = errorObj.stack;
|
||||
} else {
|
||||
args[i] = errorObj.toString();
|
||||
}
|
||||
}
|
||||
|
||||
argsArray.push(args[i]);
|
||||
return new Promise(function (resolve, reject) {
|
||||
fs.readFile(file, 'utf8', function (err, data) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Add the stack trace as payload if we are told so. We remove the message and the 2 top frames
|
||||
// to start the stacktrace where the console message was being written
|
||||
if (process.env.VSCODE_LOG_STACK === 'true') {
|
||||
const stack = new Error().stack;
|
||||
argsArray.push({ __$stack: stack.split('\n').slice(3).join('\n') });
|
||||
}
|
||||
/**
|
||||
* @param {string} file
|
||||
* @param {string} content
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
exports.writeFile = function (file, content) {
|
||||
const fs = require('fs');
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
fs.writeFile(file, content, 'utf8', function (err) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
//#endregion
|
||||
|
||||
//#region NLS helpers
|
||||
/**
|
||||
* @returns {{locale?: string, availableLanguages: {[lang: string]: string;}, pseudo?: boolean }}
|
||||
*/
|
||||
exports.setupNLS = function () {
|
||||
const path = require('path');
|
||||
|
||||
// Get the nls configuration into the process.env as early as possible.
|
||||
let nlsConfig = { availableLanguages: {} };
|
||||
if (process.env['VSCODE_NLS_CONFIG']) {
|
||||
try {
|
||||
res = JSON.stringify(argsArray, function (key, value) {
|
||||
nlsConfig = JSON.parse(process.env['VSCODE_NLS_CONFIG']);
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
// Objects get special treatment to prevent circles
|
||||
if (value && Object.prototype.toString.call(value) === '[object Object]') {
|
||||
if (seen.indexOf(value) !== -1) {
|
||||
return Object.create(null); // prevent circular references!
|
||||
if (nlsConfig._resolvedLanguagePackCoreLocation) {
|
||||
const bundles = Object.create(null);
|
||||
|
||||
nlsConfig.loadBundle = function (bundle, language, cb) {
|
||||
let result = bundles[bundle];
|
||||
if (result) {
|
||||
cb(undefined, result);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const bundleFile = path.join(nlsConfig._resolvedLanguagePackCoreLocation, bundle.replace(/\//g, '!') + '.nls.json');
|
||||
exports.readFile(bundleFile).then(function (content) {
|
||||
let json = JSON.parse(content);
|
||||
bundles[bundle] = json;
|
||||
|
||||
cb(undefined, json);
|
||||
}).catch((error) => {
|
||||
try {
|
||||
if (nlsConfig._corruptedFile) {
|
||||
exports.writeFile(nlsConfig._corruptedFile, 'corrupted').catch(function (error) { console.error(error); });
|
||||
}
|
||||
|
||||
seen.push(value);
|
||||
} finally {
|
||||
cb(error, undefined);
|
||||
}
|
||||
|
||||
return value;
|
||||
});
|
||||
} catch (error) {
|
||||
return 'Output omitted for an object that cannot be inspected (' + error.toString() + ')';
|
||||
}
|
||||
|
||||
if (res && res.length > MAX_LENGTH) {
|
||||
return 'Output omitted for a large object that exceeds the limits';
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
||||
function safeSend(arg) {
|
||||
try {
|
||||
process.send(arg);
|
||||
} catch (error) {
|
||||
// Can happen if the parent channel is closed meanwhile
|
||||
return nlsConfig;
|
||||
};
|
||||
//#endregion
|
||||
|
||||
//#region Portable helpers
|
||||
/**
|
||||
* @returns {{ portableDataPath: string, isPortable: boolean }}
|
||||
*/
|
||||
exports.configurePortable = function () {
|
||||
// @ts-ignore
|
||||
const product = require('../product.json');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const appRoot = path.dirname(__dirname);
|
||||
|
||||
function getApplicationPath() {
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
return appRoot;
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
return path.dirname(path.dirname(path.dirname(appRoot)));
|
||||
}
|
||||
|
||||
return path.dirname(path.dirname(appRoot));
|
||||
}
|
||||
|
||||
// Pass console logging to the outside so that we have it in the main side if told so
|
||||
if (process.env.VERBOSE_LOGGING === 'true') {
|
||||
console.log = function () { safeSend({ type: '__$console', severity: 'log', arguments: safeToArray(arguments) }); };
|
||||
console.info = function () { safeSend({ type: '__$console', severity: 'log', arguments: safeToArray(arguments) }); };
|
||||
console.warn = function () { safeSend({ type: '__$console', severity: 'warn', arguments: safeToArray(arguments) }); };
|
||||
function getPortableDataPath() {
|
||||
if (process.env['VSCODE_PORTABLE']) {
|
||||
return process.env['VSCODE_PORTABLE'];
|
||||
}
|
||||
|
||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||
return path.join(getApplicationPath(), 'data');
|
||||
}
|
||||
|
||||
const portableDataName = product.portable || `${product.applicationName}-portable-data`;
|
||||
return path.join(path.dirname(getApplicationPath()), portableDataName);
|
||||
}
|
||||
|
||||
const portableDataPath = getPortableDataPath();
|
||||
const isPortable = !('target' in product) && fs.existsSync(portableDataPath);
|
||||
const portableTempPath = path.join(portableDataPath, 'tmp');
|
||||
const isTempPortable = isPortable && fs.existsSync(portableTempPath);
|
||||
|
||||
if (isPortable) {
|
||||
process.env['VSCODE_PORTABLE'] = portableDataPath;
|
||||
} else {
|
||||
console.log = function () { /* ignore */ };
|
||||
console.warn = function () { /* ignore */ };
|
||||
console.info = function () { /* ignore */ };
|
||||
delete process.env['VSCODE_PORTABLE'];
|
||||
}
|
||||
|
||||
console.error = function () { safeSend({ type: '__$console', severity: 'error', arguments: safeToArray(arguments) }); };
|
||||
}
|
||||
|
||||
if (!process.env['VSCODE_ALLOW_IO']) {
|
||||
// Let stdout, stderr and stdin be no-op streams. This prevents an issue where we would get an EBADF
|
||||
// error when we are inside a forked process and this process tries to access those channels.
|
||||
var stream = require('stream');
|
||||
var writable = new stream.Writable({
|
||||
write: function () { /* No OP */ }
|
||||
});
|
||||
|
||||
process.__defineGetter__('stdout', function () { return writable; });
|
||||
process.__defineGetter__('stderr', function () { return writable; });
|
||||
process.__defineGetter__('stdin', function () { return writable; });
|
||||
}
|
||||
|
||||
if (!process.env['VSCODE_HANDLES_UNCAUGHT_ERRORS']) {
|
||||
// Handle uncaught exceptions
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.error('Uncaught Exception: ', err.toString());
|
||||
if (err.stack) {
|
||||
console.error(err.stack);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Kill oneself if one's parent dies. Much drama.
|
||||
if (process.env['VSCODE_PARENT_PID']) {
|
||||
const parentPid = Number(process.env['VSCODE_PARENT_PID']);
|
||||
|
||||
if (typeof parentPid === 'number' && !isNaN(parentPid)) {
|
||||
setInterval(function () {
|
||||
try {
|
||||
process.kill(parentPid, 0); // throws an exception if the main process doesn't exist anymore.
|
||||
} catch (e) {
|
||||
process.exit();
|
||||
}
|
||||
}, 5000);
|
||||
if (isTempPortable) {
|
||||
process.env[process.platform === 'win32' ? 'TEMP' : 'TMPDIR'] = portableTempPath;
|
||||
}
|
||||
}
|
||||
|
||||
const crashReporterOptionsRaw = process.env['CRASH_REPORTER_START_OPTIONS'];
|
||||
if (typeof crashReporterOptionsRaw === 'string') {
|
||||
try {
|
||||
const crashReporterOptions = JSON.parse(crashReporterOptionsRaw);
|
||||
if (crashReporterOptions) {
|
||||
process.crashReporter.start(crashReporterOptions);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
return {
|
||||
portableDataPath,
|
||||
isPortable
|
||||
};
|
||||
};
|
||||
//#endregion
|
||||
|
||||
require('./bootstrap-amd').bootstrap(process.env['AMD_ENTRYPOINT']);
|
||||
//#region ApplicationInsights
|
||||
/**
|
||||
* Prevents appinsights from monkey patching modules.
|
||||
* This should be called before importing the applicationinsights module
|
||||
*/
|
||||
exports.avoidMonkeyPatchFromAppInsights = function () {
|
||||
// @ts-ignore
|
||||
process.env['APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL'] = true; // Skip monkey patching of 3rd party modules by appinsights
|
||||
global['diagnosticsSource'] = {}; // Prevents diagnostic channel (which patches "require") from initializing entirely
|
||||
};
|
||||
//#endregion
|
||||
+11
-65
@@ -3,73 +3,19 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const product = require('../product.json');
|
||||
const appRoot = path.dirname(__dirname);
|
||||
const bootstrap = require('./bootstrap');
|
||||
|
||||
function getApplicationPath() {
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
return appRoot;
|
||||
} else if (process.platform === 'darwin') {
|
||||
return path.dirname(path.dirname(path.dirname(appRoot)));
|
||||
} else {
|
||||
return path.dirname(path.dirname(appRoot));
|
||||
}
|
||||
}
|
||||
// Avoid Monkey Patches from Application Insights
|
||||
bootstrap.avoidMonkeyPatchFromAppInsights();
|
||||
|
||||
function getPortableDataPath() {
|
||||
if (process.env['VSCODE_PORTABLE']) {
|
||||
return process.env['VSCODE_PORTABLE'];
|
||||
}
|
||||
// Enable portable support
|
||||
bootstrap.configurePortable();
|
||||
|
||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||
return path.join(getApplicationPath(), 'data');
|
||||
} else {
|
||||
const portableDataName = product.portable || `${product.applicationName}-portable-data`;
|
||||
return path.join(path.dirname(getApplicationPath()), portableDataName);
|
||||
}
|
||||
}
|
||||
// Enable ASAR support
|
||||
bootstrap.enableASARSupport();
|
||||
|
||||
const portableDataPath = getPortableDataPath();
|
||||
const isPortable = fs.existsSync(portableDataPath);
|
||||
const portableTempPath = path.join(portableDataPath, 'tmp');
|
||||
const isTempPortable = isPortable && fs.existsSync(portableTempPath);
|
||||
|
||||
if (isPortable) {
|
||||
process.env['VSCODE_PORTABLE'] = portableDataPath;
|
||||
} else {
|
||||
delete process.env['VSCODE_PORTABLE'];
|
||||
}
|
||||
|
||||
if (isTempPortable) {
|
||||
process.env[process.platform === 'win32' ? 'TEMP' : 'TMPDIR'] = portableTempPath;
|
||||
}
|
||||
|
||||
//#region Add support for using node_modules.asar
|
||||
(function () {
|
||||
const path = require('path');
|
||||
const Module = require('module');
|
||||
const NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
|
||||
const NODE_MODULES_ASAR_PATH = NODE_MODULES_PATH + '.asar';
|
||||
|
||||
const originalResolveLookupPaths = Module._resolveLookupPaths;
|
||||
Module._resolveLookupPaths = function (request, parent, newReturn) {
|
||||
const result = originalResolveLookupPaths(request, parent, newReturn);
|
||||
|
||||
const paths = newReturn ? result : result[1];
|
||||
for (let i = 0, len = paths.length; i < len; i++) {
|
||||
if (paths[i] === NODE_MODULES_PATH) {
|
||||
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
//#endregion
|
||||
|
||||
require('./bootstrap-amd').bootstrap('vs/code/node/cli');
|
||||
// Load CLI through AMD loader
|
||||
require('./bootstrap-amd').load('vs/code/node/cli');
|
||||
+400
-284
@@ -2,128 +2,317 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
const perf = require('./vs/base/common/performance');
|
||||
perf.mark('main:started');
|
||||
|
||||
// Perf measurements
|
||||
global.perfStartTime = Date.now();
|
||||
|
||||
Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const bootstrap = require('./bootstrap');
|
||||
const paths = require('./paths');
|
||||
// @ts-ignore
|
||||
const product = require('../product.json');
|
||||
const appRoot = path.dirname(__dirname);
|
||||
|
||||
function getApplicationPath() {
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
return appRoot;
|
||||
} else if (process.platform === 'darwin') {
|
||||
return path.dirname(path.dirname(path.dirname(appRoot)));
|
||||
} else {
|
||||
return path.dirname(path.dirname(appRoot));
|
||||
}
|
||||
}
|
||||
|
||||
function getPortableDataPath() {
|
||||
if (process.env['VSCODE_PORTABLE']) {
|
||||
return process.env['VSCODE_PORTABLE'];
|
||||
}
|
||||
|
||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||
return path.join(getApplicationPath(), 'data');
|
||||
} else {
|
||||
const portableDataName = product.portable || `${product.applicationName}-portable-data`;
|
||||
return path.join(path.dirname(getApplicationPath()), portableDataName);
|
||||
}
|
||||
}
|
||||
|
||||
const portableDataPath = getPortableDataPath();
|
||||
const isPortable = fs.existsSync(portableDataPath);
|
||||
const portableTempPath = path.join(portableDataPath, 'tmp');
|
||||
const isTempPortable = isPortable && fs.existsSync(portableTempPath);
|
||||
|
||||
if (isPortable) {
|
||||
process.env['VSCODE_PORTABLE'] = portableDataPath;
|
||||
} else {
|
||||
delete process.env['VSCODE_PORTABLE'];
|
||||
}
|
||||
|
||||
if (isTempPortable) {
|
||||
process.env[process.platform === 'win32' ? 'TEMP' : 'TMPDIR'] = portableTempPath;
|
||||
}
|
||||
|
||||
//#region Add support for using node_modules.asar
|
||||
(function () {
|
||||
const path = require('path');
|
||||
const Module = require('module');
|
||||
const NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
|
||||
const NODE_MODULES_ASAR_PATH = NODE_MODULES_PATH + '.asar';
|
||||
|
||||
const originalResolveLookupPaths = Module._resolveLookupPaths;
|
||||
Module._resolveLookupPaths = function (request, parent, newReturn) {
|
||||
const result = originalResolveLookupPaths(request, parent, newReturn);
|
||||
|
||||
const paths = newReturn ? result : result[1];
|
||||
for (let i = 0, len = paths.length; i < len; i++) {
|
||||
if (paths[i] === NODE_MODULES_PATH) {
|
||||
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
//#endregion
|
||||
|
||||
// @ts-ignore
|
||||
const app = require('electron').app;
|
||||
|
||||
// TODO@Ben Electron 2.0.x: prevent localStorage migration from SQLite to LevelDB due to issues
|
||||
app.commandLine.appendSwitch('disable-mojo-local-storage');
|
||||
// Enable portable support
|
||||
const portable = bootstrap.configurePortable();
|
||||
|
||||
// TODO@Ben Electron 2.0.x: force srgb color profile (for https://github.com/Microsoft/vscode/issues/51791)
|
||||
// This also seems to fix: https://github.com/Microsoft/vscode/issues/48043
|
||||
app.commandLine.appendSwitch('force-color-profile', 'srgb');
|
||||
|
||||
const minimist = require('minimist');
|
||||
const paths = require('./paths');
|
||||
|
||||
const args = minimist(process.argv, {
|
||||
string: [
|
||||
'user-data-dir',
|
||||
'locale',
|
||||
'js-flags',
|
||||
'max-memory'
|
||||
]
|
||||
});
|
||||
|
||||
function getUserDataPath() {
|
||||
if (isPortable) {
|
||||
return path.join(portableDataPath, 'user-data');
|
||||
}
|
||||
|
||||
return path.resolve(args['user-data-dir'] || paths.getDefaultUserDataPath(process.platform));
|
||||
}
|
||||
|
||||
const userDataPath = getUserDataPath();
|
||||
// Enable ASAR support
|
||||
bootstrap.enableASARSupport();
|
||||
|
||||
// Set userData path before app 'ready' event and call to process.chdir
|
||||
const args = parseCLIArgs();
|
||||
const userDataPath = getUserDataPath(args);
|
||||
|
||||
// TODO@Ben global storage migration needs to happen very early before app.on("ready")
|
||||
// We copy the DB instead of moving it to ensure we are not running into locking issues
|
||||
if (process.env['VSCODE_TEST_STORAGE_MIGRATION']) {
|
||||
try {
|
||||
const globalStorageHome = path.join(userDataPath, 'User', 'globalStorage', 'temp.vscdb');
|
||||
const localStorageHome = path.join(userDataPath, 'Local Storage');
|
||||
const localStorageDB = path.join(localStorageHome, 'file__0.localstorage');
|
||||
const localStorageDBBackup = path.join(localStorageHome, 'file__0.localstorage.vscmig');
|
||||
if (!fs.existsSync(globalStorageHome) && fs.existsSync(localStorageDB)) {
|
||||
fs.copyFileSync(localStorageDB, localStorageDBBackup);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
app.setPath('userData', userDataPath);
|
||||
|
||||
//#region NLS
|
||||
// Update cwd based on environment and platform
|
||||
setCurrentWorkingDirectory();
|
||||
|
||||
// Global app listeners
|
||||
registerListeners();
|
||||
|
||||
/**
|
||||
* Support user defined locale
|
||||
*
|
||||
* @type {Promise}
|
||||
*/
|
||||
let nlsConfiguration = undefined;
|
||||
const userDefinedLocale = getUserDefinedLocale();
|
||||
userDefinedLocale.then((locale) => {
|
||||
if (locale && !nlsConfiguration) {
|
||||
nlsConfiguration = getNLSConfiguration(locale);
|
||||
}
|
||||
});
|
||||
|
||||
// Configure command line switches
|
||||
const nodeCachedDataDir = getNodeCachedDir();
|
||||
configureCommandlineSwitches(args, nodeCachedDataDir);
|
||||
|
||||
// Load our code once ready
|
||||
app.once('ready', function () {
|
||||
if (args['trace']) {
|
||||
// @ts-ignore
|
||||
const contentTracing = require('electron').contentTracing;
|
||||
|
||||
const traceOptions = {
|
||||
categoryFilter: args['trace-category-filter'] || '*',
|
||||
traceOptions: args['trace-options'] || 'record-until-full,enable-sampling'
|
||||
};
|
||||
|
||||
contentTracing.startRecording(traceOptions, () => onReady());
|
||||
} else {
|
||||
onReady();
|
||||
}
|
||||
});
|
||||
|
||||
function onReady() {
|
||||
perf.mark('main:appReady');
|
||||
|
||||
Promise.all([nodeCachedDataDir.ensureExists(), userDefinedLocale]).then(([cachedDataDir, locale]) => {
|
||||
if (locale && !nlsConfiguration) {
|
||||
nlsConfiguration = getNLSConfiguration(locale);
|
||||
}
|
||||
|
||||
if (!nlsConfiguration) {
|
||||
nlsConfiguration = Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
// First, we need to test a user defined locale. If it fails we try the app locale.
|
||||
// If that fails we fall back to English.
|
||||
nlsConfiguration.then((nlsConfig) => {
|
||||
|
||||
const startup = nlsConfig => {
|
||||
nlsConfig._languagePackSupport = true;
|
||||
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfig);
|
||||
process.env['VSCODE_NODE_CACHED_DATA_DIR'] = cachedDataDir || '';
|
||||
|
||||
// Load main in AMD
|
||||
require('./bootstrap-amd').load('vs/code/electron-main/main');
|
||||
};
|
||||
|
||||
// We recevied a valid nlsConfig from a user defined locale
|
||||
if (nlsConfig) {
|
||||
startup(nlsConfig);
|
||||
}
|
||||
|
||||
// Try to use the app locale. Please note that the app locale is only
|
||||
// valid after we have received the app ready event. This is why the
|
||||
// code is here.
|
||||
else {
|
||||
let appLocale = app.getLocale();
|
||||
if (!appLocale) {
|
||||
startup({ locale: 'en', availableLanguages: {} });
|
||||
} else {
|
||||
|
||||
// See above the comment about the loader and case sensitiviness
|
||||
appLocale = appLocale.toLowerCase();
|
||||
|
||||
getNLSConfiguration(appLocale).then((nlsConfig) => {
|
||||
if (!nlsConfig) {
|
||||
nlsConfig = { locale: appLocale, availableLanguages: {} };
|
||||
}
|
||||
|
||||
startup(nlsConfig);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, console.error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('minimist').ParsedArgs} ParsedArgs
|
||||
*
|
||||
* @param {ParsedArgs} cliArgs
|
||||
* @param {{ jsFlags: () => string }} nodeCachedDataDir
|
||||
*/
|
||||
function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) {
|
||||
|
||||
// TODO@Ben Electron 2.0.x: prevent localStorage migration from SQLite to LevelDB due to issues
|
||||
app.commandLine.appendSwitch('disable-mojo-local-storage');
|
||||
|
||||
// Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791)
|
||||
app.commandLine.appendSwitch('disable-features', 'ColorCorrectRendering');
|
||||
|
||||
// Support JS Flags
|
||||
const jsFlags = resolveJSFlags(cliArgs, nodeCachedDataDir.jsFlags());
|
||||
if (jsFlags) {
|
||||
app.commandLine.appendSwitch('--js-flags', jsFlags);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ParsedArgs} cliArgs
|
||||
* @param {string[]} jsFlags
|
||||
* @returns {string}
|
||||
*/
|
||||
function resolveJSFlags(cliArgs, ...jsFlags) {
|
||||
if (cliArgs['js-flags']) {
|
||||
jsFlags.push(cliArgs['js-flags']);
|
||||
}
|
||||
|
||||
if (cliArgs['max-memory'] && !/max_old_space_size=(\d+)/g.exec(cliArgs['js-flags'])) {
|
||||
jsFlags.push(`--max_old_space_size=${cliArgs['max-memory']}`);
|
||||
}
|
||||
|
||||
return jsFlags.length > 0 ? jsFlags.join(' ') : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ParsedArgs} cliArgs
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
function getUserDataPath(cliArgs) {
|
||||
if (portable.isPortable) {
|
||||
return path.join(portable.portableDataPath, 'user-data');
|
||||
}
|
||||
|
||||
return path.resolve(cliArgs['user-data-dir'] || paths.getDefaultUserDataPath(process.platform));
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {ParsedArgs}
|
||||
*/
|
||||
function parseCLIArgs() {
|
||||
const minimist = require('minimist');
|
||||
|
||||
return minimist(process.argv, {
|
||||
string: [
|
||||
'user-data-dir',
|
||||
'locale',
|
||||
'js-flags',
|
||||
'max-memory'
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function setCurrentWorkingDirectory() {
|
||||
try {
|
||||
if (process.platform === 'win32') {
|
||||
process.env['VSCODE_CWD'] = process.cwd(); // remember as environment letiable
|
||||
process.chdir(path.dirname(app.getPath('exe'))); // always set application folder as cwd
|
||||
} else if (process.env['VSCODE_CWD']) {
|
||||
process.chdir(process.env['VSCODE_CWD']);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
function registerListeners() {
|
||||
|
||||
/**
|
||||
* Mac: when someone drops a file to the not-yet running VSCode, the open-file event fires even before
|
||||
* the app-ready event. We listen very early for open-file and remember this upon startup as path to open.
|
||||
*
|
||||
* @type {string[]}
|
||||
*/
|
||||
const macOpenFiles = [];
|
||||
global['macOpenFiles'] = macOpenFiles;
|
||||
app.on('open-file', function (event, path) {
|
||||
macOpenFiles.push(path);
|
||||
});
|
||||
|
||||
/**
|
||||
* React to open-url requests.
|
||||
*
|
||||
* @type {string[]}
|
||||
*/
|
||||
const openUrls = [];
|
||||
const onOpenUrl = function (event, url) {
|
||||
event.preventDefault();
|
||||
|
||||
openUrls.push(url);
|
||||
};
|
||||
|
||||
app.on('will-finish-launching', function () {
|
||||
app.on('open-url', onOpenUrl);
|
||||
});
|
||||
|
||||
global['getOpenUrls'] = function () {
|
||||
app.removeListener('open-url', onOpenUrl);
|
||||
|
||||
return openUrls;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {{ jsFlags: () => string; ensureExists: () => Promise<string | void>, _compute: () => string; }}
|
||||
*/
|
||||
function getNodeCachedDir() {
|
||||
return new class {
|
||||
|
||||
constructor() {
|
||||
this.value = this._compute();
|
||||
}
|
||||
|
||||
jsFlags() {
|
||||
return this.value ? '--nolazy' : undefined;
|
||||
}
|
||||
|
||||
ensureExists() {
|
||||
return mkdirp(this.value).then(() => this.value, () => { /*ignore*/ });
|
||||
}
|
||||
|
||||
_compute() {
|
||||
if (process.argv.indexOf('--no-cached-data') > 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// IEnvironmentService.isBuilt
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// find commit id
|
||||
const commit = product.commit;
|
||||
if (!commit) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return path.join(userDataPath, 'CachedData', commit);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//#region NLS Support
|
||||
/**
|
||||
* @param {string} content
|
||||
* @returns {string}
|
||||
*/
|
||||
function stripComments(content) {
|
||||
let regexp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
|
||||
let result = content.replace(regexp, function (match, m1, m2, m3, m4) {
|
||||
const regexp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
|
||||
|
||||
return content.replace(regexp, function (match, m1, m2, m3, m4) {
|
||||
// Only one of m1, m2, m3, m4 matches
|
||||
if (m3) {
|
||||
// A block comment. Replace with nothing
|
||||
return '';
|
||||
} else if (m4) {
|
||||
// A line comment. If it ends in \r?\n then keep it.
|
||||
let length_1 = m4.length;
|
||||
const length_1 = m4.length;
|
||||
if (length_1 > 2 && m4[length_1 - 1] === '\n') {
|
||||
return m4[length_1 - 2] === '\r' ? '\r\n' : '\n';
|
||||
}
|
||||
@@ -135,19 +324,68 @@ function stripComments(content) {
|
||||
return match;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
const mkdir = dir => new Promise((c, e) => fs.mkdir(dir, err => (err && err.code !== 'EEXIST') ? e(err) : c(dir)));
|
||||
const exists = file => new Promise(c => fs.exists(file, c));
|
||||
const readFile = file => new Promise((c, e) => fs.readFile(file, 'utf8', (err, data) => err ? e(err) : c(data)));
|
||||
const writeFile = (file, content) => new Promise((c, e) => fs.writeFile(file, content, 'utf8', err => err ? e(err) : c()));
|
||||
const touch = file => new Promise((c, e) => { const d = new Date(); fs.utimes(file, d, d, err => err ? e(err) : c()); });
|
||||
const lstat = file => new Promise((c, e) => fs.lstat(file, (err, stats) => err ? e(err) : c(stats)));
|
||||
const readdir = dir => new Promise((c, e) => fs.readdir(dir, (err, files) => err ? e(err) : c(files)));
|
||||
const rmdir = dir => new Promise((c, e) => fs.rmdir(dir, err => err ? e(err) : c(undefined)));
|
||||
const unlink = file => new Promise((c, e) => fs.unlink(file, err => err ? e(err) : c(undefined)));
|
||||
/**
|
||||
* @param {string} dir
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
function mkdir(dir) {
|
||||
return new Promise((c, e) => fs.mkdir(dir, err => (err && err.code !== 'EEXIST') ? e(err) : c(dir)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} file
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
function exists(file) {
|
||||
return new Promise(c => fs.exists(file, c));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} file
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function touch(file) {
|
||||
return new Promise((c, e) => { const d = new Date(); fs.utimes(file, d, d, err => err ? e(err) : c()); });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} file
|
||||
* @returns {Promise<object>}
|
||||
*/
|
||||
function lstat(file) {
|
||||
return new Promise((c, e) => fs.lstat(file, (err, stats) => err ? e(err) : c(stats)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} dir
|
||||
* @returns {Promise<string[]>}
|
||||
*/
|
||||
function readdir(dir) {
|
||||
return new Promise((c, e) => fs.readdir(dir, (err, files) => err ? e(err) : c(files)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} dir
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function rmdir(dir) {
|
||||
return new Promise((c, e) => fs.rmdir(dir, err => err ? e(err) : c(undefined)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} file
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function unlink(file) {
|
||||
return new Promise((c, e) => fs.unlink(file, err => err ? e(err) : c(undefined)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} dir
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
function mkdirp(dir) {
|
||||
return mkdir(dir).then(null, err => {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
@@ -162,6 +400,10 @@ function mkdirp(dir) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} location
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function rimraf(location) {
|
||||
return lstat(location).then(stat => {
|
||||
if (stat.isDirectory() && !stat.isSymbolicLink()) {
|
||||
@@ -171,7 +413,7 @@ function rimraf(location) {
|
||||
} else {
|
||||
return unlink(location);
|
||||
}
|
||||
}, (err) => {
|
||||
}, err => {
|
||||
if (err.code === 'ENOENT') {
|
||||
return void 0;
|
||||
}
|
||||
@@ -179,37 +421,26 @@ function rimraf(location) {
|
||||
});
|
||||
}
|
||||
|
||||
function resolveJSFlags(...jsFlags) {
|
||||
|
||||
if (args['js-flags']) {
|
||||
jsFlags.push(args['js-flags']);
|
||||
}
|
||||
|
||||
if (args['max-memory'] && !/max_old_space_size=(\d+)/g.exec(args['js-flags'])) {
|
||||
jsFlags.push(`--max_old_space_size=${args['max-memory']}`);
|
||||
}
|
||||
|
||||
return jsFlags.length > 0 ? jsFlags.join(' ') : null;
|
||||
}
|
||||
|
||||
// Language tags are case insensitve however an amd loader is case sensitive
|
||||
// Language tags are case insensitive however an amd loader is case sensitive
|
||||
// To make this work on case preserving & insensitive FS we do the following:
|
||||
// the language bundles have lower case language tags and we always lower case
|
||||
// the locale we receive from the user or OS.
|
||||
|
||||
/**
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
function getUserDefinedLocale() {
|
||||
let locale = args['locale'];
|
||||
const locale = args['locale'];
|
||||
if (locale) {
|
||||
return Promise.resolve(locale.toLowerCase());
|
||||
}
|
||||
|
||||
let localeConfig = path.join(userDataPath, 'User', 'locale.json');
|
||||
const localeConfig = path.join(userDataPath, 'User', 'locale.json');
|
||||
return exists(localeConfig).then((result) => {
|
||||
if (result) {
|
||||
return readFile(localeConfig).then((content) => {
|
||||
return bootstrap.readFile(localeConfig).then((content) => {
|
||||
content = stripComments(content);
|
||||
try {
|
||||
let value = JSON.parse(content).locale;
|
||||
const value = JSON.parse(content).locale;
|
||||
return value && typeof value === 'string' ? value.toLowerCase() : undefined;
|
||||
} catch (e) {
|
||||
return undefined;
|
||||
@@ -221,8 +452,11 @@ function getUserDefinedLocale() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {object}
|
||||
*/
|
||||
function getLanguagePackConfigurations() {
|
||||
let configFile = path.join(userDataPath, 'languagepacks.json');
|
||||
const configFile = path.join(userDataPath, 'languagepacks.json');
|
||||
try {
|
||||
return require(configFile);
|
||||
} catch (err) {
|
||||
@@ -232,13 +466,17 @@ function getLanguagePackConfigurations() {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} config
|
||||
* @param {string} locale
|
||||
*/
|
||||
function resolveLanguagePackLocale(config, locale) {
|
||||
try {
|
||||
while (locale) {
|
||||
if (config[locale]) {
|
||||
return locale;
|
||||
} else {
|
||||
let index = locale.lastIndexOf('-');
|
||||
const index = locale.lastIndexOf('-');
|
||||
if (index > 0) {
|
||||
locale = locale.substring(0, index);
|
||||
} else {
|
||||
@@ -252,6 +490,9 @@ function resolveLanguagePackLocale(config, locale) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} locale
|
||||
*/
|
||||
function getNLSConfiguration(locale) {
|
||||
if (locale === 'pseudo') {
|
||||
return Promise.resolve({ locale: locale, availableLanguages: {}, pseudo: true });
|
||||
@@ -264,26 +505,26 @@ function getNLSConfiguration(locale) {
|
||||
// We have a built version so we have extracted nls file. Try to find
|
||||
// the right file to use.
|
||||
|
||||
// Check if we have an English locale. If so fall to default since that is our
|
||||
// Check if we have an English or English US locale. If so fall to default since that is our
|
||||
// English translation (we don't ship *.nls.en.json files)
|
||||
if (locale && (locale == 'en' || locale.startsWith('en-'))) {
|
||||
if (locale && (locale === 'en' || locale === 'en-us')) {
|
||||
return Promise.resolve({ locale: locale, availableLanguages: {} });
|
||||
}
|
||||
|
||||
let initialLocale = locale;
|
||||
const initialLocale = locale;
|
||||
|
||||
perf.mark('nlsGeneration:start');
|
||||
|
||||
let defaultResult = function (locale) {
|
||||
const defaultResult = function (locale) {
|
||||
perf.mark('nlsGeneration:end');
|
||||
return Promise.resolve({ locale: locale, availableLanguages: {} });
|
||||
};
|
||||
try {
|
||||
let commit = product.commit;
|
||||
const commit = product.commit;
|
||||
if (!commit) {
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
let configs = getLanguagePackConfigurations();
|
||||
const configs = getLanguagePackConfigurations();
|
||||
if (!configs) {
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
@@ -291,7 +532,7 @@ function getNLSConfiguration(locale) {
|
||||
if (!locale) {
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
let packConfig = configs[locale];
|
||||
const packConfig = configs[locale];
|
||||
let mainPack;
|
||||
if (!packConfig || typeof packConfig.hash !== 'string' || !packConfig.translations || typeof (mainPack = packConfig.translations['vscode']) !== 'string') {
|
||||
return defaultResult(initialLocale);
|
||||
@@ -300,12 +541,12 @@ function getNLSConfiguration(locale) {
|
||||
if (!fileExists) {
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
let packId = packConfig.hash + '.' + locale;
|
||||
let cacheRoot = path.join(userDataPath, 'clp', packId);
|
||||
let coreLocation = path.join(cacheRoot, commit);
|
||||
let translationsConfigFile = path.join(cacheRoot, 'tcf.json');
|
||||
let corruptedFile = path.join(cacheRoot, 'corrupted.info');
|
||||
let result = {
|
||||
const packId = packConfig.hash + '.' + locale;
|
||||
const cacheRoot = path.join(userDataPath, 'clp', packId);
|
||||
const coreLocation = path.join(cacheRoot, commit);
|
||||
const translationsConfigFile = path.join(cacheRoot, 'tcf.json');
|
||||
const corruptedFile = path.join(cacheRoot, 'corrupted.info');
|
||||
const result = {
|
||||
locale: initialLocale,
|
||||
availableLanguages: { '*': locale },
|
||||
_languagePackId: packId,
|
||||
@@ -331,25 +572,25 @@ function getNLSConfiguration(locale) {
|
||||
return result;
|
||||
}
|
||||
return mkdirp(coreLocation).then(() => {
|
||||
return Promise.all([readFile(path.join(__dirname, 'nls.metadata.json')), readFile(mainPack)]);
|
||||
return Promise.all([bootstrap.readFile(path.join(__dirname, 'nls.metadata.json')), bootstrap.readFile(mainPack)]);
|
||||
}).then((values) => {
|
||||
let metadata = JSON.parse(values[0]);
|
||||
let packData = JSON.parse(values[1]).contents;
|
||||
let bundles = Object.keys(metadata.bundles);
|
||||
let writes = [];
|
||||
const metadata = JSON.parse(values[0]);
|
||||
const packData = JSON.parse(values[1]).contents;
|
||||
const bundles = Object.keys(metadata.bundles);
|
||||
const writes = [];
|
||||
for (let bundle of bundles) {
|
||||
let modules = metadata.bundles[bundle];
|
||||
let target = Object.create(null);
|
||||
const modules = metadata.bundles[bundle];
|
||||
const target = Object.create(null);
|
||||
for (let module of modules) {
|
||||
let keys = metadata.keys[module];
|
||||
let defaultMessages = metadata.messages[module];
|
||||
let translations = packData[module];
|
||||
const keys = metadata.keys[module];
|
||||
const defaultMessages = metadata.messages[module];
|
||||
const translations = packData[module];
|
||||
let targetStrings;
|
||||
if (translations) {
|
||||
targetStrings = [];
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let elem = keys[i];
|
||||
let key = typeof elem === 'string' ? elem : elem.key;
|
||||
const elem = keys[i];
|
||||
const key = typeof elem === 'string' ? elem : elem.key;
|
||||
let translatedMessage = translations[key];
|
||||
if (translatedMessage === undefined) {
|
||||
translatedMessage = defaultMessages[i];
|
||||
@@ -361,9 +602,9 @@ function getNLSConfiguration(locale) {
|
||||
}
|
||||
target[module] = targetStrings;
|
||||
}
|
||||
writes.push(writeFile(path.join(coreLocation, bundle.replace(/\//g, '!') + '.nls.json'), JSON.stringify(target)));
|
||||
writes.push(bootstrap.writeFile(path.join(coreLocation, bundle.replace(/\//g, '!') + '.nls.json'), JSON.stringify(target)));
|
||||
}
|
||||
writes.push(writeFile(translationsConfigFile, JSON.stringify(packConfig.translations)));
|
||||
writes.push(bootstrap.writeFile(translationsConfigFile, JSON.stringify(packConfig.translations)));
|
||||
return Promise.all(writes);
|
||||
}).then(() => {
|
||||
perf.mark('nlsGeneration:end');
|
||||
@@ -382,128 +623,3 @@ function getNLSConfiguration(locale) {
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Cached Data Dir
|
||||
const nodeCachedDataDir = new class {
|
||||
|
||||
constructor() {
|
||||
this.value = this._compute();
|
||||
}
|
||||
|
||||
jsFlags() {
|
||||
return this.value ? '--nolazy' : undefined;
|
||||
}
|
||||
|
||||
ensureExists() {
|
||||
return mkdirp(this.value).then(() => this.value, () => { /*ignore*/ });
|
||||
}
|
||||
|
||||
_compute() {
|
||||
if (process.argv.indexOf('--no-cached-data') > 0) {
|
||||
return undefined;
|
||||
}
|
||||
// IEnvironmentService.isBuilt
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
return undefined;
|
||||
}
|
||||
// find commit id
|
||||
let commit = product.commit;
|
||||
if (!commit) {
|
||||
return undefined;
|
||||
}
|
||||
return path.join(userDataPath, 'CachedData', commit);
|
||||
}
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
// Update cwd based on environment and platform
|
||||
try {
|
||||
if (process.platform === 'win32') {
|
||||
process.env['VSCODE_CWD'] = process.cwd(); // remember as environment letiable
|
||||
process.chdir(path.dirname(app.getPath('exe'))); // always set application folder as cwd
|
||||
} else if (process.env['VSCODE_CWD']) {
|
||||
process.chdir(process.env['VSCODE_CWD']);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
// Mac: when someone drops a file to the not-yet running VSCode, the open-file event fires even before
|
||||
// the app-ready event. We listen very early for open-file and remember this upon startup as path to open.
|
||||
global.macOpenFiles = [];
|
||||
app.on('open-file', function (event, path) {
|
||||
global.macOpenFiles.push(path);
|
||||
});
|
||||
|
||||
let openUrls = [];
|
||||
let onOpenUrl = function (event, url) {
|
||||
event.preventDefault();
|
||||
openUrls.push(url);
|
||||
};
|
||||
|
||||
app.on('will-finish-launching', function () {
|
||||
app.on('open-url', onOpenUrl);
|
||||
});
|
||||
|
||||
global.getOpenUrls = function () {
|
||||
app.removeListener('open-url', onOpenUrl);
|
||||
return openUrls;
|
||||
};
|
||||
|
||||
|
||||
let nlsConfiguration = undefined;
|
||||
let userDefinedLocale = getUserDefinedLocale();
|
||||
userDefinedLocale.then((locale) => {
|
||||
if (locale && !nlsConfiguration) {
|
||||
nlsConfiguration = getNLSConfiguration(locale);
|
||||
}
|
||||
});
|
||||
|
||||
let jsFlags = resolveJSFlags(nodeCachedDataDir.jsFlags());
|
||||
if (jsFlags) {
|
||||
app.commandLine.appendSwitch('--js-flags', jsFlags);
|
||||
}
|
||||
|
||||
// Load our code once ready
|
||||
app.once('ready', function () {
|
||||
perf.mark('main:appReady');
|
||||
Promise.all([nodeCachedDataDir.ensureExists(), userDefinedLocale]).then(([cachedDataDir, locale]) => {
|
||||
if (locale && !nlsConfiguration) {
|
||||
nlsConfiguration = getNLSConfiguration(locale);
|
||||
}
|
||||
if (!nlsConfiguration) {
|
||||
nlsConfiguration = Promise.resolve(undefined);
|
||||
}
|
||||
// We first need to test a user defined locale. If it fails we try the app locale.
|
||||
// If that fails we fall back to English.
|
||||
nlsConfiguration.then((nlsConfig) => {
|
||||
let boot = (nlsConfig) => {
|
||||
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfig);
|
||||
if (cachedDataDir) process.env['VSCODE_NODE_CACHED_DATA_DIR_' + process.pid] = cachedDataDir;
|
||||
require('./bootstrap-amd').bootstrap('vs/code/electron-main/main');
|
||||
};
|
||||
// We recevied a valid nlsConfig from a user defined locale
|
||||
if (nlsConfig) {
|
||||
boot(nlsConfig);
|
||||
} else {
|
||||
// Try to use the app locale. Please note that the app locale is only
|
||||
// valid after we have received the app ready event. This is why the
|
||||
// code is here.
|
||||
let appLocale = app.getLocale();
|
||||
if (!appLocale) {
|
||||
boot({ locale: 'en', availableLanguages: {} });
|
||||
} else {
|
||||
// See above the comment about the loader and case sensitiviness
|
||||
appLocale = appLocale.toLowerCase();
|
||||
getNLSConfiguration(appLocale).then((nlsConfig) => {
|
||||
if (!nlsConfig) {
|
||||
nlsConfig = { locale: appLocale, availableLanguages: {} };
|
||||
}
|
||||
boot(nlsConfig);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, console.error);
|
||||
});
|
||||
|
||||
+15
-3
@@ -3,10 +3,18 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
var path = require('path');
|
||||
var os = require('os');
|
||||
var pkg = require('../package.json');
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
// @ts-ignore
|
||||
const pkg = require('../package.json');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
|
||||
/**
|
||||
* @param {string} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
function getAppDataPath(platform) {
|
||||
switch (platform) {
|
||||
case 'win32': return process.env['VSCODE_APPDATA'] || process.env['APPDATA'] || path.join(process.env['USERPROFILE'], 'AppData', 'Roaming');
|
||||
@@ -16,6 +24,10 @@ function getAppDataPath(platform) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
function getDefaultUserDataPath(platform) {
|
||||
// {{SQL CARBON EDIT}} hard-code Azure Data Studio
|
||||
return path.join(getAppDataPath(platform), 'azuredatastudio');
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-builder-hidden {
|
||||
.monaco-builder-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
@@ -2,9 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./builder';
|
||||
import 'vs/css!sql/base/browser/builder';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
@@ -14,7 +15,7 @@ import * as DOM from 'vs/base/browser/dom';
|
||||
/**
|
||||
* Welcome to the monaco builder. The recommended way to use it is:
|
||||
*
|
||||
* import Builder = require('vs/base/browser/builder');
|
||||
* import Builder = require('sql/base/browser/builder');
|
||||
* let $ = Builder.$;
|
||||
* $(....).fn(...);
|
||||
*
|
||||
@@ -466,16 +467,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
public overflow(overflow: string): Builder {
|
||||
this.currentElement.style.overflow = overflow;
|
||||
return this;
|
||||
}
|
||||
public background(color: string): Builder {
|
||||
this.currentElement.style.backgroundColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listener on event types on the current element and removes
|
||||
* them after first invocation.
|
||||
@@ -1441,4 +1432,4 @@ export const $: QuickBuilder = function (arg?: any): Builder {
|
||||
} else {
|
||||
throw new Error('Bad use of $');
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -7,6 +7,7 @@
|
||||
import { Button as vsButton, IButtonOptions, IButtonStyles as vsIButtonStyles } from 'vs/base/browser/ui/button/button';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
|
||||
export interface IButtonStyles extends vsIButtonStyles {
|
||||
buttonFocusOutline?: Color;
|
||||
@@ -14,10 +15,12 @@ export interface IButtonStyles extends vsIButtonStyles {
|
||||
|
||||
export class Button extends vsButton {
|
||||
private buttonFocusOutline: Color;
|
||||
private $el: Builder;
|
||||
|
||||
constructor(container: any, options?: IButtonOptions) {
|
||||
constructor(container: HTMLElement, options?: IButtonOptions) {
|
||||
super(container, options);
|
||||
this.buttonFocusOutline = null;
|
||||
this.$el = new Builder(this.element);
|
||||
|
||||
this.$el.on(DOM.EventType.FOCUS, (e) => {
|
||||
this.$el.style('outline-color', this.buttonFocusOutline ? this.buttonFocusOutline.toString() : null);
|
||||
|
||||
@@ -15,7 +15,7 @@ import { EventType as GestureEventType } from 'vs/base/browser/touch';
|
||||
import { List } from 'vs/base/browser/ui/list/listWidget';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { attachButtonStyler } from 'sql/platform/theme/common/styler';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { DropdownDataSource, DropdownFilter, DropdownModel, DropdownRenderer, Dr
|
||||
|
||||
import { IContextViewProvider, ContextView } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { InputBox, IInputBoxStyles } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import { IMessage, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import { IListStyles } from 'vs/base/browser/ui/list/listWidget';
|
||||
|
||||
@@ -8,9 +8,9 @@ import * as TreeDefaults from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { $ } from 'sql/base/browser/builder';
|
||||
|
||||
export interface Template {
|
||||
label: HTMLElement;
|
||||
@@ -72,7 +72,7 @@ export class DropdownDataSource implements tree.IDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
public getChildren(tree: tree.ITree, element: Resource | DropdownModel): Promise<any, any> {
|
||||
public getChildren(tree: tree.ITree, element: Resource | DropdownModel): Promise<any> {
|
||||
if (element instanceof DropdownModel) {
|
||||
return TPromise.as(this.options);
|
||||
} else {
|
||||
@@ -80,7 +80,7 @@ export class DropdownDataSource implements tree.IDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
public getParent(tree: tree.ITree, element: Resource | DropdownModel): Promise<any, any> {
|
||||
public getParent(tree: tree.ITree, element: Resource | DropdownModel): Promise<any> {
|
||||
if (element instanceof DropdownModel) {
|
||||
return TPromise.as(undefined);
|
||||
} else {
|
||||
|
||||
@@ -18,8 +18,8 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ScrollbarVisibility } from 'vs/editor/common/standalone/standaloneEnums';
|
||||
|
||||
export interface IPanelOptions {
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { IThemable } from 'vs/platform/theme/common/styler';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Dimension, EventType, $, addDisposableListener } from 'vs/base/browser/dom';
|
||||
import { $ as qb } from 'vs/base/browser/builder';
|
||||
import { $ as qb } from 'sql/base/browser/builder';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IActionOptions, ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
|
||||
@@ -20,7 +20,7 @@ export class HeaderFilter {
|
||||
sortDescImage: 'sort-desc.gif'
|
||||
};
|
||||
|
||||
private $menu;
|
||||
private $menu: JQuery<HTMLElement>;
|
||||
private options: any;
|
||||
private okButton: Button;
|
||||
private clearButton: Button;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as Platform from 'vs/base/common/platform';
|
||||
import { StandardMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { StandardWheelEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
|
||||
@@ -36,15 +36,15 @@ export class MouseWheelSupport implements Slick.Plugin<any> {
|
||||
public init(grid: Slick.Grid<any>): void {
|
||||
this.canvas = grid.getCanvasNode();
|
||||
this.viewport = this.canvas.parentElement;
|
||||
let onMouseWheel = (browserEvent: MouseWheelEvent) => {
|
||||
let e = new StandardMouseWheelEvent(browserEvent);
|
||||
let onMouseWheel = (browserEvent: IMouseWheelEvent) => {
|
||||
let e = new StandardWheelEvent(browserEvent);
|
||||
this._onMouseWheel(e);
|
||||
};
|
||||
this._disposables.push(DOM.addDisposableListener(this.viewport, 'mousewheel', onMouseWheel));
|
||||
this._disposables.push(DOM.addDisposableListener(this.viewport, 'DOMMouseScroll', onMouseWheel));
|
||||
}
|
||||
|
||||
private _onMouseWheel(e: StandardMouseWheelEvent) {
|
||||
private _onMouseWheel(e: StandardWheelEvent) {
|
||||
if (e.deltaY || e.deltaX) {
|
||||
let deltaY = e.deltaY * this.options.scrollSpeed;
|
||||
let deltaX = e.deltaX * this.options.scrollSpeed;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import 'vs/css!./media/table';
|
||||
import { TableDataView } from './tableDataView';
|
||||
import { IDisposableDataProvider, ITableSorter, ITableMouseEvent, ITableConfiguration, ITableStyles } from 'sql/base/browser/ui/table/interfaces';
|
||||
import { $ } from 'sql/base/browser/builder';
|
||||
|
||||
import { IThemable } from 'vs/platform/theme/common/styler';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
@@ -16,7 +17,6 @@ import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import { isArray, isBoolean } from 'vs/base/common/types';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { range } from 'vs/base/common/arrays';
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
|
||||
function getDefaultOptions<T>(): Slick.GridOptions<T> {
|
||||
return <Slick.GridOptions<T>>{
|
||||
@@ -38,7 +38,7 @@ export class Table<T extends Slick.SlickData> extends Widget implements IThemabl
|
||||
private _container: HTMLElement;
|
||||
private _tableContainer: HTMLElement;
|
||||
|
||||
private _classChangeTimeout: number;
|
||||
private _classChangeTimeout: NodeJS.Timer;
|
||||
|
||||
private _onContextMenu = new Emitter<ITableMouseEvent>();
|
||||
public readonly onContextMenu: Event<ITableMouseEvent> = this._onContextMenu.event;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import 'vs/css!vs/base/browser/ui/actionbar/actionbar';
|
||||
|
||||
import { Promise } from 'vs/base/common/winjs.base';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
@@ -41,7 +41,6 @@ export class ActionBar extends ActionRunner implements IActionRunner {
|
||||
private _items: IActionItem[];
|
||||
private _focusedItem: number;
|
||||
private _focusTracker: DOM.IFocusTracker;
|
||||
private _toDispose: lifecycle.IDisposable[];
|
||||
|
||||
// Elements
|
||||
private _domNode: HTMLElement;
|
||||
@@ -352,7 +351,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
|
||||
let actionItem = this._items[this._focusedItem];
|
||||
if (actionItem instanceof BaseActionItem) {
|
||||
const context = (actionItem._context === null || actionItem._context === undefined) ? event : actionItem._context;
|
||||
this.run(actionItem._action, context).done();
|
||||
this.run(actionItem._action, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'vs/css!sql/media/icons/common-icons';
|
||||
|
||||
import { ActionBar } from './actionbar';
|
||||
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { Action, IActionRunner, IAction } from 'vs/base/common/actions';
|
||||
import { ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IContextMenuProvider } from 'vs/base/browser/ui/dropdown/dropdown';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { ITask } from 'vs/base/common/async';
|
||||
import { ITask, createCancelablePromise, CancelablePromise } from 'vs/base/common/async';
|
||||
import { Promise, TPromise, ValueCallback } from 'vs/base/common/winjs.base';
|
||||
|
||||
/**
|
||||
@@ -16,8 +16,8 @@ import { Promise, TPromise, ValueCallback } from 'vs/base/common/winjs.base';
|
||||
*/
|
||||
export class MultipleRequestDelayer<T> {
|
||||
|
||||
private timeout: number;
|
||||
private completionPromise: Promise;
|
||||
private timeout: NodeJS.Timer;
|
||||
private completionPromise: CancelablePromise<any>;
|
||||
private onSuccess: ValueCallback;
|
||||
private requests: number = 0;
|
||||
private task: ITask<T>;
|
||||
@@ -39,18 +39,14 @@ export class MultipleRequestDelayer<T> {
|
||||
}
|
||||
|
||||
if (!this.completionPromise) {
|
||||
this.completionPromise = new TPromise((c) => {
|
||||
this.onSuccess = c;
|
||||
}, () => {
|
||||
// no-op
|
||||
}).then(() => {
|
||||
this.completionPromise = createCancelablePromise<T>(() => new Promise(resolve => this.onSuccess = resolve).then(() => {
|
||||
this.completionPromise = null;
|
||||
this.onSuccess = null;
|
||||
const task = this.task;
|
||||
this.task = null;
|
||||
|
||||
return task();
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
this.timeout = setTimeout(() => {
|
||||
|
||||
@@ -55,7 +55,7 @@ export class AccountListStatusbarItem extends Themable implements IStatusbarItem
|
||||
if (!this._manageLinkedAccountAction) {
|
||||
this._manageLinkedAccountAction = this._instantiationService.createInstance(ManageLinkedAccountAction, ManageLinkedAccountAction.ID, ManageLinkedAccountAction.LABEL);
|
||||
}
|
||||
this._manageLinkedAccountAction.run().done(null, onUnexpectedError);
|
||||
this._manageLinkedAccountAction.run().then(null, onUnexpectedError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
import 'vs/css!./media/autoOAuthDialog';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'vs/css!sql/parts/accountManagement/common/media/accountListRenderer';
|
||||
import 'vs/css!sql/parts/accountManagement/common/media/accountActions';
|
||||
import 'vs/css!sql/media/icons/common-icons';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IRenderer, IVirtualDelegate } from 'vs/base/browser/ui/list/list';
|
||||
import { IListRenderer, IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
|
||||
import { ActionBar, IActionOptions } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -17,7 +17,7 @@ import { RemoveAccountAction, RefreshAccountAction } from 'sql/parts/accountMana
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
|
||||
export class AccountListDelegate implements IVirtualDelegate<sqlops.Account> {
|
||||
export class AccountListDelegate implements IListVirtualDelegate<sqlops.Account> {
|
||||
|
||||
constructor(
|
||||
private _height: number
|
||||
@@ -44,7 +44,7 @@ export interface AccountListTemplate {
|
||||
actions?: ActionBar;
|
||||
}
|
||||
|
||||
export class AccountPickerListRenderer implements IRenderer<sqlops.Account, AccountListTemplate> {
|
||||
export class AccountPickerListRenderer implements IListRenderer<sqlops.Account, AccountListTemplate> {
|
||||
public static TEMPLATE_ID = 'accountListRenderer';
|
||||
|
||||
public get templateId(): string {
|
||||
|
||||
@@ -13,7 +13,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { localize } from 'vs/nls';
|
||||
import { join } from 'path';
|
||||
import { createCSSRule } from 'vs/base/browser/dom';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
import { ManageLinkedAccountAction } from 'sql/parts/accountManagement/accountListStatusbar/accountListStatusbarItem';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./media/firewallRuleDialog';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
|
||||
@@ -20,6 +20,7 @@ import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/q
|
||||
import { bootstrapAngular, IBootstrapParams } from 'sql/services/bootstrap/bootstrapService';
|
||||
import { CREATELOGIN_SELECTOR } from 'sql/parts/admin/security/createLogin.component';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
export class CreateLoginEditor extends BaseEditor {
|
||||
|
||||
@@ -32,9 +33,10 @@ export class CreateLoginEditor extends BaseEditor {
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||
@IMetadataService private _metadataService: IMetadataService,
|
||||
@IScriptingService private _scriptingService: IScriptingService,
|
||||
@IQueryEditorService private _queryEditorService: IQueryEditorService
|
||||
@IQueryEditorService private _queryEditorService: IQueryEditorService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(CreateLoginEditor.ID, telemetryService, themeService);
|
||||
super(CreateLoginEditor.ID, telemetryService, themeService, storageService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ import { EditorInput, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
|
||||
@@ -7,7 +7,6 @@ import nls = require('vs/nls');
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
|
||||
@@ -18,6 +17,7 @@ import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
import { EditDataInput } from 'sql/parts/editData/common/editDataInput';
|
||||
import { DashboardInput } from 'sql/parts/dashboard/dashboardInput';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
label: string,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService,
|
||||
@IQuickInputService private _quickInputService: IQuickInputService,
|
||||
@IDialogService private _dialogService: IDialogService,
|
||||
) {
|
||||
super(id, label, ClearRecentConnectionsAction.ICON);
|
||||
@@ -83,7 +83,7 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
{ key: nls.localize('connectionAction.no', 'No'), value: false }
|
||||
];
|
||||
|
||||
self._quickOpenService.pick(choices.map(x => x.key), { placeHolder: nls.localize('ClearRecentlyUsedLabel', 'Clear List'), ignoreFocusLost: true }).then((choice) => {
|
||||
self._quickInputService.pick(choices.map(x => x.key), { placeHolder: nls.localize('ClearRecentlyUsedLabel', 'Clear List'), ignoreFocusLost: true }).then((choice) => {
|
||||
let confirm = choices.find(x => x.key === choice);
|
||||
resolve(confirm && confirm.value);
|
||||
});
|
||||
|
||||
@@ -46,11 +46,11 @@ export class RecentConnectionActionsProvider extends ContributableActionProvider
|
||||
/**
|
||||
* Return actions given an element in the tree
|
||||
*/
|
||||
public getActions(tree: ITree, element: any): TPromise<IAction[]> {
|
||||
public getActions(tree: ITree, element: any): IAction[] {
|
||||
if (element instanceof ConnectionProfile) {
|
||||
return TPromise.as(this.getRecentConnectionActions(tree, element));
|
||||
return this.getRecentConnectionActions(tree, element);
|
||||
}
|
||||
return TPromise.as([]);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,13 +88,13 @@ export class ToggleMoreWidgetAction extends Action {
|
||||
super(ToggleMoreWidgetAction.ID, ToggleMoreWidgetAction.LABEL, ToggleMoreWidgetAction.ICON);
|
||||
}
|
||||
|
||||
run(context: StandardKeyboardEvent): TPromise<boolean> {
|
||||
run(context: StandardKeyboardEvent): Promise<boolean> {
|
||||
this._contextMenuService.showContextMenu({
|
||||
getAnchor: () => context.target,
|
||||
getActions: () => TPromise.as(this._actions),
|
||||
getActions: () => this._actions,
|
||||
getActionsContext: () => this._context
|
||||
});
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { localize } from 'vs/nls';
|
||||
import { join } from 'path';
|
||||
import { createCSSRule } from 'vs/base/browser/dom';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
import { registerContainer, generateContainerTypeSchemaProperties } from 'sql/platform/dashboard/common/dashboardContainerRegistry';
|
||||
import { NAV_SECTION, validateNavSectionContributionAndRegisterIcon } from 'sql/parts/dashboard/containers/dashboardNavSection.contribution';
|
||||
|
||||
@@ -17,7 +17,7 @@ import { ScrollableDirective } from 'sql/base/browser/ui/scrollable/scrollable.d
|
||||
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
||||
|
||||
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
|
||||
import { ScrollbarVisibility } from 'vs/editor/common/standalone/standaloneEnums';
|
||||
|
||||
@Component({
|
||||
selector: 'dashboard-home-container',
|
||||
|
||||
@@ -7,7 +7,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import * as nls from 'vs/nls';
|
||||
import { join } from 'path';
|
||||
import { createCSSRule } from 'vs/base/browser/dom';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IdGenerator } from 'vs/base/common/idGenerator';
|
||||
|
||||
import { NavSectionConfig, IUserFriendlyIcon } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||
|
||||
@@ -40,17 +40,12 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
|
||||
private _webview: WebviewElement;
|
||||
private _html: string;
|
||||
|
||||
protected contextKey: IContextKey<boolean>;
|
||||
protected findInputFocusContextKey: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => CommonServiceInterface)) private _dashboardService: DashboardServiceInterface,
|
||||
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
|
||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
||||
@Inject(IContextViewService) private contextViewService: IContextViewService,
|
||||
@Inject(IDashboardViewService) private dashboardViewService: IDashboardViewService,
|
||||
@Inject(IPartService) private partService: IPartService,
|
||||
@Inject(IEnvironmentService) private environmentService: IEnvironmentService,
|
||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
@@ -113,8 +108,6 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
|
||||
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this.partService.getContainer(Parts.EDITOR_PART),
|
||||
this.contextKey,
|
||||
this.findInputFocusContextKey,
|
||||
{
|
||||
enableWrappedPostMessage: true,
|
||||
allowScripts: true
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -24,6 +23,8 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { $ } from 'sql/base/browser/builder';
|
||||
|
||||
export class DashboardEditor extends BaseEditor {
|
||||
|
||||
@@ -37,9 +38,10 @@ export class DashboardEditor extends BaseEditor {
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IContextKeyService private _contextKeyService: IContextKeyService,
|
||||
@IDashboardService private _dashboardService: IDashboardService,
|
||||
@IConnectionManagementService private _connMan: IConnectionManagementService
|
||||
@IConnectionManagementService private _connMan: IConnectionManagementService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(DashboardEditor.ID, telemetryService, themeService);
|
||||
super(DashboardEditor.ID, telemetryService, themeService, storageService);
|
||||
}
|
||||
|
||||
public get input(): DashboardInput {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput, EditorModel } from 'vs/workbench/common/editor';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
|
||||
@@ -47,7 +47,7 @@ export class DashboardInput extends EditorInput {
|
||||
// vscode has a comment that Mode's will eventually be removed (not sure the state of this comment)
|
||||
// so this might be able to be undone when that happens
|
||||
if (!model.getModel(this.getResource())) {
|
||||
model.createModel('', modeService.getMode('dashboard'), this.getResource());
|
||||
model.createModel('', modeService.create('dashboard'), this.getResource());
|
||||
}
|
||||
this._initializedPromise = _connectionService.connectIfNotConnected(_connectionProfile, 'dashboard').then(
|
||||
u => {
|
||||
|
||||
@@ -24,7 +24,6 @@ import { ObjectMetadata } from 'sqlops';
|
||||
|
||||
import * as tree from 'vs/base/parts/tree/browser/tree';
|
||||
import * as TreeDefaults from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
@@ -159,7 +158,7 @@ export class ExplorerController extends TreeDefaults.DefaultController {
|
||||
|
||||
this._contextMenuService.showContextMenu({
|
||||
getAnchor: () => { return { x: event.posx, y: event.posy }; },
|
||||
getActions: () => GetExplorerActions(element, this._instantiationService, this._capabilitiesService, this._connectionService.connectionInfo),
|
||||
getActions: () => getExplorerActions(element, this._instantiationService, this._capabilitiesService, this._connectionService.connectionInfo),
|
||||
getActionsContext: () => context
|
||||
});
|
||||
|
||||
@@ -167,9 +166,9 @@ export class ExplorerController extends TreeDefaults.DefaultController {
|
||||
}
|
||||
|
||||
private handleItemDoubleClick(element: IConnectionProfile): void {
|
||||
this._progressService.showWhile(TPromise.wrap(this._connectionService.changeDatabase(element.databaseName).then(result => {
|
||||
this._progressService.showWhile(this._connectionService.changeDatabase(element.databaseName).then(result => {
|
||||
this._router.navigate(['database-dashboard']);
|
||||
})));
|
||||
}));
|
||||
}
|
||||
|
||||
protected onEnter(tree: tree.ITree, event: IKeyboardEvent): boolean {
|
||||
@@ -207,19 +206,19 @@ export class ExplorerDataSource implements tree.IDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
public getChildren(tree: tree.ITree, element: TreeResource | ExplorerModel): Promise {
|
||||
public getChildren(tree: tree.ITree, element: TreeResource | ExplorerModel): Promise<TreeResource[]> {
|
||||
if (element instanceof ExplorerModel) {
|
||||
return TPromise.as(this._data);
|
||||
return Promise.resolve(this._data);
|
||||
} else {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
public getParent(tree: tree.ITree, element: TreeResource | ExplorerModel): Promise {
|
||||
public getParent(tree: tree.ITree, element: TreeResource | ExplorerModel): Promise<ExplorerModel> {
|
||||
if (element instanceof ExplorerModel) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
} else {
|
||||
return TPromise.as(new ExplorerModel());
|
||||
return Promise.resolve(new ExplorerModel());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +370,7 @@ export class ExplorerFilter implements tree.IFilter {
|
||||
}
|
||||
}
|
||||
|
||||
function GetExplorerActions(element: TreeResource, instantiationService: IInstantiationService, capabilitiesService: ICapabilitiesService, info: ConnectionManagementInfo): TPromise<IAction[]> {
|
||||
function getExplorerActions(element: TreeResource, instantiationService: IInstantiationService, capabilitiesService: ICapabilitiesService, info: ConnectionManagementInfo): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
|
||||
if (element instanceof ObjectMetadataWrapper) {
|
||||
@@ -405,16 +404,16 @@ function GetExplorerActions(element: TreeResource, instantiationService: IInstan
|
||||
}
|
||||
|
||||
actions.push(instantiationService.createInstance(ExplorerManageAction, ManageAction.ID, ManageAction.LABEL));
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
|
||||
actions.push(instantiationService.createInstance(ExplorerScriptCreateAction, ScriptCreateAction.ID, ScriptCreateAction.LABEL));
|
||||
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
|
||||
class CustomExecuteCommandAction extends ExecuteCommandAction {
|
||||
run(context: ManageActionContext): TPromise<any> {
|
||||
run(context: ManageActionContext): Promise<any> {
|
||||
return super.run(context.profile);
|
||||
}
|
||||
}
|
||||
@@ -430,7 +429,7 @@ class ExplorerScriptSelectAction extends ScriptSelectAction {
|
||||
super(id, label, queryEditorService, connectionManagementService, scriptingService);
|
||||
}
|
||||
|
||||
public run(actionContext: BaseActionContext): TPromise<boolean> {
|
||||
public run(actionContext: BaseActionContext): Promise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this.progressService.showWhile(promise);
|
||||
return promise;
|
||||
@@ -449,7 +448,7 @@ class ExplorerScriptCreateAction extends ScriptCreateAction {
|
||||
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
|
||||
}
|
||||
|
||||
public run(actionContext: BaseActionContext): TPromise<boolean> {
|
||||
public run(actionContext: BaseActionContext): Promise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this.progressService.showWhile(promise);
|
||||
return promise;
|
||||
@@ -468,7 +467,7 @@ class ExplorerScriptAlterAction extends ScriptAlterAction {
|
||||
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
|
||||
}
|
||||
|
||||
public run(actionContext: BaseActionContext): TPromise<boolean> {
|
||||
public run(actionContext: BaseActionContext): Promise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this.progressService.showWhile(promise);
|
||||
return promise;
|
||||
@@ -487,7 +486,7 @@ class ExplorerScriptExecuteAction extends ScriptExecuteAction {
|
||||
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
|
||||
}
|
||||
|
||||
public run(actionContext: BaseActionContext): TPromise<boolean> {
|
||||
public run(actionContext: BaseActionContext): Promise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this.progressService.showWhile(promise);
|
||||
return promise;
|
||||
@@ -504,7 +503,7 @@ class ExplorerManageAction extends ManageAction {
|
||||
super(id, label, connectionManagementService, angularEventingService);
|
||||
}
|
||||
|
||||
public run(actionContext: ManageActionContext): TPromise<boolean> {
|
||||
public run(actionContext: ManageActionContext): Promise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this._progressService.showWhile(promise);
|
||||
return promise;
|
||||
|
||||
@@ -26,9 +26,9 @@ import * as pfs from 'vs/base/node/pfs';
|
||||
import * as nls from 'vs/nls';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IntervalTimer } from 'vs/base/common/async';
|
||||
import { IntervalTimer, createCancelablePromise } from 'vs/base/common/async';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
@@ -83,27 +83,29 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
||||
if (!this._checkStorage()) {
|
||||
let promise = this._runQuery();
|
||||
this.queryObv = Observable.fromPromise(promise);
|
||||
let tpromise = promise.then(
|
||||
result => {
|
||||
if (this._init) {
|
||||
this._updateChild(result);
|
||||
this.setupInterval();
|
||||
} else {
|
||||
this.queryObv = Observable.fromPromise(TPromise.as<SimpleExecuteResult>(result));
|
||||
let cancelablePromise = createCancelablePromise(() => {
|
||||
return promise.then(
|
||||
result => {
|
||||
if (this._init) {
|
||||
this._updateChild(result);
|
||||
this.setupInterval();
|
||||
} else {
|
||||
this.queryObv = Observable.fromPromise(TPromise.as<SimpleExecuteResult>(result));
|
||||
}
|
||||
},
|
||||
error => {
|
||||
if (isPromiseCanceledError(error)) {
|
||||
return;
|
||||
}
|
||||
if (this._init) {
|
||||
this.showError(error);
|
||||
} else {
|
||||
this.queryObv = Observable.fromPromise(TPromise.as<SimpleExecuteResult>(error));
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
if (isPromiseCanceledError(error)) {
|
||||
return;
|
||||
}
|
||||
if (this._init) {
|
||||
this.showError(error);
|
||||
} else {
|
||||
this.queryObv = Observable.fromPromise(TPromise.as<SimpleExecuteResult>(error));
|
||||
}
|
||||
}
|
||||
);
|
||||
this._register(toDisposable(() => tpromise.cancel()));
|
||||
);
|
||||
});
|
||||
this._register(toDisposable(() => cancelablePromise.cancel()));
|
||||
}
|
||||
}, error => {
|
||||
this.showError(error);
|
||||
@@ -163,14 +165,14 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
||||
};
|
||||
this.lastUpdated = nls.localize('insights.lastUpdated', "Last Updated: {0} {1}", currentTime.toLocaleTimeString(), currentTime.toLocaleDateString());
|
||||
this._cd.detectChanges();
|
||||
this.storageService.store(this._getStorageKey(), JSON.stringify(store));
|
||||
this.storageService.store(this._getStorageKey(), JSON.stringify(store), StorageScope.GLOBAL);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private _checkStorage(): boolean {
|
||||
if (this.insightConfig.cacheId) {
|
||||
let storage = this.storageService.get(this._getStorageKey());
|
||||
let storage = this.storageService.get(this._getStorageKey(), StorageScope.GLOBAL);
|
||||
if (storage) {
|
||||
let storedResult: IStorageResult = JSON.parse(storage);
|
||||
let date = new Date(storedResult.date);
|
||||
@@ -303,7 +305,7 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
||||
filePathArray = filePathArray.filter(i => !!i);
|
||||
let folder = this.workspaceContextService.getWorkspace().folders.find(i => i.name === filePathArray[0]);
|
||||
if (!folder) {
|
||||
return Promise.reject<void[]>(new Error(`Could not find workspace folder ${filePathArray[0]}`));
|
||||
return Promise.reject(new Error(`Could not find workspace folder ${filePathArray[0]}`));
|
||||
}
|
||||
// remove the folder name from the filepath
|
||||
filePathArray.shift();
|
||||
|
||||
@@ -27,7 +27,7 @@ import * as nls from 'vs/nls';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
|
||||
import { $, Builder } from 'vs/base/browser/builder';
|
||||
import { $, Builder } from 'sql/base/browser/builder';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { CommandsRegistry, ICommand, ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { MenuRegistry, ICommandAction } from 'vs/platform/actions/common/actions';
|
||||
|
||||
@@ -43,21 +43,14 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
public readonly onMessage: Event<string> = this._onMessage.event;
|
||||
private _onMessageDisposable: IDisposable;
|
||||
|
||||
protected contextKey: IContextKey<boolean>;
|
||||
protected findInputFocusContextKey: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => CommonServiceInterface)) private _dashboardService: DashboardServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||
@Inject(WIDGET_CONFIG) protected _config: WidgetConfig,
|
||||
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
|
||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
||||
@Inject(IContextViewService) private contextViewService: IContextViewService,
|
||||
@Inject(IDashboardViewService) private dashboardViewService: IDashboardViewService,
|
||||
@Inject(IPartService) private partService: IPartService,
|
||||
@Inject(IEnvironmentService) private environmentService: IEnvironmentService,
|
||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService,
|
||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService
|
||||
) {
|
||||
super();
|
||||
this._id = (_config.widget[selector] as IWebviewWidgetConfig).id;
|
||||
@@ -116,8 +109,6 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this.partService.getContainer(Parts.EDITOR_PART),
|
||||
this.contextKey,
|
||||
this.findInputFocusContextKey,
|
||||
{
|
||||
allowScripts: true,
|
||||
enableWrappedPostMessage: true
|
||||
|
||||
@@ -12,13 +12,11 @@ import { IExtensionPoint, ExtensionsRegistry, ExtensionMessageCollector } from '
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { CustomTreeViewPanel } from 'vs/workbench/browser/parts/views/customView';
|
||||
import { CustomTreeViewPanel, CustomTreeView } from 'vs/workbench/browser/parts/views/customView';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { viewsContainersExtensionPoint } from 'vs/workbench/api/browser/viewsContainersExtensionPoint';
|
||||
|
||||
import { CustomTreeViewer } from 'sql/workbench/browser/parts/views/customView';
|
||||
|
||||
export const DataExplorerViewlet = {
|
||||
DataExplorer: 'dataExplorer'
|
||||
};
|
||||
@@ -123,7 +121,7 @@ class DataExplorerContainerExtensionHandler implements IWorkbenchContribution {
|
||||
when: ContextKeyExpr.deserialize(item.when),
|
||||
canToggleVisibility: true,
|
||||
collapsed: this.showCollapsed(container),
|
||||
treeViewer: this.instantiationService.createInstance(CustomTreeViewer, item.id, container)
|
||||
treeView: this.instantiationService.createInstance(CustomTreeView, item.id, container)
|
||||
};
|
||||
|
||||
viewIds.push(viewDescriptor.id);
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ServerTreeView } from 'sql/parts/objectExplorer/viewlet/serverTreeView';
|
||||
|
||||
@@ -27,6 +27,7 @@ import { ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { VIEWLET_ID, VIEW_CONTAINER } from 'sql/parts/dataExplorer/common/dataExplorerExtensionPoint';
|
||||
import { ConnectionViewletPanel } from 'sql/parts/dataExplorer/objectExplorer/connectionViewlet/connectionViewletPanel';
|
||||
import { Extensions as ViewContainerExtensions, ViewsRegistry, IViewDescriptor } from 'vs/workbench/common/views';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export class DataExplorerViewletViewsContribution implements IWorkbenchContribution {
|
||||
|
||||
@@ -71,13 +72,14 @@ export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IExtensionService extensionService: IExtensionService
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
) {
|
||||
super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
|
||||
super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
|
||||
this.disposables.push(this.viewletService.onDidViewletOpen(this.onViewletOpen, this, this.disposables));
|
||||
}
|
||||
|
||||
create(parent: HTMLElement): TPromise<void> {
|
||||
create(parent: HTMLElement): void {
|
||||
addClass(parent, 'dataExplorer-viewlet');
|
||||
this.root = parent;
|
||||
|
||||
@@ -90,16 +92,6 @@ export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
super.updateStyles();
|
||||
}
|
||||
|
||||
setVisible(visible: boolean): TPromise<void> {
|
||||
const isVisibilityChanged = this.isVisible() !== visible;
|
||||
return super.setVisible(visible).then(() => {
|
||||
if (isVisibilityChanged) {
|
||||
if (visible) {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
focus(): void {
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import * as TelemetryKeys from 'sql/common/telemetryKeys';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { bootstrapAngular } from 'sql/services/bootstrap/bootstrapService';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
import 'vs/css!./media/restoreDialog';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
@@ -198,7 +198,7 @@ export class RestoreDialog extends Modal {
|
||||
});
|
||||
|
||||
inputContainer.div({ class: 'file-browser' }, (inputCellContainer) => {
|
||||
this._browseFileButton = new Button(inputCellContainer);
|
||||
this._browseFileButton = new Button(inputCellContainer.getHTMLElement());
|
||||
this._browseFileButton.label = '...';
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IQueryModelService } from 'sql/platform/query/common/queryModel';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { EditSessionReadyParams, ISelectionData } from 'sqlops';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import nls = require('vs/nls');
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
|
||||
@@ -39,6 +39,7 @@ import { IFlexibleSash, HorizontalFlexibleSash } from 'sql/parts/query/views/fle
|
||||
import { EditDataResultsEditor } from 'sql/parts/editData/editor/editDataResultsEditor';
|
||||
import { EditDataResultsInput } from 'sql/parts/editData/common/editDataResultsInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
/**
|
||||
* Editor that hosts an action bar and a resultSetInput for an edit data session
|
||||
@@ -83,9 +84,10 @@ export class EditDataEditor extends BaseEditor {
|
||||
@IContextMenuService private _contextMenuService: IContextMenuService,
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(EditDataEditor.ID, _telemetryService, themeService);
|
||||
super(EditDataEditor.ID, _telemetryService, themeService, storageService);
|
||||
|
||||
if (contextKeyService) {
|
||||
this._queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { getZoomLevel } from 'vs/base/browser/browser';
|
||||
@@ -23,8 +23,8 @@ import { IEditDataComponentParams } from 'sql/services/bootstrap/bootstrapParams
|
||||
import { EditDataModule } from 'sql/parts/grid/views/editData/editData.module';
|
||||
import { EDITDATA_SELECTOR } from 'sql/parts/grid/views/editData/editData.component';
|
||||
import { EditDataResultsInput } from 'sql/parts/editData/common/editDataResultsInput';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
export class EditDataResultsEditor extends BaseEditor {
|
||||
|
||||
@@ -38,9 +38,10 @@ export class EditDataResultsEditor extends BaseEditor {
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(EditDataResultsEditor.ID, telemetryService, themeService);
|
||||
super(EditDataResultsEditor.ID, telemetryService, themeService, storageService);
|
||||
this._rawOptions = BareResultsGridInfo.createFromRawSettings(this._configurationService.getValue('resultsGrid'), getZoomLevel());
|
||||
this._configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('resultsGrid')) {
|
||||
|
||||
@@ -54,7 +54,7 @@ export class EditDataComponent extends GridParentComponent implements OnInit, On
|
||||
private refreshGridTimeoutInMs = 200;
|
||||
|
||||
// The timeout handle for the refresh grid task
|
||||
private refreshGridTimeoutHandle: number;
|
||||
private refreshGridTimeoutHandle: NodeJS.Timer;
|
||||
|
||||
// Optimized for the edit top 200 rows scenario, only need to retrieve the data once
|
||||
// to make the scroll experience smoother
|
||||
|
||||
@@ -27,12 +27,12 @@ export class EditDataGridActionProvider extends GridActionProvider {
|
||||
/**
|
||||
* Return actions given a click on an edit data grid
|
||||
*/
|
||||
public getGridActions(): TPromise<IAction[]> {
|
||||
public getGridActions(): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(new DeleteRowAction(DeleteRowAction.ID, DeleteRowAction.LABEL, this._deleteRowCallback));
|
||||
actions.push(new RevertRowAction(RevertRowAction.ID, RevertRowAction.LABEL, this._revertRowCallback));
|
||||
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export class GridActionProvider {
|
||||
/**
|
||||
* Return actions given a click on a grid
|
||||
*/
|
||||
public getGridActions(): TPromise<IAction[]> {
|
||||
public getGridActions(): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(new SaveResultAction(SaveResultAction.SAVECSV_ID, SaveResultAction.SAVECSV_LABEL, SaveFormat.CSV, this._dataService));
|
||||
actions.push(new SaveResultAction(SaveResultAction.SAVEJSON_ID, SaveResultAction.SAVEJSON_LABEL, SaveFormat.JSON, this._dataService));
|
||||
@@ -52,17 +52,17 @@ export class GridActionProvider {
|
||||
actions.push(new CopyResultAction(CopyResultAction.COPY_ID, CopyResultAction.COPY_LABEL, false, this._dataService));
|
||||
actions.push(new CopyResultAction(CopyResultAction.COPYWITHHEADERS_ID, CopyResultAction.COPYWITHHEADERS_LABEL, true, this._dataService));
|
||||
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return actions given a click on a messages pane
|
||||
*/
|
||||
public getMessagesActions(dataService: DataService, selectAllCallback: () => void): TPromise<IAction[]> {
|
||||
public getMessagesActions(dataService: DataService, selectAllCallback: () => void): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(this._instantiationService.createInstance(CopyMessagesAction, CopyMessagesAction.ID, CopyMessagesAction.LABEL));
|
||||
actions.push(new SelectAllMessagesAction(SelectAllMessagesAction.ID, SelectAllMessagesAction.LABEL, selectAllCallback));
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -201,11 +201,11 @@ export class AlertsViewComponent extends JobManagementView implements OnInit, On
|
||||
this._table.resizeCanvas();
|
||||
}
|
||||
|
||||
protected getTableActions(): TPromise<IAction[]> {
|
||||
protected getTableActions(): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(this._instantiationService.createInstance(EditAlertAction));
|
||||
actions.push(this._instantiationService.createInstance(DeleteAlertAction));
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
|
||||
protected getCurrentTableObject(rowIndex: number): any {
|
||||
|
||||
@@ -98,7 +98,7 @@ export abstract class JobManagementView extends TabChild implements AfterContent
|
||||
return kb;
|
||||
}
|
||||
|
||||
protected getTableActions(): TPromise<IAction[]> {
|
||||
protected getTableActions(): IAction[] {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
import * as tree from 'vs/base/parts/tree/browser/tree';
|
||||
import * as TreeDefaults from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { $ } from 'sql/base/browser/builder';
|
||||
|
||||
export class JobStepsViewRow {
|
||||
public stepId: string;
|
||||
|
||||
@@ -859,11 +859,11 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
||||
});
|
||||
}
|
||||
|
||||
protected getTableActions(): TPromise<IAction[]> {
|
||||
protected getTableActions(): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(this._instantiationService.createInstance(EditJobAction));
|
||||
actions.push(this._instantiationService.createInstance(DeleteJobAction));
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
|
||||
protected convertStepsToStepInfos(steps: sqlops.AgentJobStep[], job: sqlops.AgentJobInfo): sqlops.AgentJobStepInfo[] {
|
||||
|
||||
@@ -201,11 +201,11 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit,
|
||||
this._table.resizeCanvas();
|
||||
}
|
||||
|
||||
protected getTableActions(): TPromise<IAction[]> {
|
||||
protected getTableActions(): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(this._instantiationService.createInstance(EditOperatorAction));
|
||||
actions.push(this._instantiationService.createInstance(DeleteOperatorAction));
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
|
||||
protected getCurrentTableObject(rowIndex: number): any {
|
||||
|
||||
@@ -205,11 +205,11 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit, O
|
||||
this._table.resizeCanvas();
|
||||
}
|
||||
|
||||
protected getTableActions(): TPromise<IAction[]> {
|
||||
protected getTableActions(): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(this._instantiationService.createInstance(EditProxyAction));
|
||||
actions.push(this._instantiationService.createInstance(DeleteProxyAction));
|
||||
return TPromise.as(actions);
|
||||
return actions;
|
||||
}
|
||||
|
||||
protected getCurrentTableObject(rowIndex: number): any {
|
||||
|
||||
@@ -18,8 +18,8 @@ import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboar
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ModelComponentWrapper } from 'sql/parts/modelComponents/modelComponentWrapper.component';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { IdGenerator } from 'vs/base/common/idGenerator';
|
||||
import { createCSSRule, removeCSSRulesContainingSelector } from 'vs/base/browser/dom';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
|
||||
import { IComponent, IComponentDescriptor, IModelStore, IComponentEventArgs, ComponentEventType } from 'sql/parts/modelComponents/interfaces';
|
||||
import * as sqlops from 'sqlops';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IdGenerator } from 'vs/base/common/idGenerator';
|
||||
import { createCSSRule, removeCSSRulesContainingSelector } from 'vs/base/browser/dom';
|
||||
import { ComponentBase } from 'sql/parts/modelComponents/componentBase';
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { $, Builder } from 'vs/base/browser/builder';
|
||||
import { $, Builder } from 'sql/base/browser/builder';
|
||||
|
||||
import { ComponentBase } from 'sql/parts/modelComponents/componentBase';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/parts/modelComponents/interfaces';
|
||||
|
||||
@@ -13,7 +13,7 @@ import * as DOM from 'vs/base/browser/dom';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -134,9 +134,8 @@ export default class EditorComponent extends ComponentBase implements IComponent
|
||||
private updateLanguageMode() {
|
||||
if (this._editorModel && this._editor) {
|
||||
this._languageMode = this.languageMode;
|
||||
this._modeService.getOrCreateMode(this._languageMode).then((modeValue) => {
|
||||
this._modelService.setMode(this._editorModel, modeValue);
|
||||
});
|
||||
let languageSelection = this._modeService.create(this._languageMode);
|
||||
this._modelService.setMode(this._editorModel, languageSelection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import * as DOM from 'vs/base/browser/dom';
|
||||
|
||||
import { ModelViewInput } from 'sql/parts/modelComponents/modelEditor/modelViewInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
export class ModelViewEditor extends BaseEditor {
|
||||
|
||||
@@ -23,9 +24,10 @@ export class ModelViewEditor extends BaseEditor {
|
||||
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(ModelViewEditor.ID, telemetryService, themeService);
|
||||
super(ModelViewEditor.ID, telemetryService, themeService, storageService);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,9 +63,9 @@ export class ModelViewEditor extends BaseEditor {
|
||||
}
|
||||
}
|
||||
|
||||
async setInput(input: ModelViewInput, options?: EditorOptions): TPromise<void, any> {
|
||||
async setInput(input: ModelViewInput, options?: EditorOptions): Promise<void> {
|
||||
if (this.input && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
this.hideOrRemoveModelViewContainer();
|
||||
|
||||
@@ -24,6 +24,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { Configuration } from 'vs/editor/browser/config/configuration';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
|
||||
/**
|
||||
@@ -50,12 +51,13 @@ export class QueryTextEditor extends BaseTextEditor {
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService,
|
||||
@IEditorService protected editorService: IEditorService,
|
||||
@IWindowService windowService: IWindowService,
|
||||
@IWorkspaceConfigurationService private workspaceConfigurationService: IWorkspaceConfigurationService
|
||||
|
||||
) {
|
||||
super(
|
||||
QueryTextEditor.ID, telemetryService, instantiationService, storageService,
|
||||
configurationService, themeService, textFileService, editorService, editorGroupService);
|
||||
configurationService, themeService, textFileService, editorService, editorGroupService, windowService);
|
||||
}
|
||||
|
||||
public createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
|
||||
|
||||
@@ -28,7 +28,9 @@ import { TreeViewDataProvider } from './treeViewDataProvider';
|
||||
import { getContentHeight, getContentWidth } from 'vs/base/browser/dom';
|
||||
|
||||
class Root implements ITreeComponentItem {
|
||||
label = 'root';
|
||||
label = {
|
||||
label: 'root'
|
||||
};
|
||||
handle = '0';
|
||||
parentHandle = null;
|
||||
collapsibleState = 2;
|
||||
|
||||
@@ -159,8 +159,8 @@ export class TreeComponentRenderer extends Disposable implements IRenderer {
|
||||
|
||||
private renderNode(treeNode: ITreeComponentItem, templateData: TreeDataTemplate): void {
|
||||
let label = treeNode.label;
|
||||
templateData.label.textContent = label;
|
||||
templateData.root.title = label;
|
||||
templateData.label.textContent = label.label;
|
||||
templateData.root.title = label.label;
|
||||
templateData.checkboxState = this.getCheckboxState(treeNode);
|
||||
templateData.enableCheckbox = treeNode.enabled;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { WebviewElement, WebviewOptions } from 'vs/workbench/parts/webview/electron-browser/webviewElement';
|
||||
import URI, { UriComponents } from 'vs/base/common/uri';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
|
||||
@@ -77,8 +77,6 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
private _createWebview(): void {
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this.partService.getContainer(Parts.EDITOR_PART),
|
||||
this.contextKey,
|
||||
this.findInputFocusContextKey,
|
||||
{
|
||||
allowScripts: true,
|
||||
enableWrappedPostMessage: true
|
||||
|
||||
@@ -43,10 +43,10 @@ export class CellToggleMoreActions {
|
||||
if (this._moreActionsElement.childNodes.length > 0) {
|
||||
this._moreActionsElement.removeChild(this._moreActionsElement.childNodes[0]);
|
||||
}
|
||||
this._moreActions = new ActionBar(this._moreActionsElement, { orientation: ActionsOrientation.VERTICAL, isMenu: true });
|
||||
this._moreActions = new ActionBar(this._moreActionsElement, { orientation: ActionsOrientation.VERTICAL });
|
||||
this._moreActions.context = { target: this._moreActionsElement };
|
||||
let validActions = this._actions.filter(a => a.canRun(context));
|
||||
this._moreActions.push(this.instantiationService.createInstance(ToggleMoreWidgetAction, validActions, context), { icon: true, label: false });
|
||||
this._moreActions.push(this.instantiationService.createInstance(ToggleMoreWidgetAction, validActions, context), { icon: true, label: false, isMenu: true });
|
||||
}
|
||||
|
||||
public toggleVisible(visible: boolean): void {
|
||||
|
||||
@@ -248,9 +248,8 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
|
||||
|
||||
private updateLanguageMode(): void {
|
||||
if (this._editorModel && this._editor) {
|
||||
this._modeService.getOrCreateMode(this.cellModel.language).then((modeValue) => {
|
||||
this._modelService.setMode(this._editorModel, modeValue);
|
||||
});
|
||||
let modeValue = this._modeService.create(this.cellModel.language);
|
||||
this._modelService.setMode(this._editorModel, modeValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as themeColors from 'vs/workbench/common/theme';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
|
||||
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import { nb } from 'sqlops';
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
import { ICellModelOptions, IModelFactory, FutureInternal, CellExecutionState } from './modelInterfaces';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import { nb } from 'sqlops';
|
||||
import * as nls from 'vs/nls';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
|
||||
import { IClientSession, IKernelPreference, IClientSessionOptions } from './modelInterfaces';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { nb } from 'sqlops';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
import { CellType, NotebookChangeType } from 'sql/parts/notebook/models/contracts';
|
||||
|
||||
@@ -21,7 +21,7 @@ import { NotebookContexts } from 'sql/parts/notebook/models/notebookContexts';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { INotification, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ISingleNotebookEditOperation } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { fillInActions, LabeledMenuItemActionItem } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IHistoryService } from 'vs/workbench/services/history/common/history';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
@@ -397,7 +397,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
private getLastActiveFilePath(untitledResource: URI): string {
|
||||
let fileName = untitledResource.path + '.' + DEFAULT_NOTEBOOK_FILETYPE.toLocaleLowerCase();
|
||||
|
||||
let lastActiveFile = this.historyService.getLastActiveFile();
|
||||
let lastActiveFile = this.historyService.getLastActiveFile(Schemas.file);
|
||||
if (lastActiveFile) {
|
||||
return URI.file(paths.join(paths.dirname(lastActiveFile.fsPath), fileName)).fsPath;
|
||||
}
|
||||
@@ -564,7 +564,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
if (this._model.cells.findIndex(c => c.cellUri.toString() === uriString) > -1) {
|
||||
return cell.runCell(this.notificationService);
|
||||
} else {
|
||||
return Promise.reject<boolean>(new Error(localize('cellNotFound', 'cell with URI {0} was not found in this model', uriString)));
|
||||
return Promise.reject(new Error(localize('cellNotFound', 'cell with URI {0} was not found in this model', uriString)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
import { bootstrapAngular } from 'sql/services/bootstrap/bootstrapService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -17,6 +16,8 @@ import { NotebookInput } from 'sql/parts/notebook/notebookInput';
|
||||
import { NotebookModule } from 'sql/parts/notebook/notebook.module';
|
||||
import { NOTEBOOK_SELECTOR } from 'sql/parts/notebook/notebook.component';
|
||||
import { INotebookParams, DEFAULT_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { $ } from 'sql/base/browser/builder';
|
||||
|
||||
export class NotebookEditor extends BaseEditor {
|
||||
|
||||
@@ -27,8 +28,9 @@ export class NotebookEditor extends BaseEditor {
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(NotebookEditor.ID, telemetryService, themeService);
|
||||
super(NotebookEditor.ID, telemetryService, themeService, storageService);
|
||||
}
|
||||
|
||||
public get notebookInput(): NotebookInput {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { EditorInput, EditorModel, ConfirmResult } from 'vs/workbench/common/editor';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import * as sqlops from 'sqlops';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import { JSONObject } from '../../models/jsonext';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
/**
|
||||
* The namespace for URL-related functions.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { default as AnsiUp } from 'ansi_up';
|
||||
import { IRenderMime } from './common/renderMimeInterfaces';
|
||||
import { URLExt } from './common/url';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export const SERVICE_ID = 'oeShimService';
|
||||
export const IOEShimService = createDecorator<IOEShimService>(SERVICE_ID);
|
||||
@@ -137,9 +138,11 @@ export class OEShimService implements IOEShimService {
|
||||
parentHandle: node.parent.id,
|
||||
handle,
|
||||
collapsibleState: node.isAlwaysLeaf ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
||||
label: node.label,
|
||||
icon,
|
||||
iconDark,
|
||||
label: {
|
||||
label: node.label
|
||||
},
|
||||
icon: URI.parse(icon),
|
||||
iconDark: URI.parse(iconDark),
|
||||
childProvider: node.childProvider || parentNode.childProvider,
|
||||
providerHandle: parentNode.childProvider,
|
||||
payload: node.payload || parentNode.payload,
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'vs/css!sql/media/actionBarLabel';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { localize } from 'vs/nls';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ToggleViewletAction } from 'vs/workbench/browser/viewlet';
|
||||
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
@@ -17,6 +17,8 @@ import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/co
|
||||
import { VIEWLET_ID } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ConnectionViewlet } from 'sql/workbench/parts/connection/electron-browser/connectionViewlet';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { ToggleViewletAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
|
||||
// Viewlet Action
|
||||
export class OpenConnectionsViewletAction extends ToggleViewletAction {
|
||||
@@ -27,9 +29,9 @@ export class OpenConnectionsViewletAction extends ToggleViewletAction {
|
||||
id: string,
|
||||
label: string,
|
||||
@IViewletService viewletService: IViewletService,
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService
|
||||
@IPartService partService: IPartService
|
||||
) {
|
||||
super(id, label, VIEWLET_ID, viewletService, editorGroupService);
|
||||
super(viewletDescriptor, partService, viewletService);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
import 'vs/css!./media/serverGroupDialog';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { Checkbox } from 'vs/base/browser/ui/checkbox/checkbox';
|
||||
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
|
||||
@@ -59,7 +59,7 @@ export class OEAction extends ExecuteCommandAction {
|
||||
super(id, label, commandService);
|
||||
}
|
||||
|
||||
public async run(actionContext: any): TPromise<boolean> {
|
||||
public async run(actionContext: any): Promise<boolean> {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ export class OEScriptSelectAction extends ScriptSelectAction {
|
||||
super(id, label, _queryEditorService, _connectionManagementService, _scriptingService);
|
||||
}
|
||||
|
||||
public async run(actionContext: any): TPromise<boolean> {
|
||||
public async run(actionContext: any): Promise<boolean> {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
if (actionContext instanceof ObjectExplorerActionsContext) {
|
||||
//set objectExplorerTreeNode for context menu clicks
|
||||
@@ -213,7 +213,7 @@ export class OEEditDataAction extends EditDataAction {
|
||||
super(id, label, _queryEditorService, _connectionManagementService, _scriptingService);
|
||||
}
|
||||
|
||||
public async run(actionContext: any): TPromise<boolean> {
|
||||
public async run(actionContext: any): Promise<boolean> {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
if (actionContext instanceof ObjectExplorerActionsContext) {
|
||||
//set objectExplorerTreeNode for context menu clicks
|
||||
@@ -247,7 +247,7 @@ export class OEScriptCreateAction extends ScriptCreateAction {
|
||||
super(id, label, _queryEditorService, _connectionManagementService, _scriptingService, _errorMessageService);
|
||||
}
|
||||
|
||||
public async run(actionContext: any): TPromise<boolean> {
|
||||
public async run(actionContext: any): Promise<boolean> {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
if (actionContext instanceof ObjectExplorerActionsContext) {
|
||||
//set objectExplorerTreeNode for context menu clicks
|
||||
@@ -283,7 +283,7 @@ export class OEScriptExecuteAction extends ScriptExecuteAction {
|
||||
super(id, label, _queryEditorService, _connectionManagementService, _scriptingService, _errorMessageService);
|
||||
}
|
||||
|
||||
public async run(actionContext: any): TPromise<boolean> {
|
||||
public async run(actionContext: any): Promise<boolean> {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
if (actionContext instanceof ObjectExplorerActionsContext) {
|
||||
//set objectExplorerTreeNode for context menu clicks
|
||||
@@ -319,7 +319,7 @@ export class OEScriptAlterAction extends ScriptAlterAction {
|
||||
super(id, label, _queryEditorService, _connectionManagementService, _scriptingService, _errorMessageService);
|
||||
}
|
||||
|
||||
public async run(actionContext: any): TPromise<boolean> {
|
||||
public async run(actionContext: any): Promise<boolean> {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
if (actionContext instanceof ObjectExplorerActionsContext) {
|
||||
//set objectExplorerTreeNode for context menu clicks
|
||||
@@ -355,7 +355,7 @@ export class OEScriptDeleteAction extends ScriptDeleteAction {
|
||||
super(id, label, _queryEditorService, _connectionManagementService, _scriptingService, _errorMessageService);
|
||||
}
|
||||
|
||||
public async run(actionContext: any): TPromise<boolean> {
|
||||
public async run(actionContext: any): Promise<boolean> {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
if (actionContext instanceof ObjectExplorerActionsContext) {
|
||||
//set objectExplorerTreeNode for context menu clicks
|
||||
|
||||
@@ -59,29 +59,29 @@ export class ServerTreeActionProvider extends ContributableActionProvider {
|
||||
/**
|
||||
* Return actions given an element in the tree
|
||||
*/
|
||||
public getActions(tree: ITree, element: any): TPromise<IAction[]> {
|
||||
public getActions(tree: ITree, element: any): IAction[] {
|
||||
if (element instanceof ConnectionProfile) {
|
||||
return TPromise.as(this.getConnectionActions(tree, element));
|
||||
return this.getConnectionActions(tree, element);
|
||||
}
|
||||
if (element instanceof ConnectionProfileGroup) {
|
||||
return TPromise.as(this.getConnectionProfileGroupActions(tree, element));
|
||||
return this.getConnectionProfileGroupActions(tree, element);
|
||||
}
|
||||
if (element instanceof TreeNode) {
|
||||
return TPromise.as(this.getObjectExplorerNodeActions({
|
||||
return this.getObjectExplorerNodeActions({
|
||||
tree: tree,
|
||||
profile: element.getConnectionProfile(),
|
||||
treeNode: element
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
return TPromise.as([]);
|
||||
return [];
|
||||
}
|
||||
|
||||
public hasSecondaryActions(tree: ITree, element: any): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public getSecondaryActions(tree: ITree, element: any): TPromise<IAction[]> {
|
||||
public getSecondaryActions(tree: ITree, element: any): IAction[] {
|
||||
return super.getSecondaryActions(tree, element);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import 'vs/css!./media/serverTreeActions';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as builder from 'vs/base/browser/builder';
|
||||
import * as builder from 'sql/base/browser/builder';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
@@ -100,7 +100,7 @@ export class ServerTreeView {
|
||||
if (!this._connectionManagementService.hasRegisteredServers()) {
|
||||
this._activeConnectionsFilterAction.enabled = false;
|
||||
this._buttonSection = $('div.button-section').appendTo(container);
|
||||
var connectButton = new Button(this._buttonSection);
|
||||
var connectButton = new Button(this._buttonSection.getHTMLElement());
|
||||
connectButton.label = localize('serverTree.addConnection', 'Add Connection');
|
||||
this._toDispose.push(attachButtonStyler(connectButton, this._themeService));
|
||||
this._toDispose.push(connectButton.onDidClick(() => {
|
||||
@@ -221,7 +221,7 @@ export class ServerTreeView {
|
||||
this._treeSelectionHandler.onTreeActionStateChange(false);
|
||||
});
|
||||
});
|
||||
}).done(null, errors.onUnexpectedError);
|
||||
}).then(null, errors.onUnexpectedError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ export class ServerTreeView {
|
||||
} else {
|
||||
treeInput = filteredResults[0];
|
||||
}
|
||||
this._tree.setInput(treeInput).done(() => {
|
||||
this._tree.setInput(treeInput).then(() => {
|
||||
if (this.messages.isHidden()) {
|
||||
self._tree.getFocus();
|
||||
self._tree.expandAll(ConnectionProfileGroup.getSubgroups(treeInput));
|
||||
@@ -346,7 +346,7 @@ export class ServerTreeView {
|
||||
// Add all connections to tree root and set tree input
|
||||
let treeInput = new ConnectionProfileGroup('searchroot', undefined, 'searchroot', undefined, undefined);
|
||||
treeInput.addConnections(filteredResults);
|
||||
this._tree.setInput(treeInput).done(() => {
|
||||
this._tree.setInput(treeInput).then(() => {
|
||||
if (this.messages.isHidden()) {
|
||||
self._tree.getFocus();
|
||||
self._tree.expandAll(ConnectionProfileGroup.getSubgroups(treeInput));
|
||||
|
||||
@@ -16,7 +16,7 @@ export class TreeSelectionHandler {
|
||||
progressRunner: IProgressRunner;
|
||||
|
||||
private _clicks: number = 0;
|
||||
private _doubleClickTimeoutId: number = -1;
|
||||
private _doubleClickTimeoutTimer: NodeJS.Timer = undefined;
|
||||
|
||||
constructor( @IProgressService private _progressService: IProgressService) {
|
||||
|
||||
@@ -47,8 +47,8 @@ export class TreeSelectionHandler {
|
||||
}
|
||||
|
||||
// clear pending click timeouts to avoid sending multiple events on double-click
|
||||
if (this._doubleClickTimeoutId !== -1) {
|
||||
clearTimeout(this._doubleClickTimeoutId);
|
||||
if (this._doubleClickTimeoutTimer) {
|
||||
clearTimeout(this._doubleClickTimeoutTimer);
|
||||
}
|
||||
|
||||
let isKeyboard = event && event.payload && event.payload.origin === 'keyboard';
|
||||
@@ -56,14 +56,14 @@ export class TreeSelectionHandler {
|
||||
// grab the current selection for use later
|
||||
let selection = tree.getSelection();
|
||||
|
||||
this._doubleClickTimeoutId = setTimeout(() => {
|
||||
this._doubleClickTimeoutTimer = setTimeout(() => {
|
||||
// don't send tree update events while dragging
|
||||
if (!TreeUpdateUtils.isInDragAndDrop) {
|
||||
let isDoubleClick = this._clicks > 1;
|
||||
this.handleTreeItemSelected(connectionManagementService, objectExplorerService, isDoubleClick, isKeyboard, selection, tree, connectionCompleteCallback);
|
||||
}
|
||||
this._clicks = 0;
|
||||
this._doubleClickTimeoutId = -1;
|
||||
this._doubleClickTimeoutTimer = undefined;
|
||||
}, 300);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export class TreeUpdateUtils {
|
||||
treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService, providers);
|
||||
}
|
||||
|
||||
tree.setInput(treeInput).done(() => {
|
||||
tree.setInput(treeInput).then(() => {
|
||||
// Make sure to expand all folders that where expanded in the previous session
|
||||
if (targetsToExpand) {
|
||||
tree.expandAll(targetsToExpand);
|
||||
|
||||
@@ -238,9 +238,9 @@ export class ProfilerFindNext implements IEditorAction {
|
||||
|
||||
constructor(private profiler: IProfilerController) { }
|
||||
|
||||
run(): TPromise<void> {
|
||||
run(): Promise<void> {
|
||||
this.profiler.findNext();
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
isSupported(): boolean {
|
||||
@@ -255,9 +255,9 @@ export class ProfilerFindPrevious implements IEditorAction {
|
||||
|
||||
constructor(private profiler: IProfilerController) { }
|
||||
|
||||
run(): TPromise<void> {
|
||||
run(): Promise<void> {
|
||||
this.profiler.findPrevious();
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
isSupported(): boolean {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import * as TelemetryKeys from 'sql/common/telemetryKeys';
|
||||
import { attachButtonStyler, attachModalDialogStyler, attachInputBoxStyler } from 'sql/platform/theme/common/styler';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
|
||||
@@ -88,7 +88,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
|
||||
private _resizeSash: Sash;
|
||||
|
||||
private searchTimeoutHandle: number;
|
||||
private searchTimeoutHandle: NodeJS.Timer;
|
||||
|
||||
constructor(
|
||||
tableController: ITableController,
|
||||
@@ -329,13 +329,13 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
private _onFindInputKeyDown(e: IKeyboardEvent): void {
|
||||
|
||||
if (e.equals(KeyCode.Enter)) {
|
||||
this._tableController.getAction(ACTION_IDS.FIND_NEXT).run().done(null, onUnexpectedError);
|
||||
this._tableController.getAction(ACTION_IDS.FIND_NEXT).run().then(null, onUnexpectedError);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.equals(KeyMod.Shift | KeyCode.Enter)) {
|
||||
this._tableController.getAction(ACTION_IDS.FIND_NEXT).run().done(null, onUnexpectedError);
|
||||
this._tableController.getAction(ACTION_IDS.FIND_NEXT).run().then(null, onUnexpectedError);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
|
||||
private _buildFindPart(): HTMLElement {
|
||||
// Find input
|
||||
this._findInput = this._register(new FindInput(null, this._contextViewProvider, {
|
||||
this._findInput = this._register(new FindInput(null, this._contextViewProvider, true, {
|
||||
width: FIND_INPUT_AREA_WIDTH,
|
||||
label: NLS_FIND_INPUT_LABEL,
|
||||
placeholder: NLS_FIND_INPUT_PLACEHOLDER,
|
||||
@@ -434,7 +434,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
label: NLS_PREVIOUS_MATCH_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.PreviousMatchFindAction),
|
||||
className: 'previous',
|
||||
onTrigger: () => {
|
||||
this._tableController.getAction(ACTION_IDS.FIND_PREVIOUS).run().done(null, onUnexpectedError);
|
||||
this._tableController.getAction(ACTION_IDS.FIND_PREVIOUS).run().then(null, onUnexpectedError);
|
||||
},
|
||||
onKeyDown: (e) => { }
|
||||
}));
|
||||
@@ -444,7 +444,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
label: NLS_NEXT_MATCH_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.NextMatchFindAction),
|
||||
className: 'next',
|
||||
onTrigger: () => {
|
||||
this._tableController.getAction(ACTION_IDS.FIND_NEXT).run().done(null, onUnexpectedError);
|
||||
this._tableController.getAction(ACTION_IDS.FIND_NEXT).run().then(null, onUnexpectedError);
|
||||
},
|
||||
onKeyDown: (e) => { }
|
||||
}));
|
||||
|
||||
@@ -28,6 +28,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { textFormatter } from 'sql/parts/grid/services/sharedServices';
|
||||
import { PROFILER_MAX_MATCHES } from 'sql/parts/profiler/editor/controller/profilerFindWidget';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IStatusbarService, StatusbarAlignment, IStatusbarEntry } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
@@ -62,9 +63,10 @@ export class ProfilerTableEditor extends BaseEditor implements IProfilerControll
|
||||
@IKeybindingService private _keybindingService: IKeybindingService,
|
||||
@IContextKeyService private _contextKeyService: IContextKeyService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IStatusbarService private _statusbarService: IStatusbarService
|
||||
) {
|
||||
super(ProfilerTableEditor.ID, telemetryService, _themeService);
|
||||
super(ProfilerTableEditor.ID, telemetryService, _themeService, storageService);
|
||||
this._actionMap[ACTION_IDS.FIND_NEXT] = this._instantiationService.createInstance(ProfilerFindNext, this);
|
||||
this._actionMap[ACTION_IDS.FIND_PREVIOUS] = this._instantiationService.createInstance(ProfilerFindPrevious, this);
|
||||
this._showStatusBarItem = true;
|
||||
|
||||
@@ -17,12 +17,11 @@ import { CONTEXT_PROFILER_EDITOR, PROFILER_TABLE_COMMAND_SEARCH } from './interf
|
||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
import { textFormatter } from 'sql/parts/grid/services/sharedServices';
|
||||
import { ProfilerResourceEditor } from './profilerResourceEditor';
|
||||
|
||||
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -38,6 +37,7 @@ import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { DARK, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IView, SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
@@ -158,9 +158,10 @@ export class ProfilerEditor extends BaseEditor {
|
||||
@IProfilerService private _profilerService: IProfilerService,
|
||||
@IContextKeyService private _contextKeyService: IContextKeyService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
@IEditorService editorService: IEditorService
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(ProfilerEditor.ID, telemetryService, themeService);
|
||||
super(ProfilerEditor.ID, telemetryService, themeService, storageService);
|
||||
this._profilerEditorContextKey = CONTEXT_PROFILER_EDITOR.bindTo(this._contextKeyService);
|
||||
|
||||
if (editorService) {
|
||||
@@ -462,7 +463,8 @@ export class ProfilerEditor extends BaseEditor {
|
||||
seedSearchStringFromGlobalClipboard: false,
|
||||
seedSearchStringFromSelection: (controller.getState().searchString.length === 0),
|
||||
shouldFocus: FindStartFocusAction.FocusFindInput,
|
||||
shouldAnimate: true
|
||||
shouldAnimate: true,
|
||||
updateSearchScope: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -21,7 +21,7 @@ import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { escape } from 'sql/base/common/strings';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { FilterData } from 'sql/parts/profiler/service/profilerFilter';
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import { FoldingController } from 'vs/editor/contrib/folding/folding';
|
||||
import { StandaloneCodeEditor } from 'vs/editor/standalone/browser/standaloneCodeEditor';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
|
||||
class ProfilerResourceCodeEditor extends StandaloneCodeEditor {
|
||||
|
||||
@@ -50,13 +51,13 @@ export class ProfilerResourceEditor extends BaseTextEditor {
|
||||
@IStorageService storageService: IStorageService,
|
||||
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IModeService modeService: IModeService,
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IEditorService protected editorService: IEditorService,
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService,
|
||||
@IWindowService windowService: IWindowService
|
||||
|
||||
) {
|
||||
super(ProfilerResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorService, editorGroupService);
|
||||
super(ProfilerResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorService, editorGroupService, windowService);
|
||||
}
|
||||
|
||||
public createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
|
||||
|
||||
@@ -10,7 +10,6 @@ import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import { IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { IQuickOpenService, IPickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import errors = require('vs/base/common/errors');
|
||||
@@ -25,8 +24,9 @@ import { DidChangeLanguageFlavorParams } from 'sqlops';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||
|
||||
export interface ISqlProviderEntry extends IPickOpenEntry {
|
||||
export interface ISqlProviderEntry extends IQuickPickItem {
|
||||
providerId: string;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IEditorService private _editorService: EditorServiceImpl,
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService,
|
||||
@IQuickInputService private _quickInputService: IQuickInputService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
) {
|
||||
this._sqlStatusEditors = {};
|
||||
@@ -96,7 +96,7 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
|
||||
private _onSelectionClick() {
|
||||
const action = this._instantiationService.createInstance(ChangeFlavorAction, ChangeFlavorAction.ID, ChangeFlavorAction.LABEL);
|
||||
|
||||
action.run().done(null, errors.onUnexpectedError);
|
||||
action.run().then(null, errors.onUnexpectedError);
|
||||
action.dispose();
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ export class ChangeFlavorAction extends Action {
|
||||
actionId: string,
|
||||
actionLabel: string,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService,
|
||||
@IQuickInputService private _quickInputService: IQuickInputService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
) {
|
||||
@@ -200,7 +200,7 @@ export class ChangeFlavorAction extends Action {
|
||||
];
|
||||
|
||||
// TODO: select the current language flavor
|
||||
return this._quickOpenService.pick(ProviderOptions, { placeHolder: nls.localize('pickSqlProvider', "Select SQL Language Provider"), autoFocus: { autoFocusIndex: 0 } }).then(provider => {
|
||||
return this._quickInputService.pick(ProviderOptions, { placeHolder: nls.localize('pickSqlProvider', "Select SQL Language Provider") }).then(provider => {
|
||||
if (provider) {
|
||||
activeEditor = this._editorService.activeControl;
|
||||
const editorWidget = getCodeEditor(activeEditor);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { EditorInput, EditorModel, ConfirmResult, EncodingMode, IEncodingSupport } from 'vs/workbench/common/editor';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
@@ -19,7 +19,7 @@ import { join, normalize } from 'vs/base/common/paths';
|
||||
import { writeFile } from 'vs/base/node/pfs';
|
||||
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -186,7 +186,7 @@ export class SaveImageAction extends Action {
|
||||
|
||||
private decodeBase64Image(data: string): Buffer {
|
||||
let matches = data.match(/^data:([A-Za-z-+\/]+);base64,(.+)$/);
|
||||
return new Buffer(matches[2], 'base64');
|
||||
return Buffer.from(matches[2], 'base64');
|
||||
}
|
||||
|
||||
private promptForFilepath(): TPromise<string> {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user