Archived
Merge VS Code 1.26.1 (#2394)
* Squash merge commits for 1.26 (#1) (#2323) * Polish tag search as per feedback (#55269) * Polish tag search as per feedback * Updated regex * Allow users to opt-out of features that send online requests in the background (#55097) * settings sweep #54690 * Minor css tweaks to enable eoverflow elipsis in more places (#55277) * fix an issue with titlebarheight when not scaling with zoom * Settings descriptions update #54690 * fixes #55209 * Settings editor - many padding fixes * More space above level 2 label * Fixing Cannot debug npm script using Yarn #55103 * Settings editor - show ellipsis when description overflows * Settings editor - ... fix measuring around links, relayout * Setting descriptions * Settings editor - fix ... for some short lines, fix select container width * Settings editor - overlay trees so scrollable shadow is full width * Fix #54133 - missing extension settings after reload * Settings color token description tweak * Settings editor - disable overflow indicator temporarily, needs to be faster * Added command to Run the selected npm script * fixes #54452 * fixes #54929 * fixes #55248 * prefix command with extension name * Contribute run selected to the context menu * node-debug@1.26.6 * Allow terminal rendererType to be swapped out at runtime Part of #53274 Fixes #55344 * Settings editor - fix not focusing search when restoring editor setInput must be actually async. Will be fixed naturally when we aren't using winJS promises... * Settings editor - TOC should only expand the section with a selected item * Bump node-debug2 * Settings editor - Tree focus outlines * Settings editor - don't blink the scrollbar when toc selection changes And hide TOC correctly when the editor is narrow * Settings editor - header rows should not be selectable * fixes #54877 * change debug assignee to isi * Settings sweep (#54690) * workaround for #55051 * Settings sweep (#54690) * settings sweep #54690 * Don't try closing tags when you type > after another > * Describe what implementation code lens does Fixes #55370 * fix javadoc formatter setting description * fixes #55325 * update to officical TS version * Settings editor - Even more padding, use semibold instead of bold * Fix #55357 - fix TOC twistie * fixes #55288 * explorer: refresh on di change file system provider registration fixes #53256 * Disable push to Linux repo to test standalone publisher * New env var to notify log level to extensions #54001 * Disable snippets in extension search (when not in suggest dropdown) (#55281) * Disable snippits in extension search (when not in suggest dropdown) * Add monaco input contributions * Fix bug preventing snippetSuggestions from taking effect in sub-editors * Latest emmet helper to fix #52366 * Fix comment updates for threads within same file * Allow extensions to log telemetry to log files #54001 * Pull latest css grammar * files.exclude control - use same style for "add" vs "edit" * files.exclude control - focus/keyboard behavior * don't show menubar too early * files.exclude - better styling * Place cursor at end of extensions search box on autofill (#55254) * Place cursor at end of extensions search box on autofill * Use position instead of selection * fix linux build issue (empty if block) * Settings editor - fix extension category prefixes * Settings editor - add simple ellipsis for first line that overflows, doesn't cover case when first line does not overflow but there is more text, TODO * File/Text search provider docs * Fixes #52655 * Include epoch (#55008) * Fixes #53385 * Fixes #49480 * VS Code Insiders (Users) not opening Fixes #55353 * Better handling of the case when the extension host fails to start * Fixes #53966 * Remove confusing Start from wordPartLeft commands ID * vscode-xterm@3.6.0-beta12 Fixes #55488 * Initial size is set to infinity!! Fixes #55461 * Polish embeddedEditorBackground * configuration service misses event * Fix #55224 - fix duplicate results in multiroot workspace from splitting the diskseach query * Select all not working in issue reporter on mac, fixes #55424 * Disable fuzzy matching for extensions autosuggest (#55498) * Fix clipping of extensions search border in some third party themes (#55504) * fixes #55538 * Fix bug causing an aria alert to not be shown the third time (and odd numbers thereafter) * Settings editor - work around rendering glitch with webkit-line-clamp * Settings editor - revert earlier '...' changes * Settings editor - move enumDescription to its own div, because it disturbs -webkit-line-clamp for some reason * Settings editor - better overflow indicator * Don't show existing filters in autocomplete (#55495) * Dont show existing filters in autocomplete * Simplify * Settings Editor: Add aria labels for input elements Fixes: #54836 (#55543) * fixes #55223 * Update vscode-css-languageservice to 3.0.10-next.1 * Fix #55509 - settings navigation * Fix #55519 * Fix #55520 * FIx #55524 * Fix #55556 - include wordSeparators in all search queries, so findTextInFiles can respect isWordMatch correctly * oss updates for endgame * Fix unit tests * fixes #55522 * Avoid missing manifest error from bubbling up #54757 * Settings format crawl * Search provider - Fix FileSearchProvider to return array, not progress * Fix #55598 * Settings editor - fix NPE rendering settings with no description * dont render inden guides in search box (#55600) * fixes #55454 * More settings crawl * Another change for #55598 - maxResults applies to FileSearch and TextSearch but not FileIndex * Fix FileSearchProvider unit tests for progress change * fixes #55561 * Settings description update for #54690 * Update setting descriptions for online services * Minor edits * fixes #55513 * fixes #55451 * Fix #55612 - fix findTextInFiles cancellation * fixes #55539 * More setting description tweaks * Setting to disable online experiments #54354 * fixes #55507 * fixes #55515 * Show online services action only in Insiders for now * Settings editor - change toc behavior default to 'filter' * Settings editor - nicer filter count style during search * Fix #55617 - search viewlet icons * Settings editor - better styling for element count indicator * SearchProvider - fix NPE when searching extraFileResources * Allow extends to work without json suffix Fixes #16905 * Remove accessability options logic entirely Follow up on #55451 * use latest version of DAP * fixes #55490 * fixes #55122 * fixes #52332 * Avoid assumptions about git: URIs (fixes #36236) * relative path for descriptions * resourece: get rid of isFile context key fixes #48275 * Register previous ids for compatibility (#53497) * more tuning for #48275 * no need to always re-read "files explorer" fixes #52003 * read out active composites properly fixes #51967 * Update link colors for hc theme to meet color contrast ratio, fixes #55651 Also updated link color for `textLinkActiveForeground` to be the same as `textLinkForeground` as it wasn't properly updated * detect 'winpty-agent.exe'; fixes #55672 * node-debug@1.26.7 * reset counter on new label * Settings editor - fix multiple setting links in one description * Settings editor - color code blocks in setting descriptions, fix #55532 * Settings editor - hover color in TOC * Settings editor - fix navigation NPE * Settings editor - fix text control width * Settings editor - maybe fix #55684 * Fix bug causing cursor to not move on paste * fixes #53582 * Use ctrlCmd instead of ctrl for go down from search box * fixes #55264 * fixes #55456 * filter for spcaes before triggering search (#55611) * Fix #55698 - don't lose filtered TOC counts when refreshing TOC * fixes #55421 * fixes #28979 * fixes #55576 * only add check for updates to windows/linux help * readonly files: append decoration to label fixes #53022 * debug: do not show toolbar while initialising fixes #55026 * Opening launch.json should not activate debug extensions fixes #55029 * fixes #55435 * fixes #55434 * fixes #55439 * trigger menu only on altkey up * Fix #50555 - fix settings editor memory leak * Fix #55712 - no need to focus 'a' anymore when restoring control focus after tree render * fixes #55335 * proper fix for readonly model fixes #53022 * improve FoldingRangeKind spec (for #55686) * Use class with static fields (fixes #55494) * Fixes #53671 * fixes #54630 * [html] should disable ionic suggestions by default. Currently forces deprecated Ionic v1 suggestions in .html files while typing. Fixes #53324 * cleanup deps * debug issues back to andre * update electron for smoketest * Fix #55757 - prevent settings tabs from overflowing * Fix #53897 - revert setting menu defaults to old editor * Add enum descriptions to `typescript.preferences.importModuleSpecifier` * Fix #55767 - leaking style elements from settings editor * Fix #55521 - prevent flashing when clicking in exclude control * Update Git modified color for contrast ratio, fixes #53140 * Revert "Merge branch 'master' of github.com:Microsoft/vscode" This reverts commit bf46b6bfbae0cab99c2863e1244a916181fa9fbc, reversing changes made to e275a424483dfb4ed33b428c97d5e2c441d6b917. * Revert "Revert "Merge branch 'master' of github.com:Microsoft/vscode"" This reverts commit 53949d963f39e40757557c6526332354a31d9154. * don't ask to install an incomplete menu * Fix NPE in terminal AccessibilityManager Fixes #55744 * don't display fallback menu unless we've closed the last window * fixes #55547 * Fix smoke tests for extension search box * Update OSSREADME.json for Electron 2.0.5 * Update distro Includes Chromium license changes * fix #55455 * fix #55865 * fixes #55893 * Fix bug causing workspace recommendations to go away upon ignoring a recommendation (#55805) * Fix bug causing workspace recommendations to go away upon ignoring a recommendation * ONly show on @recommended or @recommended:workspace * Make more consistant * Fix #55911 * Understand json activity (#55926) * Understand json file activity * Refactoring * adding composer.json * Distro update for experiments * use terminal.processId for auto-attach; fixes #55918 * Reject invalid URI with vscode.openFolder (for #55891) * improve win32 setup system vs user detection fixes #55840 fixes #55840 delay winreg import related to #55840 show notification earlier related to #55840 fix #55840 update inno setup message related to #55840 * Fix #55593 - this code only operates on local paths, so use fsPath and Uri.file instead * Bring back the old menu due to electron 2.0 issues (#55913) * add the old menu back for native menus * make menu labels match * `vscode.openFolder`: treat missing URI schema gracefully (for #55891) * delay EH reattach; fixes #55955 * Mark all json files under appSettingsHome as settings * Use localized strings for telemetry opt-out * Exception when saving file editor opened from remote file provider (fixes #55051) * Remove terminal menu from stable Fixes 56003 * VSCode Insiders crashes on open with TypeError: Cannot read property 'lastIndexOf' of undefined. Fixes #54933 * improve fix for #55891 * fix #55916 * Improve #55891 * increase EH debugging restart delay; fixes #55955 * Revert "Don't include non-resource entries in history quick pick" This reverts commit 37209a838e9f7e9abe6dc53ed73cdf1e03b72060. * Diff editor: horizontal scrollbar height is smaller (fixes #56062) * improve openFolder uri fix (correctly treat backslashes) * fixes #56116 repair ipc for native menubar keybindings * Fix #56240 - Open the JSON settings editor instead of the UI editor * Fix #55536 * uriDisplay: if no formatter is registered fall back to getPathlabel fixes #56104 * VSCode hangs when opening python file. Fixes #56377 * VS Code Hangs When Opening Specific PowerShell File. Fixes #56430 * Fix #56433 - search extraFileResources even when no folders open * Workaround #55649 * Fix in master #56371 * Fix tests #56371 * Fix in master #56317 * increase version to 1.26.1 * Fixes #56387: Handle SIGPIPE in extension host * fixes #56185 * Fix merge issues (part 1) * Fix build breaks (part 1) * Build breaks (part 2) * Build breaks (part 3) * More build breaks (part 4) * Fix build breaks (part 5) * WIP * Fix menus * Render query result and message panels (#2363) * Put back query editor hot exit changes * Fix grid changes that broke profiler (#2365) * Update APIs for saving query editor state * Fix restore view state for profiler and edit data * Updating custom default themes to support 4.5:1 contrast ratio * Test updates * Fix Extension Manager and Windows Setup * Update license headers * Add appveyor and travis files back * Fix hidden modal dropdown issue
This commit is contained in:
Vendored
+16
-2
@@ -29,6 +29,8 @@ function readFile(file) {
|
||||
});
|
||||
}
|
||||
|
||||
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: {} };
|
||||
|
||||
@@ -46,8 +48,15 @@ if (nlsConfig._resolvedLanguagePackCoreLocation) {
|
||||
let json = JSON.parse(content);
|
||||
bundles[bundle] = json;
|
||||
cb(undefined, json);
|
||||
})
|
||||
.catch(cb);
|
||||
}).catch((error) => {
|
||||
try {
|
||||
if (nlsConfig._corruptedFile) {
|
||||
writeFile(nlsConfig._corruptedFile, 'corrupted').catch(function (error) { console.error(error); });
|
||||
}
|
||||
} finally {
|
||||
cb(error, undefined);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -60,6 +69,11 @@ loader.config({
|
||||
nodeCachedDataDir: process.env['VSCODE_NODE_CACHED_DATA_DIR_' + process.pid]
|
||||
});
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if (nlsConfig.pseudo) {
|
||||
loader(['vs/nls'], function (nlsPlugin) {
|
||||
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
|
||||
|
||||
+45
@@ -3,6 +3,51 @@
|
||||
* 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)
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
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');
|
||||
|
||||
+213
-225
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
let perf = require('./vs/base/common/performance');
|
||||
const perf = require('./vs/base/common/performance');
|
||||
perf.mark('main:started');
|
||||
|
||||
// Perf measurements
|
||||
@@ -12,6 +12,49 @@ 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 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');
|
||||
@@ -36,16 +79,41 @@ Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https:
|
||||
})();
|
||||
//#endregion
|
||||
|
||||
let app = require('electron').app;
|
||||
let fs = require('fs');
|
||||
let path = require('path');
|
||||
let minimist = require('minimist');
|
||||
let paths = require('./paths');
|
||||
const app = require('electron').app;
|
||||
|
||||
let args = minimist(process.argv, {
|
||||
string: ['user-data-dir', 'locale']
|
||||
// TODO@Ben Electron 2.0.x: prevent localStorage migration from SQLite to LevelDB due to issues
|
||||
app.commandLine.appendSwitch('disable-mojo-local-storage');
|
||||
|
||||
// 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();
|
||||
|
||||
// Set userData path before app 'ready' event and call to process.chdir
|
||||
app.setPath('userData', userDataPath);
|
||||
|
||||
//#region NLS
|
||||
function stripComments(content) {
|
||||
let regexp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
|
||||
let result = content.replace(regexp, function (match, m1, m2, m3, m4) {
|
||||
@@ -70,113 +138,58 @@ function stripComments(content) {
|
||||
return result;
|
||||
}
|
||||
|
||||
let _commit;
|
||||
function getCommit() {
|
||||
if (_commit) {
|
||||
return _commit;
|
||||
}
|
||||
if (_commit === null) {
|
||||
return undefined;
|
||||
}
|
||||
try {
|
||||
let productJson = require(path.join(__dirname, '../product.json'));
|
||||
if (productJson.commit) {
|
||||
_commit = productJson.commit;
|
||||
} else {
|
||||
_commit = null;
|
||||
}
|
||||
} catch (exp) {
|
||||
_commit = null;
|
||||
}
|
||||
return _commit || undefined;
|
||||
}
|
||||
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)));
|
||||
|
||||
function mkdirp(dir) {
|
||||
return mkdir(dir)
|
||||
.then(null, (err) => {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
let parent = path.dirname(dir);
|
||||
if (parent !== dir) { // if not arrived at root
|
||||
return mkdirp(parent)
|
||||
.then(() => {
|
||||
return mkdir(dir);
|
||||
});
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
return mkdir(dir).then(null, err => {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
const parent = path.dirname(dir);
|
||||
|
||||
function mkdir(dir) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.mkdir(dir, (err) => {
|
||||
if (err && err.code !== 'EEXIST') {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(dir);
|
||||
if (parent !== dir) { // if not arrived at root
|
||||
return mkdirp(parent).then(() => mkdir(dir));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
function exists(file) {
|
||||
return new Promise((resolve) => {
|
||||
fs.exists(file, (result) => {
|
||||
resolve(result);
|
||||
});
|
||||
function rimraf(location) {
|
||||
return lstat(location).then(stat => {
|
||||
if (stat.isDirectory() && !stat.isSymbolicLink()) {
|
||||
return readdir(location)
|
||||
.then(children => Promise.all(children.map(child => rimraf(path.join(location, child)))))
|
||||
.then(() => rmdir(location));
|
||||
} else {
|
||||
return unlink(location);
|
||||
}
|
||||
}, (err) => {
|
||||
if (err.code === 'ENOENT') {
|
||||
return void 0;
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
function readFile(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(file, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
function resolveJSFlags(...jsFlags) {
|
||||
|
||||
function writeFile(file, content) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.writeFile(file, content, 'utf8', (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve(undefined);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function touch(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let d = new Date();
|
||||
fs.utimes(file, d, d, (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve(undefined);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function resolveJSFlags() {
|
||||
let 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']}`);
|
||||
}
|
||||
if (jsFlags.length > 0) {
|
||||
return jsFlags.join(' ');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return jsFlags.length > 0 ? jsFlags.join(' ') : null;
|
||||
}
|
||||
|
||||
// Language tags are case insensitve however an amd loader is case sensitive
|
||||
@@ -190,8 +203,7 @@ function getUserDefinedLocale() {
|
||||
return Promise.resolve(locale.toLowerCase());
|
||||
}
|
||||
|
||||
let userData = app.getPath('userData');
|
||||
let localeConfig = path.join(userData, 'User', 'locale.json');
|
||||
let localeConfig = path.join(userDataPath, 'User', 'locale.json');
|
||||
return exists(localeConfig).then((result) => {
|
||||
if (result) {
|
||||
return readFile(localeConfig).then((content) => {
|
||||
@@ -210,8 +222,7 @@ function getUserDefinedLocale() {
|
||||
}
|
||||
|
||||
function getLanguagePackConfigurations() {
|
||||
let userData = app.getPath('userData');
|
||||
let configFile = path.join(userData, 'languagepacks.json');
|
||||
let configFile = path.join(userDataPath, 'languagepacks.json');
|
||||
try {
|
||||
return require(configFile);
|
||||
} catch (err) {
|
||||
@@ -250,8 +261,6 @@ function getNLSConfiguration(locale) {
|
||||
return Promise.resolve({ locale: locale, availableLanguages: {} });
|
||||
}
|
||||
|
||||
let userData = app.getPath('userData');
|
||||
|
||||
// We have a built version so we have extracted nls file. Try to find
|
||||
// the right file to use.
|
||||
|
||||
@@ -263,50 +272,21 @@ function getNLSConfiguration(locale) {
|
||||
|
||||
let initialLocale = locale;
|
||||
|
||||
function resolveLocale(locale) {
|
||||
while (locale) {
|
||||
let candidate = path.join(__dirname, 'vs', 'code', 'electron-main', 'main.nls.') + locale + '.js';
|
||||
if (fs.existsSync(candidate)) {
|
||||
return { locale: initialLocale, availableLanguages: { '*': locale } };
|
||||
} else {
|
||||
let index = locale.lastIndexOf('-');
|
||||
if (index > 0) {
|
||||
locale = locale.substring(0, index);
|
||||
} else {
|
||||
locale = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
perf.mark('nlsGeneration:start');
|
||||
let defaultResult = function(locale) {
|
||||
let isCoreLanguage = true;
|
||||
if (locale) {
|
||||
isCoreLanguage = ['de', 'es', 'fr', 'it', 'ja', 'ko', 'ru', 'zh-cn', 'zh-tw'].some((language) => {
|
||||
return locale === language || locale.startsWith(language + '-');
|
||||
});
|
||||
}
|
||||
if (isCoreLanguage) {
|
||||
let result = resolveLocale(locale);
|
||||
perf.mark('nlsGeneration:end');
|
||||
return Promise.resolve(result);
|
||||
} else {
|
||||
perf.mark('nlsGeneration:end');
|
||||
return Promise.resolve({ locale: locale, availableLanguages: {} });
|
||||
}
|
||||
|
||||
let defaultResult = function (locale) {
|
||||
perf.mark('nlsGeneration:end');
|
||||
return Promise.resolve({ locale: locale, availableLanguages: {} });
|
||||
};
|
||||
try {
|
||||
let commit = getCommit();
|
||||
let commit = product.commit;
|
||||
if (!commit) {
|
||||
return defaultResult(locale);
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
let configs = getLanguagePackConfigurations();
|
||||
if (!configs) {
|
||||
return defaultResult(locale);
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
let initialLocale = locale;
|
||||
locale = resolveLanguagePackLocale(configs, locale);
|
||||
if (!locale) {
|
||||
return defaultResult(initialLocale);
|
||||
@@ -314,72 +294,85 @@ function getNLSConfiguration(locale) {
|
||||
let packConfig = configs[locale];
|
||||
let mainPack;
|
||||
if (!packConfig || typeof packConfig.hash !== 'string' || !packConfig.translations || typeof (mainPack = packConfig.translations['vscode']) !== 'string') {
|
||||
return defaultResult(locale);
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
return exists(mainPack).then((fileExists) => {
|
||||
if (!fileExists) {
|
||||
return defaultResult(locale);
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
let packId = packConfig.hash + '.' + locale;
|
||||
let cacheRoot = path.join(userData, 'clp', packId);
|
||||
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 = {
|
||||
locale: initialLocale,
|
||||
availableLanguages: { '*': locale },
|
||||
_languagePackId: packId,
|
||||
_translationsConfigFile: translationsConfigFile,
|
||||
_cacheRoot: cacheRoot,
|
||||
_resolvedLanguagePackCoreLocation: coreLocation
|
||||
_resolvedLanguagePackCoreLocation: coreLocation,
|
||||
_corruptedFile: corruptedFile
|
||||
};
|
||||
return exists(coreLocation).then((fileExists) => {
|
||||
if (fileExists) {
|
||||
// We don't wait for this. No big harm if we can't touch
|
||||
touch(coreLocation).catch(() => {});
|
||||
perf.mark('nlsGeneration:end');
|
||||
return result;
|
||||
return exists(corruptedFile).then((corrupted) => {
|
||||
// The nls cache directory is corrupted.
|
||||
let toDelete;
|
||||
if (corrupted) {
|
||||
toDelete = rimraf(cacheRoot);
|
||||
} else {
|
||||
toDelete = Promise.resolve(undefined);
|
||||
}
|
||||
return mkdirp(coreLocation).then(() => {
|
||||
return Promise.all([readFile(path.join(__dirname, 'nls.metadata.json')), 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 = [];
|
||||
for (let bundle of bundles) {
|
||||
let modules = metadata.bundles[bundle];
|
||||
let target = Object.create(null);
|
||||
for (let module of modules) {
|
||||
let keys = metadata.keys[module];
|
||||
let defaultMessages = metadata.messages[module];
|
||||
let 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;
|
||||
let translatedMessage = translations[key];
|
||||
if (translatedMessage === undefined) {
|
||||
translatedMessage = defaultMessages[i];
|
||||
}
|
||||
targetStrings.push(translatedMessage);
|
||||
}
|
||||
} else {
|
||||
targetStrings = defaultMessages;
|
||||
}
|
||||
target[module] = targetStrings;
|
||||
return toDelete.then(() => {
|
||||
return exists(coreLocation).then((fileExists) => {
|
||||
if (fileExists) {
|
||||
// We don't wait for this. No big harm if we can't touch
|
||||
touch(coreLocation).catch(() => { });
|
||||
perf.mark('nlsGeneration:end');
|
||||
return result;
|
||||
}
|
||||
writes.push(writeFile(path.join(coreLocation, bundle.replace(/\//g, '!') + '.nls.json'), JSON.stringify(target)));
|
||||
}
|
||||
writes.push(writeFile(translationsConfigFile, JSON.stringify(packConfig.translations)));
|
||||
return Promise.all(writes);
|
||||
}).then(() => {
|
||||
perf.mark('nlsGeneration:end');
|
||||
return result;
|
||||
}).catch((err) => {
|
||||
console.error('Generating translation files failed.', err);
|
||||
return defaultResult(locale);
|
||||
return mkdirp(coreLocation).then(() => {
|
||||
return Promise.all([readFile(path.join(__dirname, 'nls.metadata.json')), 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 = [];
|
||||
for (let bundle of bundles) {
|
||||
let modules = metadata.bundles[bundle];
|
||||
let target = Object.create(null);
|
||||
for (let module of modules) {
|
||||
let keys = metadata.keys[module];
|
||||
let defaultMessages = metadata.messages[module];
|
||||
let 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;
|
||||
let translatedMessage = translations[key];
|
||||
if (translatedMessage === undefined) {
|
||||
translatedMessage = defaultMessages[i];
|
||||
}
|
||||
targetStrings.push(translatedMessage);
|
||||
}
|
||||
} else {
|
||||
targetStrings = defaultMessages;
|
||||
}
|
||||
target[module] = targetStrings;
|
||||
}
|
||||
writes.push(writeFile(path.join(coreLocation, bundle.replace(/\//g, '!') + '.nls.json'), JSON.stringify(target)));
|
||||
}
|
||||
writes.push(writeFile(translationsConfigFile, JSON.stringify(packConfig.translations)));
|
||||
return Promise.all(writes);
|
||||
}).then(() => {
|
||||
perf.mark('nlsGeneration:end');
|
||||
return result;
|
||||
}).catch((err) => {
|
||||
console.error('Generating translation files failed.', err);
|
||||
return defaultResult(locale);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -388,32 +381,41 @@ function getNLSConfiguration(locale) {
|
||||
return defaultResult(locale);
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
function getNodeCachedDataDir() {
|
||||
// flag to disable cached data support
|
||||
if (process.argv.indexOf('--no-cached-data') > 0) {
|
||||
return Promise.resolve(undefined);
|
||||
//#region Cached Data Dir
|
||||
const nodeCachedDataDir = new class {
|
||||
|
||||
constructor() {
|
||||
this.value = this._compute();
|
||||
}
|
||||
|
||||
// IEnvironmentService.isBuilt
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
return Promise.resolve(undefined);
|
||||
jsFlags() {
|
||||
return this.value ? '--nolazy' : undefined;
|
||||
}
|
||||
|
||||
// find commit id
|
||||
let commit = getCommit();
|
||||
if (!commit) {
|
||||
return Promise.resolve(undefined);
|
||||
ensureExists() {
|
||||
return mkdirp(this.value).then(() => this.value, () => { /*ignore*/ });
|
||||
}
|
||||
|
||||
let dir = path.join(app.getPath('userData'), 'CachedData', commit);
|
||||
_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);
|
||||
}
|
||||
};
|
||||
|
||||
return mkdirp(dir).then(undefined, function () { /*ignore*/ });
|
||||
}
|
||||
|
||||
// Set userData path before app 'ready' event and call to process.chdir
|
||||
let userData = path.resolve(args['user-data-dir'] || paths.getDefaultUserDataPath(process.platform));
|
||||
app.setPath('userData', userData);
|
||||
//#endregion
|
||||
|
||||
// Update cwd based on environment and platform
|
||||
try {
|
||||
@@ -449,20 +451,6 @@ global.getOpenUrls = function () {
|
||||
return openUrls;
|
||||
};
|
||||
|
||||
// use '<UserData>/CachedData'-directory to store
|
||||
// node/v8 cached data.
|
||||
let nodeCachedDataDir = getNodeCachedDataDir().then(function (value) {
|
||||
if (value) {
|
||||
// store the data directory
|
||||
process.env['VSCODE_NODE_CACHED_DATA_DIR_' + process.pid] = value;
|
||||
|
||||
// tell v8 to not be lazy when parsing JavaScript. Generally this makes startup slower
|
||||
// but because we generate cached data it makes subsequent startups much faster
|
||||
let existingJSFlags = resolveJSFlags();
|
||||
app.commandLine.appendSwitch('--js-flags', existingJSFlags ? existingJSFlags + ' --nolazy' : '--nolazy');
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
let nlsConfiguration = undefined;
|
||||
let userDefinedLocale = getUserDefinedLocale();
|
||||
@@ -472,7 +460,7 @@ userDefinedLocale.then((locale) => {
|
||||
}
|
||||
});
|
||||
|
||||
let jsFlags = resolveJSFlags();
|
||||
let jsFlags = resolveJSFlags(nodeCachedDataDir.jsFlags());
|
||||
if (jsFlags) {
|
||||
app.commandLine.appendSwitch('--js-flags', jsFlags);
|
||||
}
|
||||
@@ -480,8 +468,7 @@ if (jsFlags) {
|
||||
// Load our code once ready
|
||||
app.once('ready', function () {
|
||||
perf.mark('main:appReady');
|
||||
Promise.all([nodeCachedDataDir, userDefinedLocale]).then((values) => {
|
||||
let locale = values[1];
|
||||
Promise.all([nodeCachedDataDir.ensureExists(), userDefinedLocale]).then(([cachedDataDir, locale]) => {
|
||||
if (locale && !nlsConfiguration) {
|
||||
nlsConfiguration = getNLSConfiguration(locale);
|
||||
}
|
||||
@@ -493,6 +480,7 @@ app.once('ready', function () {
|
||||
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
|
||||
|
||||
@@ -291,7 +291,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
*/
|
||||
protected show() {
|
||||
this._modalShowingContext.get().push(this._staticKey);
|
||||
this._builder.appendTo(document.getElementById(this._partService.getWorkbenchElementId()).parentElement);
|
||||
this._builder.appendTo(document.getElementById(this._partService.getWorkbenchElementId()));
|
||||
|
||||
this.setFocusableElements();
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ export function findElement(container: Builder, className: string): HTMLElement
|
||||
var elementBuilder: Builder = container;
|
||||
while (elementBuilder.getHTMLElement()) {
|
||||
var htmlElement = elementBuilder.getHTMLElement();
|
||||
if (htmlElement.className === className) {
|
||||
if (htmlElement.className.startsWith(className)) {
|
||||
break;
|
||||
}
|
||||
elementBuilder = elementBuilder.child(0);
|
||||
|
||||
@@ -15,13 +15,14 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IPartService, Parts } from 'vs/workbench/services/part/common/partService';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { WebviewElement } from 'vs/workbench/parts/webview/electron-browser/webviewElement';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export class WebViewDialog extends Modal {
|
||||
|
||||
@@ -40,6 +41,9 @@ export class WebViewDialog extends Modal {
|
||||
private contentDisposables: IDisposable[] = [];
|
||||
private _onMessage = new Emitter<any>();
|
||||
|
||||
protected contextKey: IContextKey<boolean>;
|
||||
protected findInputFocusContextKey: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
@IThemeService private _themeService: IThemeService,
|
||||
@IClipboardService private _clipboardService: IClipboardService,
|
||||
@@ -48,6 +52,7 @@ export class WebViewDialog extends Modal {
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
@IEnvironmentService private _environmentService: IEnvironmentService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService
|
||||
) {
|
||||
super('', TelemetryKeys.WebView, _webViewPartService, telemetryService, contextKeyService, { isFlyout: false, hasTitleIcon: true });
|
||||
this._okLabel = localize('webViewDialog.ok', 'OK');
|
||||
@@ -89,18 +94,16 @@ export class WebViewDialog extends Modal {
|
||||
protected renderBody(container: HTMLElement) {
|
||||
new Builder(container).div({ 'class': 'webview-dialog' }, (bodyBuilder) => {
|
||||
this._body = bodyBuilder.getHTMLElement();
|
||||
this._webview = new WebviewElement(
|
||||
|
||||
this._webview = this._instantiationService.createInstance(WebviewElement,
|
||||
this._webViewPartService.getContainer(Parts.EDITOR_PART),
|
||||
this._themeService,
|
||||
this._environmentService,
|
||||
this._contextViewService,
|
||||
undefined,
|
||||
undefined,
|
||||
this.contextKey,
|
||||
this.findInputFocusContextKey,
|
||||
{
|
||||
allowScripts: true,
|
||||
enableWrappedPostMessage: true
|
||||
}
|
||||
);
|
||||
enableWrappedPostMessage: true,
|
||||
allowScripts: true
|
||||
});
|
||||
|
||||
this._webview.mountTo(this._body);
|
||||
|
||||
this._webview.style(this._themeService.getTheme());
|
||||
|
||||
@@ -16,6 +16,7 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { SashState } from 'vs/base/browser/ui/sash/sash';
|
||||
|
||||
export enum Orientation {
|
||||
VERTICAL,
|
||||
@@ -928,9 +929,9 @@ export class SplitView extends lifecycle.Disposable implements
|
||||
|
||||
this.sashes.forEach((s, i) => {
|
||||
if ((collapsesDown[i] && expandsUp[i + 1]) || (expandsDown[i] && collapsesUp[i + 1])) {
|
||||
s.enable();
|
||||
s.state = SashState.Enabled;
|
||||
} else {
|
||||
s.disable();
|
||||
s.state = SashState.Disabled;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export interface IObservableCollection<T> {
|
||||
|
||||
@@ -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 { IDelegate, IRenderer } from 'vs/base/browser/ui/list/list';
|
||||
import { IRenderer, IVirtualDelegate } 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 IDelegate<sqlops.Account> {
|
||||
export class AccountListDelegate implements IVirtualDelegate<sqlops.Account> {
|
||||
|
||||
constructor(
|
||||
private _height: number
|
||||
@@ -80,6 +80,10 @@ export class AccountPickerListRenderer implements IRenderer<sqlops.Account, Acco
|
||||
public disposeTemplate(template: AccountListTemplate): void {
|
||||
// noop
|
||||
}
|
||||
|
||||
public disposeElement(element: sqlops.Account, index: number, templateData: AccountListTemplate): void {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
export class AccountListRenderer extends AccountPickerListRenderer {
|
||||
|
||||
@@ -83,11 +83,11 @@ ExtensionsRegistry.registerExtensionPoint<IAccountContrib | IAccountContrib[]>('
|
||||
if (icon) {
|
||||
iconClass = id;
|
||||
if (typeof icon === 'string') {
|
||||
const path = join(extension.description.extensionFolderPath, icon);
|
||||
const path = join(extension.description.extensionLocation.fsPath, icon);
|
||||
createCSSRule(`.icon.${iconClass}`, `background-image: url("${URI.file(path).toString()}")`);
|
||||
} else {
|
||||
const light = join(extension.description.extensionFolderPath, icon.light);
|
||||
const dark = join(extension.description.extensionFolderPath, icon.dark);
|
||||
const light = join(extension.description.extensionLocation.fsPath, icon.light);
|
||||
const dark = join(extension.description.extensionLocation.fsPath, icon.dark);
|
||||
createCSSRule(`.icon.${iconClass}`, `background-image: url("${URI.file(light).toString()}")`);
|
||||
createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${URI.file(dark).toString()}")`);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { CreateLoginInput } from 'sql/parts/admin/security/createLoginInput';
|
||||
import { TaskDialogInput } from 'sql/parts/tasks/dialog/taskDialogInput';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
@@ -45,7 +45,7 @@ export class AdminService implements IAdminService {
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService
|
||||
) {
|
||||
@@ -69,7 +69,7 @@ export class AdminService implements IAdminService {
|
||||
const self = this;
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
let input: TaskDialogInput = self._instantiationService ? self._instantiationService.createInstance(TaskDialogInput, uri, connection) : undefined;
|
||||
self._editorService.openEditor(input, { pinned: true }, false);
|
||||
self._editorService.openEditor(input, { pinned: true }, ACTIVE_GROUP);
|
||||
resolve(true);
|
||||
});
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export class AdminService implements IAdminService {
|
||||
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
let loginInput: CreateLoginInput = self._instantiationService ? self._instantiationService.createInstance(CreateLoginInput, uri, connection) : undefined;
|
||||
self._editorService.openEditor(loginInput, { pinned: true }, false);
|
||||
self._editorService.openEditor(loginInput, { pinned: true }, ACTIVE_GROUP);
|
||||
resolve(true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import { IScriptingService } from 'sql/services/scripting/scriptingService';
|
||||
import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||
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';
|
||||
|
||||
export class CreateLoginEditor extends BaseEditor {
|
||||
|
||||
@@ -55,7 +56,7 @@ export class CreateLoginEditor extends BaseEditor {
|
||||
public layout(dimension: DOM.Dimension): void {
|
||||
}
|
||||
|
||||
public setInput(input: CreateLoginInput, options: EditorOptions): TPromise<void> {
|
||||
public setInput(input: CreateLoginInput, options: EditorOptions): Thenable<void> {
|
||||
if (this.input instanceof CreateLoginInput && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
}
|
||||
@@ -65,7 +66,7 @@ export class CreateLoginEditor extends BaseEditor {
|
||||
}
|
||||
this.revealElementWithTagName(input.uniqueSelector, this.getContainer());
|
||||
|
||||
return super.setInput(input, options);
|
||||
return super.setInput(input, options, CancellationToken.None);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorInput, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IInstantiationService } 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 { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import { IQueryEditorOptions } from 'sql/parts/query/common/queryEditorService';
|
||||
import { QueryPlanInput } from 'sql/parts/queryPlan/queryPlanInput';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { IConnectionManagementService } from 'sql/parts/connection/common/connec
|
||||
import { INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IDialogService, IConfirmation, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IObjectExplorerService } from '../../objectExplorer/common/objectExplorerService';
|
||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
import { EditDataInput } from 'sql/parts/editData/common/editDataInput';
|
||||
@@ -146,7 +146,7 @@ export class GetCurrentConnectionStringAction extends Action {
|
||||
id: string,
|
||||
label: string,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
@INotificationService private readonly _notificationService: INotificationService,
|
||||
@IClipboardService private _clipboardService: IClipboardService,
|
||||
@@ -157,7 +157,7 @@ export class GetCurrentConnectionStringAction extends Action {
|
||||
|
||||
public run(): TPromise<void> {
|
||||
return new TPromise<void>((resolve, reject) => {
|
||||
let activeInput = this._editorService.getActiveEditorInput();
|
||||
let activeInput = this._editorService.activeEditor;
|
||||
if (activeInput && (activeInput instanceof QueryInput || activeInput instanceof EditDataInput || activeInput instanceof DashboardInput)
|
||||
&& this._connectionManagementService.isConnected(activeInput.uri)) {
|
||||
let includePassword = false;
|
||||
|
||||
@@ -41,7 +41,7 @@ import * as nls from 'vs/nls';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as platform from 'vs/platform/registry/common/platform';
|
||||
import { Memento } from 'vs/workbench/common/memento';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -52,13 +52,13 @@ import { ConfigurationEditingService } from 'vs/workbench/services/configuration
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { EditorGroup } from 'vs/workbench/common/editor/editorStacksModel';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart';
|
||||
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { EditorGroup } from 'vs/workbench/common/editor/editorGroup';
|
||||
|
||||
export class ConnectionManagementService extends Disposable implements IConnectionManagementService {
|
||||
|
||||
@@ -89,7 +89,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
@IServerGroupController private _serverGroupController: IServerGroupController,
|
||||
@ICommandService private _commandService: ICommandService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IWorkspaceContextService private _contextService: IWorkspaceContextService,
|
||||
@IStorageService private _storageService: IStorageService,
|
||||
@ITelemetryService private _telemetryService: ITelemetryService,
|
||||
@@ -97,7 +97,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
@ICredentialsService private _credentialsService: ICredentialsService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
@IStatusbarService private _statusBarService: IStatusbarService,
|
||||
@IResourceProviderService private _resourceProviderService: IResourceProviderService,
|
||||
@IViewletService private _viewletService: IViewletService,
|
||||
@@ -562,7 +562,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
if (!this.focusDashboard(connectionProfile)) {
|
||||
let dashboardInput: DashboardInput = this._instantiationService ? this._instantiationService.createInstance(DashboardInput, connectionProfile) : undefined;
|
||||
return dashboardInput.initializedPromise.then(() => {
|
||||
this._editorService.openEditor(dashboardInput, { pinned: true }, false);
|
||||
this._editorService.openEditor(dashboardInput, { pinned: true }, ACTIVE_GROUP);
|
||||
}).then(() => true);
|
||||
} else {
|
||||
return Promise.resolve(true);
|
||||
@@ -577,54 +577,29 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
revealInCenterIfOutsideViewport: true,
|
||||
pinned: true
|
||||
};
|
||||
let model = this._editorGroupService.getStacksModel();
|
||||
// check if editor is already present
|
||||
if (model) {
|
||||
model.groups.map(group => {
|
||||
if (group instanceof EditorGroup) {
|
||||
group.getEditors().map(editor => {
|
||||
if (editor instanceof DashboardInput) {
|
||||
if (DashboardInput.profileMatches(profile, editor.connectionProfile)) {
|
||||
editor.connectionProfile.databaseName = profile.databaseName;
|
||||
// change focus to the matched editor
|
||||
let position = model.positionOfGroup(group);
|
||||
this._editorGroupService.activateGroup(model.groupAt(position));
|
||||
this._editorService.openEditor(editor, options, position)
|
||||
.done(() => {
|
||||
this._editorGroupService.activateGroup(model.groupAt(position));
|
||||
if (!profile.databaseName || Utils.isMaster(profile)) {
|
||||
this._angularEventing.sendAngularEvent(editor.uri, AngularEventType.NAV_SERVER);
|
||||
} else {
|
||||
this._angularEventing.sendAngularEvent(editor.uri, AngularEventType.NAV_DATABASE);
|
||||
}
|
||||
found = true;
|
||||
}, errors.onUnexpectedError);
|
||||
|
||||
this._editorService.editors.map(editor => {
|
||||
if (editor instanceof DashboardInput) {
|
||||
if (DashboardInput.profileMatches(profile, editor.connectionProfile)) {
|
||||
editor.connectionProfile.databaseName = profile.databaseName;
|
||||
this._editorService.openEditor(editor)
|
||||
.done(() => {
|
||||
if (!profile.databaseName || Utils.isMaster(profile)) {
|
||||
this._angularEventing.sendAngularEvent(editor.uri, AngularEventType.NAV_SERVER);
|
||||
} else {
|
||||
this._angularEventing.sendAngularEvent(editor.uri, AngularEventType.NAV_DATABASE);
|
||||
}
|
||||
}
|
||||
});
|
||||
found = true;
|
||||
}, errors.onUnexpectedError);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
public closeDashboard(uri: string): void {
|
||||
let model = this._editorGroupService.getStacksModel();
|
||||
if (model) {
|
||||
model.groups.map(group => {
|
||||
if (group instanceof EditorGroup) {
|
||||
group.getEditors().map(editor => {
|
||||
if (editor instanceof DashboardInput) {
|
||||
if (editor.uri === uri && this._editorGroupService instanceof EditorPart) {
|
||||
// close matched editor
|
||||
let position = model.positionOfGroup(group);
|
||||
this._editorGroupService.closeEditor(position, editor);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public getConnectionGroups(providers?: string[]): ConnectionProfileGroup[] {
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
import { $, append, show, hide } from 'vs/base/browser/dom';
|
||||
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||
|
||||
// Connection status bar showing the current global connection
|
||||
export class ConnectionStatusbarItem implements IStatusbarItem {
|
||||
@@ -22,8 +23,8 @@ export class ConnectionStatusbarItem implements IStatusbarItem {
|
||||
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
@IEditorService private _editorService: EditorServiceImpl,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
) {
|
||||
@@ -39,8 +40,8 @@ export class ConnectionStatusbarItem implements IStatusbarItem {
|
||||
this._connectionManagementService.onConnect(() => this._updateStatus()),
|
||||
this._connectionManagementService.onConnectionChanged(() => this._updateStatus()),
|
||||
this._connectionManagementService.onDisconnect(() => this._updateStatus()),
|
||||
this._editorGroupService.onEditorsChanged(() => this._updateStatus()),
|
||||
this._editorGroupService.getStacksModel().onEditorClosed(() => this._updateStatus()),
|
||||
this._editorService.onDidVisibleEditorsChange(() => this._updateStatus()),
|
||||
this._editorService.onDidCloseEditor(() => this._updateStatus()),
|
||||
this._objectExplorerService.onSelectionOrFocusChange(() => this._updateStatus())
|
||||
);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import { IdGenerator } from 'vs/base/common/idGenerator';
|
||||
import { NavSectionConfig, IUserFriendlyIcon } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||
import { registerContainerType, generateNavSectionContainerTypeSchemaProperties } from 'sql/platform/dashboard/common/dashboardContainerRegistry';
|
||||
import { WIDGETS_CONTAINER, validateWidgetContainerContribution } from 'sql/parts/dashboard/containers/dashboardWidgetContainer.contribution';
|
||||
import { WEBVIEW_CONTAINER } from 'sql/parts/dashboard/containers/dashboardWebviewContainer.contribution';
|
||||
import { GRID_CONTAINER, validateGridContainerContribution } from 'sql/parts/dashboard/containers/dashboardGridContainer.contribution';
|
||||
|
||||
export const NAV_SECTION = 'nav-section';
|
||||
@@ -84,11 +83,11 @@ function createCSSRuleForIcon(icon: IUserFriendlyIcon, extension: IExtensionPoin
|
||||
if (icon) {
|
||||
iconClass = ids.nextId();
|
||||
if (typeof icon === 'string') {
|
||||
const path = join(extension.description.extensionFolderPath, icon);
|
||||
const path = join(extension.description.extensionLocation.fsPath, icon);
|
||||
createCSSRule(`.icon.${iconClass}`, `background-image: url("${URI.file(path).toString()}")`);
|
||||
} else {
|
||||
const light = join(extension.description.extensionFolderPath, icon.light);
|
||||
const dark = join(extension.description.extensionFolderPath, icon.dark);
|
||||
const light = join(extension.description.extensionLocation.fsPath, icon.light);
|
||||
const dark = join(extension.description.extensionLocation.fsPath, icon.dark);
|
||||
createCSSRule(`.icon.${iconClass}`, `background-image: url("${URI.file(light).toString()}")`);
|
||||
createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${URI.file(dark).toString()}")`);
|
||||
}
|
||||
|
||||
@@ -8,21 +8,21 @@ import { Component, forwardRef, Input, OnInit, Inject, ChangeDetectorRef, Elemen
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Parts, IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { WebviewElement } from 'vs/workbench/parts/webview/electron-browser/webviewElement';
|
||||
|
||||
import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
||||
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
|
||||
import { IDashboardWebview, IDashboardViewService } from 'sql/services/dashboard/common/dashboardViewService';
|
||||
import { AngularDisposable } from 'sql/base/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
import { IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
@Component({
|
||||
template: '',
|
||||
@@ -40,15 +40,18 @@ 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(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||
@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(IEnvironmentService) private environmentService: IEnvironmentService,
|
||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -108,18 +111,15 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
|
||||
this._onMessageDisposable.dispose();
|
||||
}
|
||||
|
||||
this._webview = new WebviewElement(
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this.partService.getContainer(Parts.EDITOR_PART),
|
||||
this.themeService,
|
||||
this.environmentService,
|
||||
this.contextViewService,
|
||||
undefined,
|
||||
undefined,
|
||||
this.contextKey,
|
||||
this.findInputFocusContextKey,
|
||||
{
|
||||
allowScripts: true,
|
||||
enableWrappedPostMessage: true
|
||||
}
|
||||
);
|
||||
enableWrappedPostMessage: true,
|
||||
allowScripts: true
|
||||
});
|
||||
|
||||
this._webview.mountTo(this._el.nativeElement);
|
||||
|
||||
this._onMessageDisposable = this._webview.onMessage(e => {
|
||||
|
||||
@@ -23,6 +23,7 @@ import { IDashboardService } from 'sql/services/dashboard/common/dashboardServic
|
||||
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
export class DashboardEditor extends BaseEditor {
|
||||
|
||||
@@ -81,7 +82,7 @@ export class DashboardEditor extends BaseEditor {
|
||||
|
||||
const parentElement = this.getContainer();
|
||||
|
||||
super.setInput(input, options);
|
||||
super.setInput(input, options, CancellationToken.None);
|
||||
|
||||
$(parentElement).clearChildren();
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IDelegate, IRenderer, IListMouseEvent } from 'vs/base/browser/ui/list/list';
|
||||
import { IVirtualDelegate, IRenderer } from 'vs/base/browser/ui/list/list';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { Modal } from 'sql/base/browser/ui/modal/modal';
|
||||
@@ -33,7 +33,7 @@ import { Orientation } from 'sql/base/browser/ui/splitview/splitview';
|
||||
import { NewDashboardTabViewModel, IDashboardUITab } from 'sql/parts/dashboard/newDashboardTabDialog/newDashboardTabViewModel';
|
||||
import { IDashboardTab } from 'sql/platform/dashboard/common/dashboardRegistry';
|
||||
|
||||
class ExtensionListDelegate implements IDelegate<IDashboardUITab> {
|
||||
class ExtensionListDelegate implements IVirtualDelegate<IDashboardUITab> {
|
||||
|
||||
constructor(
|
||||
private _height: number
|
||||
@@ -90,6 +90,10 @@ class ExtensionListRenderer implements IRenderer<IDashboardUITab, ExtensionListT
|
||||
public disposeTemplate(template: ExtensionListTemplate): void {
|
||||
// noop
|
||||
}
|
||||
|
||||
public disposeElement(element: IDashboardUITab, index: number, templateData: ExtensionListTemplate): void {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
export class NewDashboardTabDialog extends Modal {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { RunQueryOnConnectionMode, IConnectionManagementService } from 'sql/part
|
||||
import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||
import { InsightActionContext } from 'sql/workbench/common/actions';
|
||||
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
export class RunInsightQueryAction extends Action {
|
||||
public static ID = 'runQuery';
|
||||
@@ -22,7 +22,7 @@ export class RunInsightQueryAction extends Action {
|
||||
@IQueryEditorService protected _queryEditorService: IQueryEditorService,
|
||||
@IConnectionManagementService protected _connectionManagementService: IConnectionManagementService,
|
||||
@IObjectExplorerService protected _objectExplorerService: IObjectExplorerService,
|
||||
@IWorkbenchEditorService protected _workbenchEditorService: IWorkbenchEditorService
|
||||
@IEditorService protected _workbenchEditorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ ExtensionsRegistry.registerExtensionPoint<IInsightTypeContrib | IInsightTypeCont
|
||||
function handleCommand(insight: IInsightTypeContrib, extension: IExtensionPointUser<any>) {
|
||||
|
||||
if (insight.contrib.queryFile) {
|
||||
insight.contrib.queryFile = join(extension.description.extensionFolderPath, insight.contrib.queryFile);
|
||||
insight.contrib.queryFile = join(extension.description.extensionLocation.fsPath, insight.contrib.queryFile);
|
||||
}
|
||||
|
||||
if (insight.contrib.details && insight.contrib.details.queryFile) {
|
||||
insight.contrib.details.queryFile = join(extension.description.extensionFolderPath, insight.contrib.details.queryFile);
|
||||
insight.contrib.details.queryFile = join(extension.description.extensionLocation.fsPath, insight.contrib.details.queryFile);
|
||||
}
|
||||
|
||||
registerNonCustomDashboardWidget(insight.id, '', insight.contrib);
|
||||
|
||||
@@ -20,6 +20,9 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { WebviewElement } from 'vs/workbench/parts/webview/electron-browser/webviewElement';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { truncate } from 'fs';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
interface IWebviewWidgetConfig {
|
||||
id: string;
|
||||
@@ -40,6 +43,9 @@ 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,
|
||||
@@ -49,7 +55,9 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
@Inject(IContextViewService) private contextViewService: IContextViewService,
|
||||
@Inject(IDashboardViewService) private dashboardViewService: IDashboardViewService,
|
||||
@Inject(IPartService) private partService: IPartService,
|
||||
@Inject(IEnvironmentService) private environmentService: IEnvironmentService
|
||||
@Inject(IEnvironmentService) private environmentService: IEnvironmentService,
|
||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService,
|
||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService
|
||||
) {
|
||||
super();
|
||||
this._id = (_config.widget[selector] as IWebviewWidgetConfig).id;
|
||||
@@ -105,18 +113,16 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
if (this._onMessageDisposable) {
|
||||
this._onMessageDisposable.dispose();
|
||||
}
|
||||
this._webview = new WebviewElement(
|
||||
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this.partService.getContainer(Parts.EDITOR_PART),
|
||||
this.themeService,
|
||||
this.environmentService,
|
||||
this.contextViewService,
|
||||
undefined,
|
||||
undefined,
|
||||
this.contextKey,
|
||||
this.findInputFocusContextKey,
|
||||
{
|
||||
allowScripts: true,
|
||||
enableWrappedPostMessage: true
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
this._webview.mountTo(this._el.nativeElement);
|
||||
this._onMessageDisposable = this._webview.onMessage(e => {
|
||||
this._onMessage.fire(e);
|
||||
|
||||
@@ -32,7 +32,6 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
||||
private _refreshButtonEnabled: boolean;
|
||||
private _stopButtonEnabled: boolean;
|
||||
private _setup: boolean;
|
||||
private _toDispose: IDisposable[];
|
||||
private _rowLimit: number;
|
||||
private _objectType: string;
|
||||
private _css: HTMLStyleElement;
|
||||
|
||||
@@ -9,11 +9,9 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as nls from 'vs/nls';
|
||||
import { Builder } from 'vs/base/browser/builder';
|
||||
|
||||
import { EditorOptions, EditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorOptions, EditorInput, IEditorControl, IEditor } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { Position, IEditorControl, IEditor, IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
@@ -21,7 +19,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
|
||||
import { EditDataInput } from 'sql/parts/editData/common/editDataInput';
|
||||
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as queryContext from 'sql/parts/query/common/queryContext';
|
||||
import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -29,22 +27,18 @@ import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { IEditorDescriptorService } from 'sql/parts/query/editor/editorDescriptorService';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import {
|
||||
RefreshTableAction, StopRefreshTableAction, ChangeMaxRowsAction, ChangeMaxRowsActionItem, ShowQueryPaneAction
|
||||
} from 'sql/parts/editData/execution/editDataActions';
|
||||
import { TextResourceEditor } from 'vs/workbench/browser/parts/editor/textResourceEditor';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ISelectionData } from 'sqlops';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IFlexibleSash, VerticalFlexibleSash, HorizontalFlexibleSash } from 'sql/parts/query/views/flexibleSash';
|
||||
import { Orientation } from 'vs/base/browser/ui/sash/sash';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { IFlexibleSash, HorizontalFlexibleSash } from 'sql/parts/query/views/flexibleSash';
|
||||
import { EditDataResultsEditor } from 'sql/parts/editData/editor/editDataResultsEditor';
|
||||
import { EditDataResultsInput } from 'sql/parts/editData/common/editDataResultsInput';
|
||||
import { IEditorViewState } from 'vs/editor/common/editorCommon';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
/**
|
||||
* Editor that hosts an action bar and a resultSetInput for an edit data session
|
||||
@@ -85,13 +79,11 @@ export class EditDataEditor extends BaseEditor {
|
||||
@ITelemetryService _telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IContextMenuService private _contextMenuService: IContextMenuService,
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
) {
|
||||
super(EditDataEditor.ID, _telemetryService, themeService);
|
||||
|
||||
@@ -99,11 +91,12 @@ export class EditDataEditor extends BaseEditor {
|
||||
this._queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
|
||||
}
|
||||
|
||||
if (_editorGroupService) {
|
||||
_editorGroupService.onEditorOpening(e => {
|
||||
if (this.isVisible() && (e.input !== this.input || e.position !== this.position)) {
|
||||
if (_editorService) {
|
||||
_editorService.overrideOpenEditor((editor, options, group) => {
|
||||
if (this.isVisible() && (editor !== this.input || group !== this.group)) {
|
||||
this.saveEditorViewState();
|
||||
}
|
||||
return {};
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -119,19 +112,6 @@ export class EditDataEditor extends BaseEditor {
|
||||
input.results.visible = isVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the position of the editor.
|
||||
*/
|
||||
public changePosition(position: Position): void {
|
||||
if (this._resultsEditor) {
|
||||
this._resultsEditor.changePosition(position);
|
||||
}
|
||||
if (this._sqlEditor) {
|
||||
this._sqlEditor.changePosition(position);
|
||||
}
|
||||
super.changePosition(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to indicate to the editor that the input should be cleared and resources associated with the
|
||||
* input should be freed.
|
||||
@@ -184,7 +164,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
public getEditorText(): string {
|
||||
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
||||
let control = this._sqlEditor.getControl();
|
||||
let codeEditor: CodeEditor = <CodeEditor>control;
|
||||
let codeEditor: ICodeEditor = <ICodeEditor>control;
|
||||
|
||||
if (codeEditor) {
|
||||
let value = codeEditor.getModel().getValue();
|
||||
@@ -222,15 +202,15 @@ export class EditDataEditor extends BaseEditor {
|
||||
/**
|
||||
* Sets this editor and the sub-editors to visible.
|
||||
*/
|
||||
public setEditorVisible(visible: boolean, position: Position): void {
|
||||
public setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
if (this._resultsEditor) {
|
||||
this._resultsEditor.setVisible(visible, position);
|
||||
this._resultsEditor.setVisible(visible, group);
|
||||
}
|
||||
if (this._sqlEditor) {
|
||||
this._sqlEditor.setVisible(visible, position);
|
||||
this._sqlEditor.setVisible(visible, group);
|
||||
}
|
||||
|
||||
super.setEditorVisible(visible, position);
|
||||
super.setEditorVisible(visible, group);
|
||||
|
||||
// Note: must update after calling super.setEditorVisible so that the accurate count is handled
|
||||
this._updateQueryEditorVisible(visible);
|
||||
@@ -239,7 +219,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
/**
|
||||
* Sets the input data for this editor.
|
||||
*/
|
||||
public setInput(newInput: EditDataInput, options?: EditorOptions): TPromise<void> {
|
||||
public setInput(newInput: EditDataInput, options?: EditorOptions): Thenable<void> {
|
||||
let oldInput = <EditDataInput>this.input;
|
||||
if (!newInput.setup) {
|
||||
this._initialized = false;
|
||||
@@ -250,7 +230,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
newInput.setupComplete();
|
||||
}
|
||||
|
||||
return super.setInput(newInput, options)
|
||||
return super.setInput(newInput, options, CancellationToken.None)
|
||||
.then(() => this._updateInput(oldInput, newInput, options));
|
||||
}
|
||||
|
||||
@@ -285,7 +265,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
|
||||
let editor = descriptor.instantiate(this._instantiationService);
|
||||
editor.create(container);
|
||||
editor.setVisible(this.isVisible(), this.position);
|
||||
editor.setVisible(this.isVisible(), editor.group);
|
||||
return TPromise.as(editor);
|
||||
}
|
||||
|
||||
@@ -544,9 +524,9 @@ export class EditDataEditor extends BaseEditor {
|
||||
/**
|
||||
* Sets input for the SQL editor after it has been created.
|
||||
*/
|
||||
private _onSqlEditorCreated(sqlEditor: TextResourceEditor, sqlInput: UntitledEditorInput, options: EditorOptions): TPromise<void> {
|
||||
private _onSqlEditorCreated(sqlEditor: TextResourceEditor, sqlInput: UntitledEditorInput, options: EditorOptions): Thenable<void> {
|
||||
this._sqlEditor = sqlEditor;
|
||||
return this._sqlEditor.setInput(sqlInput, options);
|
||||
return this._sqlEditor.setInput(sqlInput, options, CancellationToken.None);
|
||||
}
|
||||
|
||||
private _resizeGridContents(): void {
|
||||
@@ -591,7 +571,9 @@ export class EditDataEditor extends BaseEditor {
|
||||
return this._createEditor(<UntitledEditorInput>newInput.sql, this._sqlEditorContainer);
|
||||
};
|
||||
onEditorsCreated = (result: TextResourceEditor) => {
|
||||
return this._onSqlEditorCreated(result, newInput.sql, options);
|
||||
return TPromise.join([
|
||||
this._onSqlEditorCreated(result, newInput.sql, options)
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -630,7 +612,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
return;
|
||||
}
|
||||
|
||||
this._editorGroupService.pinEditor(this.position, this.input);
|
||||
//this._editorGroupService.pinEditor(this.position, this.input);
|
||||
|
||||
let input = <EditDataInput>this.input;
|
||||
this._createResultsEditorContainer();
|
||||
@@ -684,7 +666,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
let visible = currentEditorIsVisible;
|
||||
if (!currentEditorIsVisible) {
|
||||
// Current editor is closing but still tracked as visible. Check if any other editor is visible
|
||||
const candidates = [...this._editorService.getVisibleEditors()].filter(e => {
|
||||
const candidates = [...this._editorService.visibleControls].filter(e => {
|
||||
if (e && e.getId) {
|
||||
return e.getId() === EditDataEditor.ID;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ 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';
|
||||
|
||||
export class EditDataResultsEditor extends BaseEditor {
|
||||
|
||||
@@ -64,7 +65,7 @@ export class EditDataResultsEditor extends BaseEditor {
|
||||
}
|
||||
|
||||
public setInput(input: EditDataResultsInput, options: EditorOptions): TPromise<void> {
|
||||
super.setInput(input, options);
|
||||
super.setInput(input, options, CancellationToken.None);
|
||||
this._applySettings();
|
||||
if (!input.hasBootstrapped) {
|
||||
this._bootstrapAngular();
|
||||
|
||||
@@ -11,7 +11,9 @@ import URI from 'vs/base/common/uri';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FileLabel } from 'vs/workbench/browser/labels';
|
||||
import { IFileTemplateData } from 'vs/workbench/parts/files/electron-browser/views/explorerViewer';
|
||||
import { empty as EmptyDisposable } from 'vs/base/common/lifecycle';
|
||||
import { toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
const EmptyDisposable = toDisposable(() => null);
|
||||
|
||||
/**
|
||||
* Renders the tree items.
|
||||
|
||||
@@ -11,11 +11,11 @@ import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
|
||||
import { EditDataEditor } from 'sql/parts/editData/editor/editDataEditor';
|
||||
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
function runActionOnActiveResultsEditor (accessor: ServicesAccessor, eventName: string): void {
|
||||
let editorService = accessor.get(IWorkbenchEditorService);
|
||||
const candidates = [editorService.getActiveEditor(), ...editorService.getVisibleEditors()].filter(e => {
|
||||
let editorService = accessor.get(IEditorService);
|
||||
const candidates = [editorService.activeControl, ...editorService.visibleControls].filter(e => {
|
||||
if (e) {
|
||||
let id = e.getId();
|
||||
if (id === QueryEditor.ID || id === EditDataEditor.ID) {
|
||||
|
||||
@@ -45,7 +45,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
const insightRegistry = Registry.as<IInsightRegistry>(Extensions.InsightContribution);
|
||||
|
||||
@@ -106,7 +106,7 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
|
||||
@Inject(IWorkspaceContextService) private workspaceContextService: IWorkspaceContextService,
|
||||
@Inject(IWindowService) private windowService: IWindowService,
|
||||
@Inject(IQueryModelService) private queryModelService: IQueryModelService,
|
||||
@Inject(IWorkbenchEditorService) private editorService: IWorkbenchEditorService
|
||||
@Inject(IEditorService) private editorService: IEditorService
|
||||
) {
|
||||
this.setDefaultChartConfig();
|
||||
}
|
||||
@@ -294,7 +294,7 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
|
||||
|
||||
private getActiveUriString(): string {
|
||||
let editorService = this.editorService;
|
||||
let editor = editorService.getActiveEditor();
|
||||
let editor = editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
return queryEditor.uri;
|
||||
|
||||
@@ -4,17 +4,15 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import 'vs/css!./modelViewEditor';
|
||||
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
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 { Position } from 'vs/platform/editor/common/editor';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
import { ModelViewInput } from 'sql/parts/modelComponents/modelEditor/modelViewInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
export class ModelViewEditor extends BaseEditor {
|
||||
|
||||
@@ -74,7 +72,7 @@ export class ModelViewEditor extends BaseEditor {
|
||||
input.container.style.visibility = 'visible';
|
||||
this._content.setAttribute('aria-flowto', input.container.id);
|
||||
|
||||
await super.setInput(input, options);
|
||||
await super.setInput(input, options, CancellationToken.None);
|
||||
this.doUpdateContainer();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,21 +19,22 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { IEditorContributionCtor } from 'vs/editor/browser/editorExtensions';
|
||||
import { FoldingController } from 'vs/editor/contrib/folding/folding';
|
||||
import { RenameController } from 'vs/editor/contrib/rename/rename';
|
||||
import { StandaloneCodeEditor } from 'vs/editor/standalone/browser/standaloneCodeEditor';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
class QueryCodeEditor extends CodeEditor {
|
||||
|
||||
protected _getContributions(): IEditorContributionCtor[] {
|
||||
let contributions = super._getContributions();
|
||||
let skipContributions = [FoldingController.prototype, RenameController.prototype];
|
||||
contributions = contributions.filter(c => skipContributions.indexOf(c.prototype) === -1);
|
||||
return contributions;
|
||||
}
|
||||
class QueryCodeEditor extends StandaloneCodeEditor {
|
||||
// protected _getContributions(): IEditorContributionCtor[] {
|
||||
// let contributions = super._getContributions();
|
||||
// let skipContributions = [FoldingController.prototype, RenameController.prototype];
|
||||
// contributions = contributions.filter(c => skipContributions.indexOf(c.prototype) === -1);
|
||||
// return contributions;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,10 +52,13 @@ export class QueryTextEditor extends BaseTextEditor {
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IModeService modeService: IModeService,
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IEditorGroupService editorGroupService: IEditorGroupService
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService,
|
||||
@IEditorService protected editorService: IEditorService,
|
||||
|
||||
) {
|
||||
super(QueryTextEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorGroupService);
|
||||
super(
|
||||
QueryTextEditor.ID, telemetryService, instantiationService, storageService,
|
||||
configurationService, themeService, textFileService, editorService, editorGroupService);
|
||||
}
|
||||
|
||||
public createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
|
||||
@@ -79,8 +83,8 @@ export class QueryTextEditor extends BaseTextEditor {
|
||||
return options;
|
||||
}
|
||||
|
||||
setInput(input: UntitledEditorInput, options: EditorOptions): TPromise<void> {
|
||||
return super.setInput(input, options)
|
||||
setInput(input: UntitledEditorInput, options: EditorOptions): Thenable<void> {
|
||||
return super.setInput(input, options, CancellationToken.None)
|
||||
.then(() => this.input.resolve()
|
||||
.then(editorModel => editorModel.load())
|
||||
.then(editorModel => this.getControl().setModel((<ResourceEditorModel>editorModel).textEditorModel)));
|
||||
|
||||
@@ -80,9 +80,9 @@ export default class TreeComponent extends ComponentBase implements IComponent,
|
||||
}
|
||||
|
||||
public refreshDataProvider(itemsToRefreshByHandle: { [treeItemHandle: string]: ITreeComponentItem }): void {
|
||||
if (this._dataProvider) {
|
||||
this._dataProvider.refresh(itemsToRefreshByHandle);
|
||||
}
|
||||
// if (this._dataProvider) {
|
||||
// const itemsToRefresh = this._dataProvider.getItemsToRefresh(itemsToRefreshByHandle);
|
||||
// }
|
||||
if (this._tree) {
|
||||
for (const item of Object.values(itemsToRefreshByHandle)) {
|
||||
this._tree.refresh(<ITreeComponentItem>item);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { IModelViewTreeViewDataProvider, ITreeComponentItem } from 'sql/workbench/common/views';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import * as vsTreeView from 'vs/workbench/api/electron-browser/mainThreadTreeViews';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
export class TreeViewDataProvider extends vsTreeView.TreeViewDataProvider implements IModelViewTreeViewDataProvider {
|
||||
constructor(handle: number, treeViewId: string,
|
||||
@@ -28,4 +28,12 @@ export class TreeViewDataProvider extends vsTreeView.TreeViewDataProvider implem
|
||||
(<ExtHostModelViewTreeViewsShape>this._proxy).$onNodeSelected(this.treeViewId, items.map(i => i.handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
refresh(itemsToRefreshByHandle: { [treeItemHandle: string]: ITreeComponentItem }) {
|
||||
}
|
||||
|
||||
getChildren(element?: ITreeComponentItem): TPromise<ITreeComponentItem[]> {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import { WebviewElement } from 'vs/workbench/parts/webview/electron-browser/webv
|
||||
|
||||
import { ComponentBase } from 'sql/parts/modelComponents/componentBase';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/parts/modelComponents/interfaces';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
@Component({
|
||||
template: '',
|
||||
@@ -33,6 +35,9 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
private _onMessage = new Emitter<any>();
|
||||
private _renderedHtml: string;
|
||||
|
||||
protected contextKey: IContextKey<boolean>;
|
||||
protected findInputFocusContextKey: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => CommonServiceInterface)) private _commonService: CommonServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||
@@ -40,7 +45,9 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
@Inject(IPartService) private partService: IPartService,
|
||||
@Inject(IThemeService) private themeService: IThemeService,
|
||||
@Inject(IEnvironmentService) private environmentService: IEnvironmentService,
|
||||
@Inject(IContextViewService) private contextViewService: IContextViewService
|
||||
@Inject(IContextViewService) private contextViewService: IContextViewService,
|
||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService,
|
||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService
|
||||
) {
|
||||
super(changeRef);
|
||||
}
|
||||
@@ -54,18 +61,15 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
}
|
||||
|
||||
private _createWebview(): void {
|
||||
this._webview = this._register(new WebviewElement(
|
||||
this._webview = this.instantiationService.createInstance(WebviewElement,
|
||||
this.partService.getContainer(Parts.EDITOR_PART),
|
||||
this.themeService,
|
||||
this.environmentService,
|
||||
this.contextViewService,
|
||||
undefined,
|
||||
undefined,
|
||||
this.contextKey,
|
||||
this.findInputFocusContextKey,
|
||||
{
|
||||
allowScripts: true,
|
||||
enableWrappedPostMessage: true
|
||||
}
|
||||
));
|
||||
});
|
||||
|
||||
this._webview.mountTo(this._el.nativeElement);
|
||||
|
||||
this._register(this._webview.onMessage(e => {
|
||||
|
||||
@@ -9,13 +9,14 @@ 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 { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
|
||||
import { VIEWLET_ID } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { ConnectionViewlet } from 'sql/parts/objectExplorer/viewlet/connectionViewlet';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
|
||||
// Viewlet Action
|
||||
export class OpenConnectionsViewletAction extends ToggleViewletAction {
|
||||
@@ -26,9 +27,9 @@ export class OpenConnectionsViewletAction extends ToggleViewletAction {
|
||||
id: string,
|
||||
label: string,
|
||||
@IViewletService viewletService: IViewletService,
|
||||
@IWorkbenchEditorService editorService: IWorkbenchEditorService
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService
|
||||
) {
|
||||
super(id, label, VIEWLET_ID, viewletService, editorService);
|
||||
super(id, label, VIEWLET_ID, viewletService, editorGroupService);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -232,11 +232,11 @@ export class ServerGroupDialog extends Modal {
|
||||
let colorCheckBox = new Checkbox({
|
||||
actionClassName: 'server-group-color',
|
||||
title: color,
|
||||
isChecked: false,
|
||||
onChange: (viaKeyboard) => {
|
||||
this.onSelectGroupColor(color);
|
||||
}
|
||||
isChecked: false
|
||||
});
|
||||
this._register(colorCheckBox.onChange((viaKeyboard) => {
|
||||
this.onSelectGroupColor(color);
|
||||
}));
|
||||
colorCheckBox.domNode.style.backgroundColor = color;
|
||||
container.appendChild(colorCheckBox.domNode);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectEx
|
||||
import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { ObjectExplorerActionsContext, ObjectExplorerActionUtilities } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
export class RefreshAction extends Action {
|
||||
|
||||
@@ -323,7 +323,7 @@ export class NewQueryAction extends Action {
|
||||
@IQueryEditorService private queryEditorService: IQueryEditorService,
|
||||
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
|
||||
@IObjectExplorerService protected _objectExplorerService: IObjectExplorerService,
|
||||
@IWorkbenchEditorService protected _workbenchEditorService: IWorkbenchEditorService
|
||||
@IEditorService protected _workbenchEditorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.class = 'extension-action update';
|
||||
|
||||
@@ -103,7 +103,9 @@ export class ServerTreeActionProvider extends ContributableActionProvider {
|
||||
|
||||
// Fill in all actions
|
||||
let actions = getDefaultActions(context);
|
||||
fillInActions(menu, { arg: undefined, shouldForwardArgs: true }, actions, this.contextMenuService);
|
||||
let options = { arg: undefined, shouldForwardArgs: true };
|
||||
const groups = menu.getActions(options);
|
||||
fillInActions(groups, actions, this.contextMenuService);
|
||||
|
||||
// Cleanup
|
||||
scopedContextService.dispose();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
import { ITree, ContextMenuEvent } from 'vs/base/parts/tree/browser/tree';
|
||||
import treedefaults = require('vs/base/parts/tree/browser/treeDefaults');
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
@@ -26,7 +26,7 @@ import { TreeUpdateUtils } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtil
|
||||
export class ServerTreeController extends treedefaults.DefaultController {
|
||||
|
||||
constructor(private actionProvider: ServerTreeActionProvider,
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IEditorService private editorService: IEditorService,
|
||||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@ITelemetryService private telemetryService: ITelemetryService,
|
||||
@IKeybindingService private keybindingService: IKeybindingService
|
||||
|
||||
@@ -4,27 +4,18 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { GlobalNewProfilerAction } from './profilerWorkbenchActions';
|
||||
|
||||
import { TaskRegistry } from 'sql/platform/tasks/common/tasks';
|
||||
import { NewProfilerAction } from './profilerActions';
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { IObjectExplorerService } from '../../objectExplorer/common/objectExplorerService';
|
||||
import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { IProfilerService } from '../service/interfaces';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { KeyCode, KeyMod } from 'vs/editor/editor.api';
|
||||
import { ProfilerEditor } from '../editor/profilerEditor';
|
||||
|
||||
@@ -40,20 +31,20 @@ const newProfilerSchema: IJSONSchema = {
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'profiler.newProfiler',
|
||||
handler: (accessor: ServicesAccessor) => {
|
||||
let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
|
||||
let editorService: IEditorService = accessor.get(IEditorService);
|
||||
let instantiationService: IInstantiationService = accessor.get(IInstantiationService);
|
||||
let connectionService: IConnectionManagementService = accessor.get(IConnectionManagementService);
|
||||
let objectExplorerService: IObjectExplorerService = accessor.get(IObjectExplorerService);
|
||||
|
||||
let connectionProfile = TaskUtilities.getCurrentGlobalConnection(objectExplorerService, connectionService, editorService);
|
||||
let profilerInput = instantiationService.createInstance(ProfilerInput, connectionProfile);
|
||||
return editorService.openEditor(profilerInput, { pinned: true }, false).then(() => TPromise.as(true));
|
||||
return editorService.openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => TPromise.as(true));
|
||||
}
|
||||
});
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: 'profiler.newProfiler',
|
||||
weight: KeybindingsRegistry.WEIGHT.builtinExtension(),
|
||||
weight: KeybindingWeight.BuiltinExtension,
|
||||
when: undefined,
|
||||
primary: KeyMod.Alt | KeyCode.KEY_P,
|
||||
mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.KEY_P },
|
||||
@@ -62,15 +53,15 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: 'profiler.toggleStartStop',
|
||||
weight: KeybindingsRegistry.WEIGHT.editorContrib(),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: undefined,
|
||||
primary: KeyMod.Alt | KeyCode.KEY_S,
|
||||
mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.KEY_S },
|
||||
handler: (accessor: ServicesAccessor) => {
|
||||
let profilerService: IProfilerService = accessor.get(IProfilerService);
|
||||
let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
|
||||
let editorService: IEditorService = accessor.get(IEditorService);
|
||||
|
||||
let activeEditor = editorService.getActiveEditor();
|
||||
let activeEditor = editorService.activeControl;
|
||||
if (activeEditor instanceof ProfilerEditor) {
|
||||
let profilerInput = activeEditor.input;
|
||||
if (profilerInput.state.isRunning) {
|
||||
|
||||
@@ -19,7 +19,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IEditorAction } from 'vs/editor/common/editorCommon';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands'
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
@@ -272,7 +272,7 @@ export class NewProfilerAction extends Task {
|
||||
|
||||
public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
|
||||
let profilerInput = accessor.get<IInstantiationService>(IInstantiationService).createInstance(ProfilerInput, profile);
|
||||
return accessor.get<IWorkbenchEditorService>(IWorkbenchEditorService).openEditor(profilerInput, { pinned: true }, false).then(() => {
|
||||
return accessor.get<IEditorService>(IEditorService).openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => {
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: undefined,
|
||||
saveTheConnection: false,
|
||||
|
||||
@@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
@@ -21,7 +21,7 @@ export class GlobalNewProfilerAction extends Action {
|
||||
|
||||
constructor(
|
||||
id: string, label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService
|
||||
) {
|
||||
@@ -47,6 +47,6 @@ export class GlobalNewProfilerAction extends Action {
|
||||
}
|
||||
|
||||
let profilerInput = this._instantiationService.createInstance(ProfilerInput, connectionProfile);
|
||||
return this._editorService.openEditor(profilerInput, { pinned: true }, false).then(() => TPromise.as(true));
|
||||
return this._editorService.openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => TPromise.as(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { textFormatter } from 'sql/parts/grid/services/sharedServices';
|
||||
import { IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
|
||||
export interface ProfilerTableViewState {
|
||||
scrollTop: number;
|
||||
|
||||
@@ -36,15 +36,16 @@ import * as nls from 'vs/nls';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Command } from 'vs/editor/browser/editorExtensions';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { ContextKeyExpr, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { CommonFindController, FindStartFocusAction } from 'vs/editor/contrib/find/findController';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { DARK, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
class BasicView extends View {
|
||||
private _previousSize: number;
|
||||
@@ -143,16 +144,18 @@ export class ProfilerEditor extends BaseEditor {
|
||||
@IProfilerService private _profilerService: IProfilerService,
|
||||
@IContextKeyService private _contextKeyService: IContextKeyService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
super(ProfilerEditor.ID, telemetryService, themeService);
|
||||
this._profilerEditorContextKey = CONTEXT_PROFILER_EDITOR.bindTo(this._contextKeyService);
|
||||
|
||||
if (_editorGroupService) {
|
||||
_editorGroupService.onEditorOpening(e => {
|
||||
if (this.isVisible() && (e.input !== this.input || e.position !== this.position)) {
|
||||
if (_editorService) {
|
||||
_editorService.overrideOpenEditor((editor, options, group) => {
|
||||
if (this.isVisible() && (editor !== this.input || group !== this.group)) {
|
||||
this.saveEditorViewState();
|
||||
}
|
||||
return {};
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -324,20 +327,22 @@ export class ProfilerEditor extends BaseEditor {
|
||||
detailTableContainer.style.width = '100%';
|
||||
detailTableContainer.style.height = '100%';
|
||||
this._detailTableData = new TableDataView<IDetailData>();
|
||||
this._detailTable = new Table(detailTableContainer, { dataProvider: this._detailTableData, columns: [
|
||||
{
|
||||
id: 'label',
|
||||
name: nls.localize('label', "Label"),
|
||||
field: 'label',
|
||||
formatter: textFormatter
|
||||
},
|
||||
{
|
||||
id: 'value',
|
||||
name: nls.localize('profilerEditor.value', "Value"),
|
||||
field: 'value',
|
||||
formatter: textFormatter
|
||||
}
|
||||
]}, { forceFitColumns: true });
|
||||
this._detailTable = new Table(detailTableContainer, {
|
||||
dataProvider: this._detailTableData, columns: [
|
||||
{
|
||||
id: 'label',
|
||||
name: nls.localize('label', "Label"),
|
||||
field: 'label',
|
||||
formatter: textFormatter
|
||||
},
|
||||
{
|
||||
id: 'value',
|
||||
name: nls.localize('profilerEditor.value', "Value"),
|
||||
field: 'value',
|
||||
formatter: textFormatter
|
||||
}
|
||||
]
|
||||
}, { forceFitColumns: true });
|
||||
|
||||
this._tabbedPanel.pushTab({
|
||||
identifier: 'detailTable',
|
||||
@@ -373,7 +378,7 @@ export class ProfilerEditor extends BaseEditor {
|
||||
return this._input as ProfilerInput;
|
||||
}
|
||||
|
||||
public setInput(input: ProfilerInput, options?: EditorOptions): TPromise<void> {
|
||||
public setInput(input: ProfilerInput, options?: EditorOptions): Thenable<void> {
|
||||
let savedViewState = this._savedTableViewStates.get(input);
|
||||
|
||||
this._profilerEditorContextKey.set(true);
|
||||
@@ -384,7 +389,7 @@ export class ProfilerEditor extends BaseEditor {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
return super.setInput(input, options).then(() => {
|
||||
return super.setInput(input, options, CancellationToken.None).then(() => {
|
||||
this._profilerTableEditor.setInput(input);
|
||||
|
||||
if (input.viewTemplate) {
|
||||
@@ -422,7 +427,7 @@ export class ProfilerEditor extends BaseEditor {
|
||||
}
|
||||
|
||||
public toggleSearch(): void {
|
||||
if (this._editor.getControl().isFocused()) {
|
||||
if (this._editor.getControl().hasTextFocus()) {
|
||||
let editor = this._editor.getControl() as ICodeEditor;
|
||||
let controller = CommonFindController.get(editor);
|
||||
if (controller) {
|
||||
@@ -544,12 +549,20 @@ export class ProfilerEditor extends BaseEditor {
|
||||
this._savedTableViewStates.set(this.input, this._profilerTableEditor.saveViewState());
|
||||
}
|
||||
}
|
||||
|
||||
public focus() {
|
||||
super.focus();
|
||||
let savedViewState = this._savedTableViewStates.get(this.input);
|
||||
if (savedViewState) {
|
||||
this._profilerTableEditor.restoreViewState(savedViewState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SettingsCommand extends Command {
|
||||
|
||||
protected getProfilerEditor(accessor: ServicesAccessor): ProfilerEditor {
|
||||
const activeEditor = accessor.get(IWorkbenchEditorService).getActiveEditor();
|
||||
const activeEditor = accessor.get(IEditorService).activeControl;
|
||||
if (activeEditor instanceof ProfilerEditor) {
|
||||
return activeEditor;
|
||||
}
|
||||
@@ -572,7 +585,9 @@ class StartSearchProfilerTableCommand extends SettingsCommand {
|
||||
const command = new StartSearchProfilerTableCommand({
|
||||
id: PROFILER_TABLE_COMMAND_SEARCH,
|
||||
precondition: ContextKeyExpr.and(CONTEXT_PROFILER_EDITOR),
|
||||
kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F }
|
||||
kbOpts: {
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_F,
|
||||
weight: KeybindingWeight.EditorContrib
|
||||
}
|
||||
});
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule(command.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib()));
|
||||
command.register();
|
||||
|
||||
@@ -19,20 +19,22 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { IEditorContributionCtor } from 'vs/editor/browser/editorExtensions';
|
||||
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';
|
||||
|
||||
class ProfilerResourceCodeEditor extends CodeEditor {
|
||||
class ProfilerResourceCodeEditor extends StandaloneCodeEditor {
|
||||
|
||||
protected _getContributions(): IEditorContributionCtor[] {
|
||||
let contributions = super._getContributions();
|
||||
let skipContributions = [FoldingController.prototype];
|
||||
contributions = contributions.filter(c => skipContributions.indexOf(c.prototype) === -1);
|
||||
return contributions;
|
||||
}
|
||||
// protected _getContributions(): IEditorContributionCtor[] {
|
||||
// let contributions = super._getContributions();
|
||||
// let skipContributions = [FoldingController.prototype];
|
||||
// contributions = contributions.filter(c => skipContributions.indexOf(c.prototype) === -1);
|
||||
// return contributions;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -50,10 +52,11 @@ export class ProfilerResourceEditor extends BaseTextEditor {
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IModeService modeService: IModeService,
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IEditorGroupService editorGroupService: IEditorGroupService
|
||||
@IEditorService protected editorService: IEditorService,
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService
|
||||
|
||||
) {
|
||||
super(ProfilerResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorGroupService);
|
||||
super(ProfilerResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorService, editorGroupService);
|
||||
}
|
||||
|
||||
public createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
|
||||
@@ -79,8 +82,8 @@ export class ProfilerResourceEditor extends BaseTextEditor {
|
||||
return options;
|
||||
}
|
||||
|
||||
setInput(input: UntitledEditorInput, options: EditorOptions): TPromise<void> {
|
||||
return super.setInput(input, options)
|
||||
setInput(input: UntitledEditorInput, options: EditorOptions): Thenable<void> {
|
||||
return super.setInput(input, options, CancellationToken.None)
|
||||
.then(() => this.input.resolve()
|
||||
.then(editorModel => editorModel.load())
|
||||
.then(editorModel => this.getControl().setModel((<ResourceEditorModel>editorModel).textEditorModel)));
|
||||
|
||||
@@ -8,14 +8,14 @@ import { $, append, show, hide } from 'vs/base/browser/dom';
|
||||
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import { IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
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');
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { getCodeEditor as getEditorWidget } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { getCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import nls = require('vs/nls');
|
||||
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
@@ -24,6 +24,7 @@ import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
|
||||
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';
|
||||
|
||||
export interface ISqlProviderEntry extends IPickOpenEntry {
|
||||
providerId: string;
|
||||
@@ -68,8 +69,8 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
|
||||
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IEditorService private _editorService: EditorServiceImpl,
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
) {
|
||||
@@ -86,10 +87,9 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
|
||||
this._toDispose = [];
|
||||
this._toDispose.push(
|
||||
this._connectionManagementService.onLanguageFlavorChanged((changeParams: DidChangeLanguageFlavorParams) => this._onFlavorChanged(changeParams)),
|
||||
this._editorGroupService.onEditorsChanged(() => this._onEditorsChanged()),
|
||||
this._editorGroupService.getStacksModel().onEditorClosed(event => this._onEditorClosed(event))
|
||||
this._editorService.onDidVisibleEditorsChange(() => this._onEditorsChanged()),
|
||||
this._editorService.onDidCloseEditor(event => this._onEditorClosed(event))
|
||||
);
|
||||
|
||||
return combinedDisposable(this._toDispose);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
|
||||
let uri = WorkbenchUtils.getEditorUri(event.editor);
|
||||
if (uri && uri in this._sqlStatusEditors) {
|
||||
// If active editor is being closed, hide the query status.
|
||||
let activeEditor = this._editorService.getActiveEditor();
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
if (uri === currentUri) {
|
||||
@@ -117,7 +117,7 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
|
||||
}
|
||||
|
||||
private _onEditorsChanged(): void {
|
||||
let activeEditor = this._editorService.getActiveEditor();
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let uri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
|
||||
@@ -148,7 +148,7 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
|
||||
|
||||
// Show/hide query status for active editor
|
||||
private _showStatus(uri: string): void {
|
||||
let activeEditor = this._editorService.getActiveEditor();
|
||||
let activeEditor = this._editorService.activeControl
|
||||
if (activeEditor) {
|
||||
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
if (uri === currentUri) {
|
||||
@@ -172,7 +172,7 @@ export class ChangeFlavorAction extends Action {
|
||||
constructor(
|
||||
actionId: string,
|
||||
actionLabel: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IQuickOpenService private _quickOpenService: IQuickOpenService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
@@ -181,14 +181,14 @@ export class ChangeFlavorAction extends Action {
|
||||
}
|
||||
|
||||
public run(): TPromise<any> {
|
||||
let activeEditor = this._editorService.getActiveEditor();
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
if (this._connectionManagementService.isConnected(currentUri)) {
|
||||
let currentProvider = this._connectionManagementService.getProviderIdFromUri(currentUri);
|
||||
return this._showMessage(Severity.Info, nls.localize('alreadyConnected',
|
||||
"A connection using engine {0} exists. To change please disconnect or change connection", currentProvider));
|
||||
}
|
||||
const editorWidget = getEditorWidget(activeEditor);
|
||||
const editorWidget = getCodeEditor(activeEditor);
|
||||
if (!editorWidget) {
|
||||
return this._showMessage(Severity.Info, nls.localize('noEditor', "No text editor active at this time"));
|
||||
}
|
||||
@@ -202,8 +202,8 @@ 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 => {
|
||||
if (provider) {
|
||||
activeEditor = this._editorService.getActiveEditor();
|
||||
const editorWidget = getEditorWidget(activeEditor);
|
||||
activeEditor = this._editorService.activeControl;
|
||||
const editorWidget = getCodeEditor(activeEditor);
|
||||
if (editorWidget) {
|
||||
if (currentUri) {
|
||||
this._connectionManagementService.doChangeLanguageFlavor(currentUri, 'sql', provider.providerId);
|
||||
|
||||
@@ -12,7 +12,7 @@ import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/action
|
||||
import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -178,7 +178,7 @@ actionRegistry.registerWorkbenchAction(
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_COPY_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsGridFocusCondition,
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_C,
|
||||
handler: gridCommands.copySelection
|
||||
@@ -186,7 +186,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.MESSAGES_SELECTALL_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsMessagesFocusCondition,
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_A,
|
||||
handler: gridCommands.selectAllMessages
|
||||
@@ -194,7 +194,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_SELECTALL_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsGridFocusCondition,
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_A,
|
||||
handler: gridCommands.selectAll
|
||||
@@ -202,7 +202,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.MESSAGES_COPY_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsMessagesFocusCondition,
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_C,
|
||||
handler: gridCommands.copyMessagesSelection
|
||||
@@ -210,7 +210,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_SAVECSV_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsGridFocusCondition,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_R, KeyMod.CtrlCmd | KeyCode.KEY_C),
|
||||
handler: gridCommands.saveAsCsv
|
||||
@@ -218,7 +218,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_SAVEJSON_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsGridFocusCondition,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_R, KeyMod.CtrlCmd | KeyCode.KEY_J),
|
||||
handler: gridCommands.saveAsJson
|
||||
@@ -226,7 +226,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_SAVEEXCEL_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsGridFocusCondition,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_R, KeyMod.CtrlCmd | KeyCode.KEY_E),
|
||||
handler: gridCommands.saveAsExcel
|
||||
@@ -234,7 +234,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_VIEWASCHART_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsGridFocusCondition,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_R, KeyMod.CtrlCmd | KeyCode.KEY_V),
|
||||
handler: gridCommands.viewAsChart
|
||||
@@ -242,7 +242,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_GOTONEXTGRID_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsGridFocusCondition,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_R, KeyMod.CtrlCmd | KeyCode.KEY_N),
|
||||
handler: gridCommands.goToNextGrid
|
||||
@@ -250,7 +250,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.TOGGLERESULTS_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: QueryEditorVisibleCondition,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_R,
|
||||
handler: gridCommands.toggleResultsPane
|
||||
@@ -258,7 +258,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.TOGGLEMESSAGES_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: QueryEditorVisibleCondition,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_Y,
|
||||
handler: gridCommands.toggleMessagePane
|
||||
@@ -266,7 +266,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GOTONEXTQUERYOUTPUTTAB_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: QueryEditorVisibleCondition,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_P,
|
||||
handler: gridCommands.goToNextQueryOutputTab
|
||||
@@ -383,7 +383,7 @@ for (let i = 0; i < 9; i++) {
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: `workbench.action.query.shortcut${queryIndex}`,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
when: QueryEditorVisibleCondition,
|
||||
primary: defaultPrimary,
|
||||
handler: accessor => {
|
||||
|
||||
@@ -54,7 +54,6 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
|
||||
private _showQueryResultsEditor: Emitter<void>;
|
||||
private _updateSelection: Emitter<ISelectionData>;
|
||||
|
||||
private _toDispose: IDisposable[];
|
||||
private _currentEventCallbacks: IDisposable[];
|
||||
|
||||
public savedViewState: IEditorViewState;
|
||||
|
||||
@@ -15,7 +15,6 @@ import * as PathUtilities from 'sql/common/pathUtilities';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IOutputService, IOutputChannel, IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/parts/output/common/output';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWindowsService, IWindowService, FileFilter } from 'vs/platform/windows/common/windows';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -31,6 +30,7 @@ import Severity from 'vs/base/common/severity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { getBaseLabel } from 'vs/base/common/labels';
|
||||
import { ShowFileInFolderAction, OpenFileInFolderAction } from 'sql/workbench/common/workspaceActions';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
let prevSavePath: string;
|
||||
|
||||
@@ -49,7 +49,7 @@ export class ResultSerializer {
|
||||
@IOutputService private _outputService: IOutputService,
|
||||
@IQueryManagementService private _queryManagementService: IQueryManagementService,
|
||||
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IWorkspaceContextService private _contextService: IWorkspaceContextService,
|
||||
@IWindowsService private _windowsService: IWindowsService,
|
||||
@IWindowService private _windowService: IWindowService,
|
||||
|
||||
@@ -9,11 +9,12 @@ import QueryRunner from 'sql/parts/query/execution/queryRunner';
|
||||
|
||||
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import { IDisposable, combinedDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { append, $, hide, show } from 'vs/base/browser/dom';
|
||||
import * as nls from 'vs/nls';
|
||||
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||
|
||||
export class RowCountStatusBarItem implements IStatusbarItem {
|
||||
|
||||
@@ -23,15 +24,15 @@ export class RowCountStatusBarItem implements IStatusbarItem {
|
||||
private dispose: IDisposable;
|
||||
|
||||
constructor(
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IEditorService private _editorService: EditorServiceImpl,
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
@IQueryModelService private _queryModelService: IQueryModelService
|
||||
) { }
|
||||
|
||||
render(container: HTMLElement): IDisposable {
|
||||
let disposables = [
|
||||
this._editorGroupService.onEditorsChanged(this._onEditorsChanged, this),
|
||||
this._editorGroupService.getStacksModel().onEditorClosed(this._onEditorClosed, this)
|
||||
this._editorService.onDidVisibleEditorsChange(() => this._onEditorsChanged()),
|
||||
this._editorService.onDidCloseEditor(event => this._onEditorClosed(event))
|
||||
];
|
||||
|
||||
this._element = append(container, $('.query-statusbar-group'));
|
||||
@@ -56,7 +57,7 @@ export class RowCountStatusBarItem implements IStatusbarItem {
|
||||
private _showStatus(): void {
|
||||
hide(this._flavorElement);
|
||||
dispose(this.dispose);
|
||||
let activeEditor = this._editorService.getActiveEditor();
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
if (currentUri) {
|
||||
|
||||
@@ -16,11 +16,8 @@ import QueryRunner from 'sql/parts/query/execution/queryRunner';
|
||||
import { SaveFormat } from 'sql/parts/grid/common/interfaces';
|
||||
import { Table } from 'sql/base/browser/ui/table/table';
|
||||
import { GridTableState } from 'sql/parts/query/editor/gridPanel';
|
||||
import { IEditorService } from 'vs/platform/editor/common/editor';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { QueryEditor } from './queryEditor';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
export interface IGridActionContext {
|
||||
cell: { row: number; cell: number; };
|
||||
@@ -169,12 +166,12 @@ export class ChartDataAction extends Action {
|
||||
public static LABEL = localize('chart', 'Chart');
|
||||
public static ICON = 'viewChart';
|
||||
|
||||
constructor(@IWorkbenchEditorService private editorService: IWorkbenchEditorService) {
|
||||
constructor(@IEditorService private editorService: IEditorService) {
|
||||
super(ChartDataAction.ID, ChartDataAction.LABEL, ChartDataAction.ICON);
|
||||
}
|
||||
|
||||
public run(context: IGridActionContext): TPromise<boolean> {
|
||||
let activeEditor = this.editorService.getActiveEditor();
|
||||
let activeEditor = this.editorService.activeEditor;
|
||||
if (activeEditor instanceof QueryEditor) {
|
||||
activeEditor.resultsEditor.chart({ batchId: context.batchId, resultId: context.resultId });
|
||||
return TPromise.as(true);
|
||||
|
||||
@@ -90,14 +90,14 @@ export class GridPanel extends ViewletPanel {
|
||||
private maximizedGrid: GridTable<any>;
|
||||
|
||||
constructor(
|
||||
title: string, options: IViewletPanelOptions,
|
||||
options: IViewletPanelOptions,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IThemeService private themeService: IThemeService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService
|
||||
) {
|
||||
super(title, options, keybindingService, contextMenuService, configurationService);
|
||||
super(options, keybindingService, contextMenuService, configurationService);
|
||||
this.splitView = new ScrollableSplitView(this.container, { enableResizing: false });
|
||||
}
|
||||
|
||||
@@ -219,6 +219,7 @@ class GridTable<T> extends Disposable implements IView {
|
||||
public readonly onDidChange: Event<number> = this._onDidChange.event;
|
||||
|
||||
public id = generateUuid();
|
||||
readonly element: HTMLElement = this.container;
|
||||
|
||||
constructor(
|
||||
private runner: QueryRunner,
|
||||
|
||||
@@ -28,7 +28,7 @@ import { $ } from 'vs/base/browser/builder';
|
||||
import { isArray } from 'vs/base/common/types';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditor } from 'vs/editor/common/editorCommon';
|
||||
|
||||
export interface IResultMessageIntern extends IResultMessage {
|
||||
@@ -71,14 +71,14 @@ export class MessagePanel extends ViewletPanel {
|
||||
private tree: ITree;
|
||||
|
||||
constructor(
|
||||
title: string, options: IViewletPanelOptions,
|
||||
options: IViewletPanelOptions,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IThemeService private themeService: IThemeService,
|
||||
@IInstantiationService instantiationService: IInstantiationService
|
||||
) {
|
||||
super(title, options, keybindingService, contextMenuService, configurationService);
|
||||
super(options, keybindingService, contextMenuService, configurationService);
|
||||
this.controller = instantiationService.createInstance(MessageController, { openMode: OpenMode.SINGLE_CLICK, clickBehavior: ClickBehavior.ON_MOUSE_UP /* do not change, to preserve focus behaviour in input field */ });
|
||||
this.controller.toFocusOnClick = this.model;
|
||||
this.tree = new Tree(this.container, {
|
||||
@@ -257,7 +257,7 @@ export class MessageController extends WorkbenchTreeController {
|
||||
constructor(
|
||||
options: IControllerOptions,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IWorkbenchEditorService private workbenchEditorService: IWorkbenchEditorService,
|
||||
@IEditorService private workbenchEditorService: IEditorService,
|
||||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService
|
||||
) {
|
||||
@@ -283,7 +283,7 @@ export class MessageController extends WorkbenchTreeController {
|
||||
if (element.selection) {
|
||||
let selection: ISelectionData = element.selection;
|
||||
// this is a batch statement
|
||||
let control = this.workbenchEditorService.getActiveEditor().getControl() as IEditor;
|
||||
let control = this.workbenchEditorService.activeControl.getControl() as IEditor;
|
||||
control.setSelection({
|
||||
startColumn: selection.startColumn + 1,
|
||||
endColumn: selection.endColumn + 1,
|
||||
|
||||
@@ -8,9 +8,8 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
|
||||
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { EditorInput, EditorOptions, IEditorControl, IEditor } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { IEditorControl, Position, IEditor, IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import { VerticalFlexibleSash, HorizontalFlexibleSash, IFlexibleSash } from 'sql/parts/query/views/flexibleSash';
|
||||
import { Orientation } from 'vs/base/browser/ui/sash/sash';
|
||||
|
||||
@@ -21,18 +20,15 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { TextResourceEditor } from 'vs/workbench/browser/parts/editor/textResourceEditor';
|
||||
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { ISelectionData } from 'sqlops';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { IEditorViewState } from 'vs/editor/common/editorCommon';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
@@ -48,6 +44,8 @@ import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { IEditorDescriptorService } from 'sql/parts/query/editor/editorDescriptorService';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { attachEditableDropdownStyler } from 'sql/common/theme/styler';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
||||
/**
|
||||
* Editor that hosts 2 sub-editors: A TextResourceEditor for SQL file editing, and a QueryResultsEditor
|
||||
@@ -93,11 +91,10 @@ export class QueryEditor extends BaseEditor {
|
||||
@ITelemetryService _telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IContextMenuService private _contextMenuService: IContextMenuService,
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
) {
|
||||
@@ -109,11 +106,12 @@ export class QueryEditor extends BaseEditor {
|
||||
this.queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
|
||||
}
|
||||
|
||||
if (_editorGroupService) {
|
||||
_editorGroupService.onEditorOpening(e => {
|
||||
if (this.isVisible() && (e.input !== this.input || e.position !== this.position)) {
|
||||
if (_editorService) {
|
||||
_editorService.overrideOpenEditor((editor, options, group) => {
|
||||
if (this.isVisible() && (editor !== this.input || group !== this.group)) {
|
||||
this.saveEditorViewState();
|
||||
}
|
||||
return {};
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -157,7 +155,7 @@ export class QueryEditor extends BaseEditor {
|
||||
/**
|
||||
* Sets the input data for this editor.
|
||||
*/
|
||||
public setInput(newInput: QueryInput, options?: EditorOptions): TPromise<void> {
|
||||
public setInput(newInput: QueryInput, options?: EditorOptions): Thenable<void> {
|
||||
const oldInput = <QueryInput>this.input;
|
||||
|
||||
if (newInput.matches(oldInput)) {
|
||||
@@ -171,21 +169,21 @@ export class QueryEditor extends BaseEditor {
|
||||
let selectionCallback: IDisposable = newInput.updateSelectionEvent((selection) => this._setSelection(selection));
|
||||
newInput.setEventCallbacks([taskbarCallback, showResultsCallback, selectionCallback]);
|
||||
|
||||
return super.setInput(newInput, options)
|
||||
return super.setInput(newInput, options, CancellationToken.None)
|
||||
.then(() => this._updateInput(oldInput, newInput, options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this editor and the 2 sub-editors to visible.
|
||||
*/
|
||||
public setEditorVisible(visible: boolean, position: Position): void {
|
||||
public setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
if (this._resultsEditor) {
|
||||
this._resultsEditor.setVisible(visible, position);
|
||||
this._resultsEditor.setVisible(visible, group);
|
||||
}
|
||||
if (this._sqlEditor) {
|
||||
this._sqlEditor.setVisible(visible, position);
|
||||
this._sqlEditor.setVisible(visible, group);
|
||||
}
|
||||
super.setEditorVisible(visible, position);
|
||||
super.setEditorVisible(visible, group);
|
||||
|
||||
// Note: must update after calling super.setEditorVisible so that the accurate count is handled
|
||||
this.updateQueryEditorVisible(visible);
|
||||
@@ -197,7 +195,7 @@ export class QueryEditor extends BaseEditor {
|
||||
let visible = currentEditorIsVisible;
|
||||
if (!currentEditorIsVisible) {
|
||||
// Current editor is closing but still tracked as visible. Check if any other editor is visible
|
||||
const candidates = [...this._editorService.getVisibleEditors()].filter(e => {
|
||||
const candidates = [...this._editorService.visibleControls].filter(e => {
|
||||
if (e && e.getId) {
|
||||
return e.getId() === QueryEditor.ID;
|
||||
}
|
||||
@@ -211,20 +209,6 @@ export class QueryEditor extends BaseEditor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes the position of the editor.
|
||||
*/
|
||||
public changePosition(position: Position): void {
|
||||
if (this._resultsEditor) {
|
||||
this._resultsEditor.changePosition(position);
|
||||
}
|
||||
if (this._sqlEditor) {
|
||||
this._sqlEditor.changePosition(position);
|
||||
}
|
||||
super.changePosition(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to indicate to the editor that the input should be cleared and resources associated with the
|
||||
* input should be freed.
|
||||
@@ -303,7 +287,8 @@ export class QueryEditor extends BaseEditor {
|
||||
return;
|
||||
}
|
||||
|
||||
this._editorGroupService.pinEditor(this.position, this.input);
|
||||
const activeControl = this._editorService.activeControl;
|
||||
activeControl.group.pinEditor(activeControl.input);
|
||||
|
||||
let input = <QueryInput>this.input;
|
||||
this._createResultsEditorContainer();
|
||||
@@ -363,7 +348,7 @@ export class QueryEditor extends BaseEditor {
|
||||
public isSelectionEmpty(): boolean {
|
||||
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
||||
let control = this._sqlEditor.getControl();
|
||||
let codeEditor: CodeEditor = <CodeEditor>control;
|
||||
let codeEditor: ICodeEditor = <ICodeEditor>control;
|
||||
|
||||
if (codeEditor) {
|
||||
let value = codeEditor.getValue();
|
||||
@@ -378,7 +363,7 @@ export class QueryEditor extends BaseEditor {
|
||||
public getAllText(): string {
|
||||
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
||||
let control = this._sqlEditor.getControl();
|
||||
let codeEditor: CodeEditor = <CodeEditor>control;
|
||||
let codeEditor: ICodeEditor = <ICodeEditor>control;
|
||||
if (codeEditor) {
|
||||
let value = codeEditor.getValue();
|
||||
if (value !== undefined && value.length > 0) {
|
||||
@@ -394,7 +379,7 @@ export class QueryEditor extends BaseEditor {
|
||||
public getSelectionText(): string {
|
||||
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
||||
let control = this._sqlEditor.getControl();
|
||||
let codeEditor: CodeEditor = <CodeEditor>control;
|
||||
let codeEditor: ICodeEditor = <ICodeEditor>control;
|
||||
let vscodeSelection = control.getSelection();
|
||||
|
||||
if (codeEditor && vscodeSelection) {
|
||||
@@ -569,7 +554,9 @@ export class QueryEditor extends BaseEditor {
|
||||
return this._createEditor(<UntitledEditorInput>newInput.sql, this._sqlEditorContainer);
|
||||
};
|
||||
onEditorsCreated = (result: TextResourceEditor) => {
|
||||
return this._onSqlEditorCreated(result, newInput.sql, options);
|
||||
return TPromise.join([
|
||||
this._onSqlEditorCreated(result, newInput.sql, options)
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -604,16 +591,16 @@ export class QueryEditor extends BaseEditor {
|
||||
|
||||
let editor = descriptor.instantiate(this._instantiationService);
|
||||
editor.create(container);
|
||||
editor.setVisible(this.isVisible(), this.position);
|
||||
editor.setVisible(this.isVisible(), editor.group);
|
||||
return TPromise.as(editor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets input for the SQL editor after it has been created.
|
||||
*/
|
||||
private _onSqlEditorCreated(sqlEditor: TextResourceEditor, sqlInput: UntitledEditorInput, options: EditorOptions): TPromise<void> {
|
||||
private _onSqlEditorCreated(sqlEditor: TextResourceEditor, sqlInput: UntitledEditorInput, options: EditorOptions): Thenable<void> {
|
||||
this._sqlEditor = sqlEditor;
|
||||
return this._sqlEditor.setInput(sqlInput, options);
|
||||
return this._sqlEditor.setInput(sqlInput, options, CancellationToken.None);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,11 +20,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
|
||||
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { bootstrapAngular } from 'sql/services/bootstrap/bootstrapService';
|
||||
import { IQueryComponentParams } from 'sql/services/bootstrap/bootstrapParams';
|
||||
import { QueryOutputModule } from 'sql/parts/query/views/queryOutput.module';
|
||||
import { QUERY_OUTPUT_SELECTOR } from 'sql/parts/query/views/queryOutput.component';
|
||||
import { QueryResultsView } from 'sql/parts/query/editor/queryResultsView';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
export const RESULTS_GRID_DEFAULTS = {
|
||||
cellPadding: [6, 10, 5],
|
||||
@@ -146,7 +143,7 @@ export class QueryResultsEditor extends BaseEditor {
|
||||
}
|
||||
|
||||
setInput(input: QueryResultsInput, options: EditorOptions): TPromise<void> {
|
||||
super.setInput(input, options);
|
||||
super.setInput(input, options, CancellationToken.None);
|
||||
this.resultsView.input = input;
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
@@ -26,8 +26,10 @@ class ResultsView implements IPanelView {
|
||||
|
||||
constructor(instantiationService: IInstantiationService) {
|
||||
this.panelViewlet = instantiationService.createInstance(PanelViewlet, 'resultsView', { showHeaderInTitleWhenSingleView: false });
|
||||
this.gridPanel = instantiationService.createInstance(GridPanel, nls.localize('gridPanel', 'Results'), {});
|
||||
this.messagePanel = instantiationService.createInstance(MessagePanel, nls.localize('messagePanel', 'Messages'), {});
|
||||
this.gridPanel = instantiationService.createInstance(GridPanel, { title: nls.localize('gridPanel', 'Results') });
|
||||
this.messagePanel = instantiationService.createInstance(MessagePanel, { title: nls.localize('messagePanel', 'Messages') });
|
||||
this.gridPanel.render();
|
||||
this.messagePanel.render();
|
||||
this.panelViewlet.create(this.container).then(() => {
|
||||
this.panelViewlet.addPanels([
|
||||
{ panel: this.gridPanel, size: 1000, index: 0 },
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import nls = require('vs/nls');
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
|
||||
@@ -31,8 +31,8 @@ export function isConnected(editor: QueryEditor, connectionManagementService: IC
|
||||
return connectionManagementService.isConnected(editor.currentQueryInput.uri);
|
||||
}
|
||||
|
||||
function runActionOnActiveQueryEditor(editorService: IWorkbenchEditorService, action: (QueryEditor) => void): void {
|
||||
const candidates = [editorService.getActiveEditor(), ...editorService.getVisibleEditors()].filter(e => e instanceof QueryEditor);
|
||||
function runActionOnActiveQueryEditor(editorService: IEditorService, action: (QueryEditor) => void): void {
|
||||
const candidates = [editorService.activeControl, ...editorService.visibleControls].filter(e => e instanceof QueryEditor);
|
||||
if (candidates.length > 0) {
|
||||
action(candidates[0]);
|
||||
}
|
||||
@@ -65,14 +65,14 @@ export class FocusOnCurrentQueryKeyboardAction extends Action {
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.focus();
|
||||
@@ -92,14 +92,14 @@ export class RunQueryKeyboardAction extends Action {
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && (editor instanceof QueryEditor || editor instanceof EditDataEditor)) {
|
||||
let queryEditor: QueryEditor | EditDataEditor = editor;
|
||||
queryEditor.runQuery();
|
||||
@@ -118,14 +118,14 @@ export class RunCurrentQueryKeyboardAction extends Action {
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.runCurrentQuery();
|
||||
@@ -141,14 +141,14 @@ export class RunCurrentQueryWithActualPlanKeyboardAction extends Action {
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.runCurrentQueryWithActualPlan();
|
||||
@@ -168,14 +168,14 @@ export class CancelQueryKeyboardAction extends Action {
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && (editor instanceof QueryEditor || editor instanceof EditDataEditor)) {
|
||||
let queryEditor: QueryEditor | EditDataEditor = editor;
|
||||
queryEditor.cancelQuery();
|
||||
@@ -194,14 +194,14 @@ export class RefreshIntellisenseKeyboardAction extends Action {
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.rebuildIntelliSenseCache();
|
||||
@@ -221,14 +221,14 @@ export class ToggleQueryResultsKeyboardAction extends Action {
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.toggleResultsEditorVisibility();
|
||||
@@ -244,7 +244,7 @@ export class RunQueryShortcutAction extends Action {
|
||||
public static ID = 'runQueryShortcutAction';
|
||||
|
||||
constructor(
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IQueryModelService protected _queryModelService: IQueryModelService,
|
||||
@IQueryManagementService private _queryManagementService: IQueryManagementService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@@ -403,7 +403,7 @@ export class ParseSyntaxAction extends Action {
|
||||
label: string,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IQueryManagementService private _queryManagementService: IQueryManagementService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@INotificationService private _notificationService: INotificationService
|
||||
) {
|
||||
super(id, label);
|
||||
@@ -411,7 +411,7 @@ export class ParseSyntaxAction extends Action {
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
if (!queryEditor.isSelectionEmpty()) {
|
||||
|
||||
@@ -7,11 +7,12 @@ import { $, append, show, hide } from 'vs/base/browser/dom';
|
||||
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import { IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import LocalizedConstants = require('sql/parts/query/common/localizedConstants');
|
||||
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
|
||||
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||
|
||||
// Query execution status
|
||||
enum QueryExecutionStatus{
|
||||
@@ -29,8 +30,8 @@ export class QueryStatusbarItem implements IStatusbarItem {
|
||||
|
||||
constructor(
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IEditorService private _editorService: EditorServiceImpl,
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
) {
|
||||
this._queryStatusEditors = {};
|
||||
}
|
||||
@@ -44,8 +45,8 @@ export class QueryStatusbarItem implements IStatusbarItem {
|
||||
this._toDispose.push(
|
||||
this._queryModelService.onRunQueryStart((uri:string) => this._onRunQueryStart(uri)),
|
||||
this._queryModelService.onRunQueryComplete((uri:string) => this._onRunQueryComplete(uri)),
|
||||
this._editorGroupService.onEditorsChanged(() => this._onEditorsChanged()),
|
||||
this._editorGroupService.getStacksModel().onEditorClosed(event => this._onEditorClosed(event))
|
||||
this._editorService.onDidVisibleEditorsChange(() => this._onEditorsChanged()),
|
||||
this._editorService.onDidCloseEditor(event => this._onEditorClosed(event))
|
||||
);
|
||||
|
||||
return combinedDisposable(this._toDispose);
|
||||
@@ -55,7 +56,7 @@ export class QueryStatusbarItem implements IStatusbarItem {
|
||||
let uri = WorkbenchUtils.getEditorUri(event.editor);
|
||||
if (uri && uri in this._queryStatusEditors) {
|
||||
// If active editor is being closed, hide the query status.
|
||||
let activeEditor = this._editorService.getActiveEditor();
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
if (uri === currentUri) {
|
||||
@@ -67,7 +68,7 @@ export class QueryStatusbarItem implements IStatusbarItem {
|
||||
}
|
||||
|
||||
private _onEditorsChanged(): void{
|
||||
let activeEditor = this._editorService.getActiveEditor();
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let uri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
|
||||
@@ -100,7 +101,7 @@ export class QueryStatusbarItem implements IStatusbarItem {
|
||||
|
||||
// Show/hide query status for active editor
|
||||
private _showStatus(uri: string): void{
|
||||
let activeEditor = this._editorService.getActiveEditor();
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
if (uri === currentUri) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
import { EditDataInput } from 'sql/parts/editData/common/editDataInput';
|
||||
import { IConnectableInput, IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { IQueryEditorService, IQueryEditorOptions } from 'sql/parts/query/common/queryEditorService';
|
||||
import { QueryPlanInput } from 'sql/parts/queryPlan/queryPlanInput';
|
||||
import { sqlModeId, untitledFilePrefix, getSupportedInputResource } from 'sql/parts/common/customInputConverter';
|
||||
@@ -15,11 +15,8 @@ import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
|
||||
import { IMode } from 'vs/editor/common/modes';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IEditor, IEditorInput, Position } from 'vs/platform/editor/common/editor';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { IEditorGroup } from 'vs/workbench/common/editor';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
@@ -30,6 +27,8 @@ import { isLinux } from 'vs/base/common/platform';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { EditDataResultsInput } from 'sql/parts/editData/common/editDataResultsInput';
|
||||
import { IEditorInput, IEditor } from 'vs/workbench/common/editor';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -51,16 +50,16 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
);
|
||||
|
||||
// service references for static functions
|
||||
private static editorService: IWorkbenchEditorService;
|
||||
private static editorService: IEditorService;
|
||||
private static instantiationService: IInstantiationService;
|
||||
private static editorGroupService: IEditorGroupService;
|
||||
private static editorGroupService: IEditorGroupsService;
|
||||
private static notificationService: INotificationService;
|
||||
|
||||
constructor(
|
||||
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private _editorGroupService: IEditorGroupService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
) {
|
||||
@@ -90,8 +89,6 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
}
|
||||
});
|
||||
|
||||
//input.resolve().then(model => this.backupFileService.backupResource(resource, model.getValue(), model.getVersionId())).done(null, errors.onUnexpectedError);
|
||||
|
||||
const queryResultsInput: QueryResultsInput = this._instantiationService.createInstance(QueryResultsInput, docUri.toString());
|
||||
let queryInput: QueryInput = this._instantiationService.createInstance(QueryInput, '', fileInput, queryResultsInput, connectionProviderName);
|
||||
|
||||
@@ -113,7 +110,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
const self = this;
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
let queryPlanInput: QueryPlanInput = self._instantiationService.createInstance(QueryPlanInput, xmlShowPlan, 'aaa', undefined);
|
||||
self._editorService.openEditor(queryPlanInput, { pinned: true }, false);
|
||||
self._editorService.openEditor(queryPlanInput, { pinned: true }, ACTIVE_GROUP);
|
||||
resolve(true);
|
||||
});
|
||||
}
|
||||
@@ -163,26 +160,25 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
|
||||
onSaveAsCompleted(oldResource: URI, newResource: URI): void {
|
||||
let oldResourceString: string = oldResource.toString();
|
||||
const stacks = this._editorGroupService.getStacksModel();
|
||||
stacks.groups.forEach(group => {
|
||||
group.getEditors().forEach(input => {
|
||||
if (input instanceof QueryInput) {
|
||||
const resource = input.getResource();
|
||||
|
||||
// Update Editor if file (or any parent of the input) got renamed or moved
|
||||
// Note: must check the new file name for this since this method is called after the rename is completed
|
||||
if (paths.isEqualOrParent(resource.fsPath, newResource.fsPath, !isLinux /* ignorecase */)) {
|
||||
// In this case, we know that this is a straight rename so support this as a rename / replace operation
|
||||
TaskUtilities.replaceConnection(oldResourceString, newResource.toString(), this._connectionManagementService).then(result => {
|
||||
if (result && result.connected) {
|
||||
input.onConnectSuccess();
|
||||
} else {
|
||||
input.onConnectReject();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this._editorService.editors.forEach(input => {
|
||||
if (input instanceof QueryInput) {
|
||||
const resource = input.getResource();
|
||||
|
||||
// Update Editor if file (or any parent of the input) got renamed or moved
|
||||
// Note: must check the new file name for this since this method is called after the rename is completed
|
||||
if (paths.isEqualOrParent(resource.fsPath, newResource.fsPath, !isLinux /* ignorecase */)) {
|
||||
// In this case, we know that this is a straight rename so support this as a rename / replace operation
|
||||
TaskUtilities.replaceConnection(oldResourceString, newResource.toString(), this._connectionManagementService).then(result => {
|
||||
if (result && result.connected) {
|
||||
input.onConnectSuccess();
|
||||
} else {
|
||||
input.onConnectReject();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -240,12 +236,10 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
let group: IEditorGroup = QueryEditorService.editorGroupService.getStacksModel().groupAt(editor.position);
|
||||
let index: number = group.indexOf(editor.input);
|
||||
let position: Position = editor.position;
|
||||
let group: IEditorGroup = editor.group;
|
||||
let index: number = group.editors.indexOf(editor.input);
|
||||
let options: IQueryEditorOptions = editor.options ? editor.options : {};
|
||||
options = Object.assign(options, { index: index });
|
||||
options.pinned = group.isPinned(index);
|
||||
|
||||
// Return a promise that will resovle when the old editor has been replaced by a new editor
|
||||
return new Promise<ITextModel>((resolve, reject) => {
|
||||
@@ -256,16 +250,14 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
options.denyQueryEditor = true;
|
||||
}
|
||||
|
||||
// Close the current editor
|
||||
QueryEditorService.editorService.closeEditor(position, editor.input).then(() => {
|
||||
|
||||
group.closeEditor(editor.input).then(() => {
|
||||
// Reopen a new editor in the same position/index
|
||||
QueryEditorService.editorService.openEditor(newEditorInput, options, position).then((editor) => {
|
||||
resolve(QueryEditorService._onEditorOpened(editor, uri.toString(), position, options.pinned));
|
||||
QueryEditorService.editorService.openEditor(newEditorInput, options, group).then((editor) => {
|
||||
resolve(QueryEditorService._onEditorOpened(editor, uri.toString(), undefined, options.pinned));
|
||||
},
|
||||
(error) => {
|
||||
reject(error);
|
||||
});
|
||||
(error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -365,10 +357,10 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
// causes the text on the tab to slightly flicker for unpinned files (from non-italic to italic to non-italic).
|
||||
// This is currently unavoidable because vscode ignores "pinned" on IEditorOptions if "index" is not undefined,
|
||||
// and we need to specify "index"" so the editor tab remains in the same place
|
||||
let group: IEditorGroup = QueryEditorService.editorGroupService.getStacksModel().groupAt(position);
|
||||
if (isPinned) {
|
||||
QueryEditorService.editorGroupService.pinEditor(group, editor.input);
|
||||
}
|
||||
// let group: IEditorGroup = QueryEditorService.editorGroupService.getStacksModel().groupAt(position);
|
||||
// if (isPinned) {
|
||||
// QueryEditorService.editorGroupService.pinEditor(group, editor.input);
|
||||
// }
|
||||
|
||||
// @SQLTODO do we need the below
|
||||
// else {
|
||||
@@ -377,7 +369,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
|
||||
// Grab and returns the IModel that will be used to resolve the sqlLanguageModeCheck promise.
|
||||
let control = editor.getControl();
|
||||
let codeEditor: CodeEditor = <CodeEditor>control;
|
||||
let codeEditor: ICodeEditor = <ICodeEditor>control;
|
||||
let newModel = codeEditor ? codeEditor.getModel() : undefined;
|
||||
return newModel;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Dimension } from 'vs/base/browser/dom';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IHorizontalSashLayoutProvider, IVerticalSashLayoutProvider,
|
||||
ISashEvent, Orientation, VSash, Sash } from 'vs/base/browser/ui/sash/sash';
|
||||
ISashEvent, Orientation, Sash } from 'vs/base/browser/ui/sash/sash';
|
||||
// There is no need to import the sash CSS - 'vs/base/browser/ui/sash/sash' already includes it
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@ import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||
import { bootstrapAngular } from 'sql/services/bootstrap/bootstrapService';
|
||||
import { IQueryPlanParams } from 'sql/services/bootstrap/bootstrapParams';
|
||||
import { QUERYPLAN_SELECTOR } from 'sql/parts/queryPlan/queryPlan.component';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
declare let QP;
|
||||
|
||||
@@ -69,7 +70,7 @@ export class QueryPlanEditor extends BaseEditor {
|
||||
public layout(dimension: DOM.Dimension): void {
|
||||
}
|
||||
|
||||
public setInput(input: QueryPlanInput, options: EditorOptions): TPromise<void> {
|
||||
public setInput(input: QueryPlanInput, options: EditorOptions): Thenable<void> {
|
||||
if (this.input instanceof QueryPlanInput && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
}
|
||||
@@ -79,7 +80,7 @@ export class QueryPlanEditor extends BaseEditor {
|
||||
}
|
||||
this.revealElementWithTagName(input.uniqueSelector, this.getContainer());
|
||||
|
||||
return super.setInput(input, options);
|
||||
return super.setInput(input, options, CancellationToken.None);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,6 @@ export class TopOperationsComponent extends TabChild implements OnDestroy, OnIni
|
||||
private _operations: Array<PlanNode> = [];
|
||||
private _table: Table<any>;
|
||||
private _dataService: DataService;
|
||||
private toDispose: Array<IDisposable> = [];
|
||||
private _columns: Array<Slick.Column<any>> = [
|
||||
{ name: localize('topOperations.operation', 'Operation'), field: 'operation' },
|
||||
{ name: localize('topOperations.object', 'Object'), field: 'object' },
|
||||
|
||||
@@ -10,7 +10,7 @@ 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 { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IViewlet } from 'vs/workbench/common/viewlet';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -21,6 +21,7 @@ import ext = require('vs/workbench/common/contributions');
|
||||
import { ITaskService } from 'sql/parts/taskHistory/common/taskService';
|
||||
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
|
||||
export class StatusUpdater implements ext.IWorkbenchContribution {
|
||||
static ID = 'data.taskhistory.statusUpdater';
|
||||
@@ -80,9 +81,9 @@ export class TaskHistoryViewletAction extends ToggleViewletAction {
|
||||
id: string,
|
||||
label: string,
|
||||
@IViewletService viewletService: IViewletService,
|
||||
@IWorkbenchEditorService editorService: IWorkbenchEditorService
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService
|
||||
) {
|
||||
super(id, label, VIEWLET_ID, viewletService, editorService);
|
||||
super(id, label, VIEWLET_ID, viewletService, editorGroupService);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
import { ITree, ContextMenuEvent } from 'vs/base/parts/tree/browser/tree';
|
||||
import treedefaults = require('vs/base/parts/tree/browser/treeDefaults');
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
@@ -20,7 +20,7 @@ import { TaskHistoryActionProvider } from 'sql/parts/taskHistory/viewlet/taskHis
|
||||
export class TaskHistoryController extends treedefaults.DefaultController {
|
||||
|
||||
constructor(private actionProvider: TaskHistoryActionProvider,
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IEditorService private editorService: IEditorService,
|
||||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@ITelemetryService private telemetryService: ITelemetryService,
|
||||
@IKeybindingService private keybindingService: IKeybindingService
|
||||
|
||||
@@ -18,6 +18,7 @@ import { ITaskDialogComponentParams } from 'sql/services/bootstrap/bootstrapPara
|
||||
import { TaskDialogModule } from 'sql/parts/tasks/dialog/taskDialog.module';
|
||||
import { TASKDIALOG_SELECTOR } from 'sql/parts/tasks/dialog/taskDialog.component';
|
||||
import { bootstrapAngular } from 'sql/services/bootstrap/bootstrapService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
export class TaskDialogEditor extends BaseEditor {
|
||||
|
||||
@@ -50,7 +51,7 @@ export class TaskDialogEditor extends BaseEditor {
|
||||
public layout(dimension: Dimension): void {
|
||||
}
|
||||
|
||||
public setInput(input: TaskDialogInput, options: EditorOptions): TPromise<void> {
|
||||
public setInput(input: TaskDialogInput, options: EditorOptions): Thenable<void> {
|
||||
if (this.input instanceof TaskDialogInput && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
}
|
||||
@@ -60,7 +61,7 @@ export class TaskDialogEditor extends BaseEditor {
|
||||
}
|
||||
this.revealElementWithTagName(input.uniqueSelector, this.getContainer());
|
||||
|
||||
return super.setInput(input, options);
|
||||
return super.setInput(input, options, CancellationToken.None);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,23 +50,23 @@ export class ClipboardService implements IClipboardService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes files to the system clipboard.
|
||||
* Writes resources to the system clipboard.
|
||||
*/
|
||||
writeFiles(files: URI[]): void {
|
||||
this._vsClipboardService.writeFiles(files);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads files from the system clipboard.
|
||||
*/
|
||||
readFiles(): URI[] {
|
||||
return this._vsClipboardService.readFiles();
|
||||
writeResources(resources: URI[]): void {
|
||||
this._vsClipboardService.writeResources(resources);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out if files are copied to the clipboard.
|
||||
* Reads resources from the system clipboard.
|
||||
*/
|
||||
hasFiles(): boolean {
|
||||
return this._vsClipboardService.hasFiles();
|
||||
readResources(): URI[] {
|
||||
return this._vsClipboardService.readResources();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out if resources are copied to the clipboard.
|
||||
*/
|
||||
hasResources(): boolean {
|
||||
return this._vsClipboardService.hasResources();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,20 +6,15 @@ import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as platform from 'vs/platform/registry/common/platform';
|
||||
import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IConstructorSignature3, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as nls from 'vs/nls';
|
||||
import { ILocalizedString, IMenuItem, MenuRegistry, ICommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { ILocalizedString, MenuRegistry, ICommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { LinkedList } from 'vs/base/common/linkedList';
|
||||
import { IdGenerator } from 'vs/base/common/idGenerator';
|
||||
import { createCSSRule } from 'vs/base/browser/dom';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export interface ITaskOptions {
|
||||
id: string;
|
||||
@@ -33,14 +28,17 @@ export abstract class Task {
|
||||
public readonly id: string;
|
||||
public readonly title: string;
|
||||
public readonly iconPathDark: string;
|
||||
public readonly iconPath: { dark: string; light: string; };
|
||||
public readonly iconPath: { dark: URI; light?: URI; };
|
||||
private readonly _iconClass: string;
|
||||
private readonly _description: ITaskHandlerDescription;
|
||||
|
||||
constructor(opts: ITaskOptions) {
|
||||
constructor(private opts: ITaskOptions) {
|
||||
this.id = opts.id;
|
||||
this.title = opts.title;
|
||||
this.iconPath = opts.iconPath;
|
||||
this.iconPath = {
|
||||
dark: URI.parse(opts.iconPath.dark),
|
||||
light: URI.parse(opts.iconPath.light),
|
||||
};
|
||||
this._iconClass = opts.iconClass;
|
||||
this._description = opts.description;
|
||||
}
|
||||
@@ -51,14 +49,14 @@ export abstract class Task {
|
||||
handler: (accessor, profile, args) => this.runTask(accessor, profile, args),
|
||||
description: this._description,
|
||||
iconClass: this._iconClass,
|
||||
iconPath: this.iconPath,
|
||||
iconPath: this.opts.iconPath,
|
||||
title: this.title
|
||||
};
|
||||
}
|
||||
|
||||
private toCommandAction(): ICommandAction {
|
||||
return {
|
||||
iconPath: this.iconPath,
|
||||
iconLocation: this.iconPath,
|
||||
id: this.id,
|
||||
title: this.title
|
||||
};
|
||||
@@ -137,7 +135,10 @@ export const TaskRegistry: ITaskRegistry = new class implements ITaskRegistry {
|
||||
}
|
||||
if (idOrTask.iconPath && idOrTask.title) {
|
||||
this.taskIdToCommandActionMap.set(idOrTask.id, {
|
||||
iconPath: idOrTask.iconPath,
|
||||
iconLocation: {
|
||||
dark: URI.parse(idOrTask.iconPath.dark),
|
||||
light: URI.parse(idOrTask.iconPath.light),
|
||||
},
|
||||
id: idOrTask.id,
|
||||
title: idOrTask.title
|
||||
});
|
||||
@@ -164,10 +165,10 @@ export const TaskRegistry: ITaskRegistry = new class implements ITaskRegistry {
|
||||
let iconClass = null;
|
||||
if (this.taskIdToIconClassNameMap.has(item.id)) {
|
||||
iconClass = this.taskIdToIconClassNameMap.get(item.id);
|
||||
} else if (item.iconPath) {
|
||||
} else if (item.iconLocation) {
|
||||
iconClass = ids.nextId();
|
||||
createCSSRule(`.icon.${iconClass}`, `background-image: url("${URI.file(item.iconPath.light || item.iconPath.dark).toString()}")`);
|
||||
createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${URI.file(item.iconPath.dark).toString()}")`);
|
||||
createCSSRule(`.icon.${iconClass}`, `background-image: url("${(item.iconLocation.light || item.iconLocation.dark).toString()}")`);
|
||||
createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${(item.iconLocation.dark).toString()}")`);
|
||||
this.taskIdToIconClassNameMap.set(item.id, iconClass);
|
||||
}
|
||||
return iconClass;
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { NgModuleRef, enableProdMode, InjectionToken, Type, PlatformRef, Provider, Injector, Optional, Inject, ComponentFactoryResolver } from '@angular/core';
|
||||
import { NgModuleRef, enableProdMode, InjectionToken, Type, PlatformRef, Provider } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import { IInstantiationService, _util } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
|
||||
const selectorCounter = new Map<string, number>();
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -51,7 +51,7 @@ declare module 'sqlops' {
|
||||
|
||||
export interface TreeComponentView<T> extends vscode.Disposable {
|
||||
onNodeCheckedChanged: vscode.Event<NodeCheckedEventParameters<T>>;
|
||||
onDidChangeSelection: vscode.Event<T[]>;
|
||||
onDidChangeSelection: vscode.Event<vscode.TreeViewSelectionChangeEvent<T>>;
|
||||
}
|
||||
|
||||
export class TreeComponentItem extends vscode.TreeItem {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { WebViewDialog } from 'sql/base/browser/ui/modal/webViewDialog';
|
||||
import { MainThreadModalDialogShape, SqlMainContext, SqlExtHostContext, ExtHostModalDialogsShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
|
||||
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import 'vs/css!sql/media/icons/common-icons';
|
||||
|
||||
@@ -19,7 +19,7 @@ export class MainThreadModalDialog implements MainThreadModalDialogShape {
|
||||
|
||||
constructor(
|
||||
context: IExtHostContext,
|
||||
@IWorkbenchEditorService private readonly _editorService: IWorkbenchEditorService,
|
||||
@IEditorService private readonly _editorService: IEditorService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService
|
||||
) {
|
||||
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModalDialogs);
|
||||
|
||||
@@ -66,6 +66,15 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape
|
||||
}
|
||||
}
|
||||
|
||||
$setExpanded(treeViewId: string, treeItemHandle: string, expanded: boolean): void {
|
||||
}
|
||||
|
||||
$setSelection(treeViewId: string, treeItemHandles: string[]): void {
|
||||
}
|
||||
|
||||
$setVisible(treeViewId: string, visible: boolean): void {
|
||||
}
|
||||
|
||||
private createExtHostTreeViewer<T>(handle: number, id: string, dataProvider: sqlops.TreeComponentDataProvider<T>): ExtHostTreeView<T> {
|
||||
const treeView = new ExtHostTreeView<T>(handle, id, dataProvider, this._proxy, undefined);
|
||||
this.treeViews.set(`${handle}-${id}`, treeView);
|
||||
@@ -76,11 +85,13 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape
|
||||
export class ExtHostTreeView<T> extends vsTreeExt.ExtHostTreeView<T> {
|
||||
|
||||
private _onNodeCheckedChanged = new Emitter<sqlops.NodeCheckedEventParameters<T>>();
|
||||
private _onDidChangeSelection = new Emitter<T[]>();
|
||||
private _onChangeSelection = new Emitter<vscode.TreeViewSelectionChangeEvent<T>>();
|
||||
public readonly NodeCheckedChanged: vscode.Event<sqlops.NodeCheckedEventParameters<T>> = this._onNodeCheckedChanged.event;
|
||||
public readonly ChangeSelection: vscode.Event<T[]> = this._onDidChangeSelection.event;
|
||||
constructor(private handle: number, private componentId: string, private componentDataProvider: sqlops.TreeComponentDataProvider<T>, private modelViewProxy: MainThreadModelViewShape, commands: CommandsConverter) {
|
||||
super(componentId, componentDataProvider, undefined, commands);
|
||||
public readonly ChangeSelection: vscode.Event<vscode.TreeViewSelectionChangeEvent<T>> = this._onChangeSelection.event;
|
||||
constructor(
|
||||
private handle: number, private componentId: string, private componentDataProvider: sqlops.TreeComponentDataProvider<T>,
|
||||
private modelViewProxy: MainThreadModelViewShape, commands: CommandsConverter) {
|
||||
super(componentId, componentDataProvider, undefined, commands, undefined);
|
||||
}
|
||||
|
||||
onNodeCheckedChanged(parentHandle?: vsTreeExt.TreeItemHandle, checked?: boolean): void {
|
||||
@@ -97,7 +108,7 @@ export class ExtHostTreeView<T> extends vsTreeExt.ExtHostTreeView<T> {
|
||||
let nodes = parentHandles.map(parentHandle => {
|
||||
return parentHandle ? this.getExtensionElement(parentHandle) : void 0;
|
||||
});
|
||||
this._onDidChangeSelection.fire(nodes);
|
||||
this._onChangeSelection.fire({ selection: nodes});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +122,7 @@ export class ExtHostTreeView<T> extends vsTreeExt.ExtHostTreeView<T> {
|
||||
.then(treeNode => i));
|
||||
}
|
||||
|
||||
protected refresh(elements: T[]): void {
|
||||
protected refreshElements(elements: T[]): void {
|
||||
const hasRoot = elements.some(element => !element);
|
||||
if (hasRoot) {
|
||||
this.clearAll(); // clear cache
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { IConnectionManagementService, IConnectionDialogService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -25,7 +25,7 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
||||
extHostContext: IExtHostContext,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
@IWorkbenchEditorService private _workbenchEditorService: IWorkbenchEditorService,
|
||||
@IEditorService private _workbenchEditorService: IEditorService,
|
||||
@IConnectionDialogService private _connectionDialogService: IConnectionDialogService,
|
||||
) {
|
||||
if (extHostContext) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
@@ -33,7 +33,7 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
|
||||
constructor(
|
||||
context: IExtHostContext,
|
||||
@IInstantiationService private _instatiationService: IInstantiationService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModelViewDialog);
|
||||
this._dialogService = new CustomDialogService(_instatiationService);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IObjectExplorerService, NodeInfoWithConnection } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -26,7 +26,7 @@ export class MainThreadObjectExplorer implements MainThreadObjectExplorerShape {
|
||||
extHostContext: IExtHostContext,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
@IWorkbenchEditorService private _workbenchEditorService: IWorkbenchEditorService
|
||||
@IEditorService private _workbenchEditorService: IEditorService
|
||||
) {
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostObjectExplorer);
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
'use strict';
|
||||
|
||||
import { SqlExtHostContext, SqlMainContext, ExtHostQueryEditorShape, MainThreadQueryEditorShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
|
||||
import * as sqlops from 'sqlops';
|
||||
import * as vscode from 'vscode';
|
||||
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { IConnectionManagementService, IConnectionCompletionOptions, ConnectionType, RunQueryOnConnectionMode } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||
import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadQueryEditor)
|
||||
@@ -25,7 +23,7 @@ export class MainThreadQueryEditor implements MainThreadQueryEditorShape {
|
||||
extHostContext: IExtHostContext,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IQueryEditorService private _queryEditorService: IQueryEditorService,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
@IEditorService private _editorService: IEditorService
|
||||
) {
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostQueryEditor);
|
||||
@@ -39,7 +37,10 @@ export class MainThreadQueryEditor implements MainThreadQueryEditorShape {
|
||||
|
||||
public $connect(fileUri: string, connectionId: string): Thenable<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let editor = this._editorService.getVisibleEditors().find(editor => editor.input.getResource().toString() === fileUri);
|
||||
let editors = this._editorService.visibleControls.filter(resource => {
|
||||
return !!resource && resource.input.getResource().toString() === fileUri;
|
||||
});
|
||||
let editor = editors && editors.length > 0 ? editors[0] : undefined;
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.none, input: editor ? editor.input as any : undefined },
|
||||
saveTheConnection: false,
|
||||
@@ -65,7 +66,7 @@ export class MainThreadQueryEditor implements MainThreadQueryEditorShape {
|
||||
}
|
||||
|
||||
public $runQuery(fileUri: string): void {
|
||||
let filteredEditors = this._editorService.getVisibleEditors().filter(editor => editor.input.getResource().toString() === fileUri);
|
||||
let filteredEditors = this._editorService.visibleControls.filter(editor => editor.input.getResource().toString() === fileUri);
|
||||
if (filteredEditors && filteredEditors.length > 0) {
|
||||
let editor = filteredEditors[0];
|
||||
if (editor instanceof QueryEditor) {
|
||||
|
||||
@@ -451,7 +451,7 @@ function createExtensionPathIndex(extensionService: ExtHostExtensionService): TP
|
||||
return undefined;
|
||||
}
|
||||
return new TPromise((resolve, reject) => {
|
||||
realpath(ext.extensionFolderPath, (err, path) => {
|
||||
realpath(ext.extensionLocation.fsPath, (err, path) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
@@ -533,8 +533,9 @@ const nullExtensionDescription: IExtensionDescription = {
|
||||
enableProposedApi: false,
|
||||
engines: undefined,
|
||||
extensionDependencies: undefined,
|
||||
extensionFolderPath: undefined,
|
||||
extensionLocation: undefined,
|
||||
isBuiltin: false,
|
||||
main: undefined,
|
||||
version: undefined
|
||||
version: undefined,
|
||||
isUnderDevelopment: true
|
||||
};
|
||||
|
||||
@@ -618,6 +618,10 @@ export interface ExtHostModelViewTreeViewsShape {
|
||||
$createTreeView(handle: number, componentId: string, options: { treeDataProvider: vscode.TreeDataProvider<any> }): sqlops.TreeComponentView<any>;
|
||||
$onNodeCheckedChanged(treeViewId: string, treeItemHandle?: string, checked?: boolean): void;
|
||||
$onNodeSelected(treeViewId: string, nodes: string[]): void;
|
||||
|
||||
$setExpanded(treeViewId: string, treeItemHandle: string, expanded: boolean): void;
|
||||
$setSelection(treeViewId: string, treeItemHandles: string[]): void;
|
||||
$setVisible(treeViewId: string, visible: boolean): void;
|
||||
}
|
||||
|
||||
export interface ExtHostBackgroundTaskManagementShape {
|
||||
|
||||
@@ -25,7 +25,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export interface BaseActionContext {
|
||||
@@ -63,7 +63,7 @@ export class NewQueryAction extends Task {
|
||||
accessor.get<IConnectionManagementService>(IConnectionManagementService),
|
||||
accessor.get<IQueryEditorService>(IQueryEditorService),
|
||||
accessor.get<IObjectExplorerService>(IObjectExplorerService),
|
||||
accessor.get<IWorkbenchEditorService>(IWorkbenchEditorService)
|
||||
accessor.get<IEditorService>(IEditorService)
|
||||
).then(
|
||||
result => {
|
||||
resolve(void 0);
|
||||
|
||||
@@ -8,8 +8,8 @@ import ConnectionConstants = require('sql/parts/connection/common/constants');
|
||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
|
||||
/**
|
||||
* Gets the 'sql' configuration section for use in looking up settings. Note that configs under
|
||||
|
||||
@@ -25,7 +25,7 @@ import nls = require('vs/nls');
|
||||
import os = require('os');
|
||||
import path = require('path');
|
||||
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
import { DashboardInput } from 'sql/parts/dashboard/dashboardInput';
|
||||
|
||||
@@ -265,7 +265,7 @@ export function newQuery(
|
||||
connectionService: IConnectionManagementService,
|
||||
queryEditorService: IQueryEditorService,
|
||||
objectExplorerService: IObjectExplorerService,
|
||||
workbenchEditorService: IWorkbenchEditorService,
|
||||
workbenchEditorService: IEditorService,
|
||||
sqlContent?: string,
|
||||
executeOnOpen: RunQueryOnConnectionMode = RunQueryOnConnectionMode.none
|
||||
): Promise<void> {
|
||||
@@ -377,7 +377,7 @@ export function openInsight(query: IInsightsConfig, profile: IConnectionProfile,
|
||||
* @param workbenchEditorService
|
||||
* @param topLevelOnly If true, only return top-level (i.e. connected) Object Explorer connections instead of database connections when appropriate
|
||||
*/
|
||||
export function getCurrentGlobalConnection(objectExplorerService: IObjectExplorerService, connectionManagementService: IConnectionManagementService, workbenchEditorService: IWorkbenchEditorService, topLevelOnly: boolean = false): IConnectionProfile {
|
||||
export function getCurrentGlobalConnection(objectExplorerService: IObjectExplorerService, connectionManagementService: IConnectionManagementService, workbenchEditorService: IEditorService, topLevelOnly: boolean = false): IConnectionProfile {
|
||||
let connection: IConnectionProfile;
|
||||
|
||||
let objectExplorerSelection = objectExplorerService.getSelectedProfileAndDatabase();
|
||||
@@ -395,7 +395,7 @@ export function getCurrentGlobalConnection(objectExplorerService: IObjectExplore
|
||||
}
|
||||
}
|
||||
|
||||
let activeInput = workbenchEditorService.getActiveEditorInput();
|
||||
let activeInput = workbenchEditorService.activeEditor;
|
||||
if (activeInput) {
|
||||
if (activeInput instanceof QueryInput || activeInput instanceof EditDataInput || activeInput instanceof DashboardInput) {
|
||||
connection = connectionManagementService.getConnectionProfile(activeInput.uri);
|
||||
|
||||
@@ -18,9 +18,5 @@ export interface IModelViewTreeViewDataProvider extends ITreeViewDataProvider {
|
||||
}
|
||||
|
||||
export interface IModelViewTreeViewDataProvider {
|
||||
onDidChange: Event<ITreeComponentItem[] | undefined | null>;
|
||||
|
||||
onDispose: Event<void>;
|
||||
|
||||
getChildren(element?: ITreeComponentItem): TPromise<ITreeComponentItem[]>;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
|
||||
@@ -99,7 +99,6 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
connectionStore.setup(x => x.addActiveConnection(TypeMoq.It.isAny())).returns(() => Promise.resolve());
|
||||
connectionStore.setup(x => x.saveProfile(TypeMoq.It.isAny())).returns(() => Promise.resolve(connectionProfile));
|
||||
workbenchEditorService.setup(x => x.openEditor(undefined, TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => TPromise.as(undefined));
|
||||
editorGroupService.setup(x => x.getStacksModel()).returns(() => undefined);
|
||||
connectionStore.setup(x => x.addSavedPassword(TypeMoq.It.is<IConnectionProfile>(
|
||||
c => c.serverName === connectionProfile.serverName))).returns(() => Promise.resolve({ profile: connectionProfile, savedCred: true }));
|
||||
connectionStore.setup(x => x.addSavedPassword(TypeMoq.It.is<IConnectionProfile>(
|
||||
|
||||
@@ -57,7 +57,6 @@ suite('SQL QueryEditor Tests', () => {
|
||||
undefined,
|
||||
editorDescriptorService.object,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined);
|
||||
};
|
||||
|
||||
@@ -112,14 +111,14 @@ suite('SQL QueryEditor Tests', () => {
|
||||
// Create a QueryInput
|
||||
let filePath = 'someFile.sql';
|
||||
let uri: URI = URI.parse(filePath);
|
||||
let fileInput = new UntitledEditorInput(uri, false, '', '', '', instantiationService.object, undefined, undefined, undefined, undefined);
|
||||
let fileInput = new UntitledEditorInput(uri, false, '', '', '', instantiationService.object, undefined, undefined, undefined);
|
||||
let queryResultsInput: QueryResultsInput = new QueryResultsInput(uri.fsPath);
|
||||
queryInput = new QueryInput('first', fileInput, queryResultsInput, undefined, undefined, undefined, undefined, undefined);
|
||||
|
||||
// Create a QueryInput to compare to the previous one
|
||||
let filePath2 = 'someFile2.sql';
|
||||
let uri2: URI = URI.parse(filePath2);
|
||||
let fileInput2 = new UntitledEditorInput(uri2, false, '', '', '', instantiationService.object, undefined, undefined, undefined, undefined);
|
||||
let fileInput2 = new UntitledEditorInput(uri2, false, '', '', '', instantiationService.object, undefined, undefined, undefined);
|
||||
let queryResultsInput2: QueryResultsInput = new QueryResultsInput(uri2.fsPath);
|
||||
queryInput2 = new QueryInput('second', fileInput2, queryResultsInput2, undefined, undefined, undefined, undefined, undefined);
|
||||
|
||||
@@ -342,7 +341,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
return new RunQueryAction(undefined, undefined, undefined);
|
||||
});
|
||||
|
||||
let fileInput = new UntitledEditorInput(URI.parse('testUri'), false, '', '', '', instantiationService.object, undefined, undefined, undefined, undefined);
|
||||
let fileInput = new UntitledEditorInput(URI.parse('testUri'), false, '', '', '', instantiationService.object, undefined, undefined, undefined);
|
||||
queryModelService = TypeMoq.Mock.ofType(QueryModelService, TypeMoq.MockBehavior.Loose, undefined, undefined);
|
||||
queryModelService.callBase = true;
|
||||
queryInput = new QueryInput(
|
||||
|
||||
@@ -6,15 +6,34 @@
|
||||
'use strict';
|
||||
|
||||
import { ServiceIdentifier, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Position, IEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorStacksModel, IEditorGroup, EditorInput, IEditorOpeningEvent } from 'vs/workbench/common/editor';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IEditorTabOptions, GroupArrangement, GroupOrientation, IEditorGroupService, IMoveOptions } from 'vs/workbench/services/group/common/groupService';
|
||||
import { EditorGroup } from 'vs/workbench/common/editor/editorStacksModel';
|
||||
import { IEditorGroupsService, GroupOrientation, IEditorGroup, GroupDirection, GroupsArrangement, IMoveEditorOptions, GroupsOrder, EditorGroupLayout, IFindGroupScope, IAddGroupOptions, IMergeGroupOptions } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { IEditorOpeningEvent } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IEditorInput, EditorInput, GroupIdentifier } from 'vs/workbench/common/editor';
|
||||
import { EditorGroup } from 'vs/workbench/common/editor/editorGroup';
|
||||
|
||||
export class EditorGroupTestService implements IEditorGroupService {
|
||||
export class EditorGroupTestService implements IEditorGroupsService {
|
||||
_serviceBrand: ServiceIdentifier<any>;
|
||||
|
||||
findGroup(scope: IFindGroupScope, source?: IEditorGroup | GroupIdentifier, wrap?: boolean): IEditorGroup {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
addGroup(location: IEditorGroup | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroup {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
removeGroup(group: IEditorGroup | GroupIdentifier): void {
|
||||
}
|
||||
|
||||
mergeGroup(group: IEditorGroup | GroupIdentifier, target: IEditorGroup | GroupIdentifier, options?: IMergeGroupOptions): IEditorGroup {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
copyGroup(group: IEditorGroup | GroupIdentifier, location: IEditorGroup | GroupIdentifier, direction: GroupDirection): IEditorGroup {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Emitted when editors or inputs change. Examples: opening, closing of editors. Active editor change.
|
||||
*/
|
||||
@@ -24,6 +43,64 @@ export class EditorGroupTestService implements IEditorGroupService {
|
||||
|
||||
onEditorGroupMoved: Event<void>;
|
||||
|
||||
/**
|
||||
* An event for when the active editor group changes. The active editor
|
||||
* group is the default location for new editors to open.
|
||||
*/
|
||||
readonly onDidActiveGroupChange: Event<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* An event for when a new group was added.
|
||||
*/
|
||||
readonly onDidAddGroup: Event<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* An event for when a group was removed.
|
||||
*/
|
||||
readonly onDidRemoveGroup: Event<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* An event for when a group was moved.
|
||||
*/
|
||||
readonly onDidMoveGroup: Event<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* An active group is the default location for new editors to open.
|
||||
*/
|
||||
readonly activeGroup: IEditorGroup;
|
||||
|
||||
/**
|
||||
* All groups that are currently visible in the editor area in the
|
||||
* order of their creation (oldest first).
|
||||
*/
|
||||
readonly groups: ReadonlyArray<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* The number of editor groups that are currently opened.
|
||||
*/
|
||||
readonly count: number;
|
||||
|
||||
/**
|
||||
* The current layout orientation of the root group.
|
||||
*/
|
||||
readonly orientation: GroupOrientation;
|
||||
|
||||
/**
|
||||
* Get all groups that are currently visible in the editor area optionally
|
||||
* sorted by being most recent active or grid order. Will sort by creation
|
||||
* time by default (oldest group first).
|
||||
*/
|
||||
getGroups(order?: GroupsOrder): ReadonlyArray<IEditorGroup> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to convert a group identifier to a group.
|
||||
*/
|
||||
getGroup(identifier: GroupIdentifier): IEditorGroup {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
invokeWithinEditorContext<T>(fn: (accessor: ServicesAccessor) => T): T {
|
||||
return undefined;
|
||||
}
|
||||
@@ -43,11 +120,6 @@ export class EditorGroupTestService implements IEditorGroupService {
|
||||
*/
|
||||
onGroupOrientationChanged: Event<void>;
|
||||
|
||||
/**
|
||||
* Emitted when tab options changed.
|
||||
*/
|
||||
onTabOptionsChanged: Event<IEditorTabOptions>;
|
||||
|
||||
/**
|
||||
* Keyboard focus the editor group at the provided position.
|
||||
*/
|
||||
@@ -58,26 +130,27 @@ export class EditorGroupTestService implements IEditorGroupService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the editor group at the provided position without moving focus.
|
||||
* Set a group as active. An active group is the default location for new editors to open.
|
||||
*/
|
||||
public activateGroup(group: EditorGroup): void;
|
||||
public activateGroup(position: Position): void;
|
||||
public activateGroup(arg1: any): void {
|
||||
}
|
||||
/**
|
||||
* Allows to move the editor group from one position to another.
|
||||
*/
|
||||
|
||||
|
||||
public moveGroup(from: EditorGroup, to: EditorGroup): void;
|
||||
public moveGroup(from: Position, to: Position): void;
|
||||
public moveGroup(arg1: any, arg2: any): void {
|
||||
activateGroup(group: IEditorGroup | GroupIdentifier): IEditorGroup {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to arrange editor groups according to the GroupArrangement enumeration.
|
||||
* Move a group to a new group in the editor area.
|
||||
*
|
||||
* @param group the group to move
|
||||
* @param location the group from which to split to add the moved group
|
||||
* @param direction the direction of where to split to
|
||||
*/
|
||||
arrangeGroups(arrangement: GroupArrangement): void {
|
||||
moveGroup(group: IEditorGroup | GroupIdentifier, location: IEditorGroup | GroupIdentifier, direction: GroupDirection): IEditorGroup {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arrange all groups according to the provided arrangement.
|
||||
*/
|
||||
arrangeGroups(arrangement: GroupsArrangement): void {
|
||||
|
||||
}
|
||||
|
||||
@@ -97,28 +170,12 @@ export class EditorGroupTestService implements IEditorGroupService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves an editor from one group to another. The index in the group is optional.
|
||||
* Move an editor from this group either within this group or to another group.
|
||||
*/
|
||||
moveEditor(input: IEditorInput, from: IEditorGroup, to: IEditorGroup, moveOptions?: IMoveOptions): void;
|
||||
moveEditor(input: IEditorInput, from: Position, to: Position, moveOptions?: IMoveOptions): void;
|
||||
moveEditor(input: EditorInput, arg2: any, arg3: any, index?: IMoveOptions): void {
|
||||
moveEditor(editor: IEditorInput, target: IEditorGroup, options?: IMoveEditorOptions): void {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides access to the editor stacks model
|
||||
*/
|
||||
getStacksModel(): IEditorStacksModel {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if tabs are shown, false otherwise.
|
||||
*/
|
||||
getTabOptions(): IEditorTabOptions {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public pinEditor(group: EditorGroup, input: EditorInput): void;
|
||||
public pinEditor(position: Position, input: EditorInput): void;
|
||||
public pinEditor(arg1: any, input: EditorInput): void {
|
||||
@@ -138,4 +195,23 @@ export class EditorGroupTestService implements IEditorGroupService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of a group.
|
||||
*/
|
||||
getSize(group: IEditorGroup | GroupIdentifier): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the size of a group.
|
||||
*/
|
||||
setSize(group: IEditorGroup | GroupIdentifier, size: number): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the provided layout by either moving existing groups or creating new groups.
|
||||
*/
|
||||
applyLayout(layout: EditorGroupLayout): void {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,38 +3,38 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IEditorService, IEditor, IEditorInput, IEditorOptions, ITextEditorOptions, Position, Direction, IResourceInput, IResourceDiffInput, IResourceSideBySideInput }
|
||||
from 'vs/platform/editor/common/editor';
|
||||
import { IEditorService, SIDE_GROUP_TYPE, ACTIVE_GROUP_TYPE, IResourceEditor, IResourceEditorReplacement, IOpenEditorOverrideHandler } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ServiceIdentifier, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IEditorOptions, IResourceInput, ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IEditor, IEditorInput, IResourceDiffInput, IResourceSideBySideInput, GroupIdentifier, ITextEditor, IUntitledResourceInput, ITextDiffEditor, ITextSideBySideEditor, IEditorInputWithOptions } from 'vs/workbench/common/editor';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { EditorInput, EditorOptions, IFileEditorInput, TextEditorOptions, Extensions, SideBySideEditorInput } from 'vs/workbench/common/editor';
|
||||
import { ICloseEditorsFilter } from 'vs/workbench/browser/parts/editor/editorPart';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { IEditorGroup, IEditorReplacement } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export class WorkbenchEditorTestService implements IWorkbenchEditorService {
|
||||
export class WorkbenchEditorTestService implements IEditorService {
|
||||
_serviceBrand: ServiceIdentifier<any>;
|
||||
|
||||
/**
|
||||
* Returns the currently active editor or null if none.
|
||||
*/
|
||||
getActiveEditor(): IEditor {
|
||||
return undefined;
|
||||
}
|
||||
readonly onDidActiveEditorChange: Event<void>;
|
||||
|
||||
/**
|
||||
* Returns the currently active editor input or null if none.
|
||||
*/
|
||||
getActiveEditorInput(): IEditorInput {
|
||||
return undefined;
|
||||
}
|
||||
readonly onDidVisibleEditorsChange: Event<void>;
|
||||
|
||||
readonly activeEditor: IEditorInput;
|
||||
|
||||
readonly activeControl: IEditor;
|
||||
|
||||
readonly activeTextEditorWidget: ICodeEditor;
|
||||
|
||||
readonly visibleEditors: ReadonlyArray<IEditorInput>;
|
||||
|
||||
readonly visibleControls: ReadonlyArray<IEditor>;
|
||||
|
||||
readonly visibleTextEditorWidgets: ReadonlyArray<ICodeEditor>;
|
||||
|
||||
readonly editors: ReadonlyArray<IEditorInput>;
|
||||
|
||||
/**
|
||||
* Returns an array of visible editors.
|
||||
*/
|
||||
getVisibleEditors(): IEditor[] {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns iff the provided input is currently visible.
|
||||
@@ -46,33 +46,23 @@ export class WorkbenchEditorTestService implements IWorkbenchEditorService {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
protected doOpenEditor(input: IEditorInput, options?: EditorOptions, sideBySide?: boolean): TPromise<IEditor>;
|
||||
protected doOpenEditor(input: IEditorInput, options?: EditorOptions, position?: Position): TPromise<IEditor>;
|
||||
protected doOpenEditor(input: IEditorInput, options?: EditorOptions, arg3?: any): TPromise<IEditor> {
|
||||
public openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
public openEditor(editor: IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ITextEditor>;
|
||||
public openEditor(editor: IResourceDiffInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ITextDiffEditor>;
|
||||
public openEditor(editor: IResourceSideBySideInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ITextSideBySideEditor>;
|
||||
public openEditor(input: any, arg2?: any, arg3?: any): TPromise<IEditor> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an Editor on the given input with the provided options at the given position. If sideBySide parameter
|
||||
* is provided, causes the editor service to decide in what position to open the input.
|
||||
*/
|
||||
public openEditor(input: IEditorInput, options?: IEditorOptions, sideBySide?: boolean): TPromise<IEditor>;
|
||||
public openEditor(input: IEditorInput, options?: IEditorOptions, position?: Position): TPromise<IEditor>;
|
||||
public openEditor(input: IResourceInput | IResourceDiffInput | IResourceSideBySideInput, position?: Position): TPromise<IEditor>;
|
||||
public openEditor(input: IResourceInput | IResourceDiffInput | IResourceSideBySideInput, sideBySide?: boolean): TPromise<IEditor>;
|
||||
public openEditor(input: any, arg2?: any, arg3?: any): TPromise<IEditor> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public openEditors(editors: { input: IResourceInput | IResourceDiffInput | IResourceSideBySideInput, position: Position }[]): TPromise<IEditor[]>;
|
||||
public openEditors(editors: { input: IEditorInput, position: Position, options?: IEditorOptions }[]): TPromise<IEditor[]>;
|
||||
public openEditors(editors: IEditorInputWithOptions[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ReadonlyArray<IEditor>>;
|
||||
public openEditors(editors: IResourceEditor[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ReadonlyArray<IEditor>>;
|
||||
public openEditors(editors: any[]): TPromise<IEditor[]> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public replaceEditors(editors: { toReplace: IResourceInput | IResourceDiffInput | IResourceSideBySideInput, replaceWith: IResourceInput | IResourceDiffInput | IResourceSideBySideInput }[], position?: Position): TPromise<BaseEditor[]>;
|
||||
public replaceEditors(editors: { toReplace: IEditorInput, replaceWith: IEditorInput, options?: IEditorOptions }[], position?: Position): TPromise<BaseEditor[]>;
|
||||
public replaceEditors(editors: any[], position?: Position): TPromise<BaseEditor[]> {
|
||||
public replaceEditors(editors: IResourceEditorReplacement[], group: IEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
public replaceEditors(editors: IEditorReplacement[], group: IEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
public replaceEditors(editors: any[], group: any): TPromise<void> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -99,10 +89,21 @@ export class WorkbenchEditorTestService implements IWorkbenchEditorService {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to resolve an untyped input to a workbench typed instanceof editor input
|
||||
*/
|
||||
|
||||
createInput(input: IResourceInput | IResourceDiffInput | IResourceSideBySideInput): IEditorInput {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
overrideOpenEditor(handler: IOpenEditorOverrideHandler): IDisposable {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
invokeWithinEditorContext<T>(fn: (accessor: ServicesAccessor) => T): T {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ suite('TaskUtilities', function () {
|
||||
return { profile: expectedProfile, databaseName: undefined };
|
||||
});
|
||||
mockConnectionManagementService.setup(x => x.isProfileConnected(TypeMoq.It.is(profile => profile === expectedProfile))).returns(() => true);
|
||||
mockWorkbenchEditorService.setup(x => x.getActiveEditorInput()).returns(() => undefined);
|
||||
|
||||
// If I call getCurrentGlobalConnection, it should return the expected server profile
|
||||
let actualProfile = TaskUtilities.getCurrentGlobalConnection(mockObjectExplorerService.object, mockConnectionManagementService.object, mockWorkbenchEditorService.object);
|
||||
@@ -48,7 +47,6 @@ suite('TaskUtilities', function () {
|
||||
return { profile: serverProfile, databaseName: dbName };
|
||||
});
|
||||
mockConnectionManagementService.setup(x => x.isProfileConnected(TypeMoq.It.is(profile => profile === serverProfile))).returns(() => true);
|
||||
mockWorkbenchEditorService.setup(x => x.getActiveEditorInput()).returns(() => undefined);
|
||||
|
||||
// If I call getCurrentGlobalConnection, it should return the expected database profile
|
||||
let actualProfile = TaskUtilities.getCurrentGlobalConnection(mockObjectExplorerService.object, mockConnectionManagementService.object, mockWorkbenchEditorService.object);
|
||||
@@ -79,9 +77,8 @@ suite('TaskUtilities', function () {
|
||||
|
||||
// Mock the workbench service to return the active tab connection
|
||||
let tabConnectionUri = 'test_uri';
|
||||
let editorInput = new UntitledEditorInput(URI.parse(tabConnectionUri), false, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
let editorInput = new UntitledEditorInput(URI.parse(tabConnectionUri), false, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
let queryInput = new QueryInput(undefined, editorInput, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
mockWorkbenchEditorService.setup(x => x.getActiveEditorInput()).returns(() => queryInput);
|
||||
mockConnectionManagementService.setup(x => x.getConnectionProfile(tabConnectionUri)).returns(() => tabProfile);
|
||||
|
||||
// If I call getCurrentGlobalConnection, it should return the expected profile from the active tab
|
||||
@@ -104,7 +101,6 @@ suite('TaskUtilities', function () {
|
||||
return { profile: oeProfile, databaseName: undefined };
|
||||
});
|
||||
mockConnectionManagementService.setup(x => x.isProfileConnected(TypeMoq.It.is(profile => profile === oeProfile))).returns(() => true);
|
||||
mockWorkbenchEditorService.setup(x => x.getActiveEditorInput()).returns(() => undefined);
|
||||
|
||||
// If I call getCurrentGlobalConnection, it should return the expected profile from OE
|
||||
let actualProfile = TaskUtilities.getCurrentGlobalConnection(mockObjectExplorerService.object, mockConnectionManagementService.object, mockWorkbenchEditorService.object);
|
||||
|
||||
+6
-1
@@ -18,5 +18,10 @@
|
||||
"typeRoots": [
|
||||
"typings"
|
||||
]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"../out",
|
||||
"../out-build",
|
||||
"../out-vscode"
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -8,7 +8,7 @@ declare module 'vscode-chokidar' {
|
||||
/**
|
||||
* takes paths to be watched recursively and options
|
||||
*/
|
||||
export function watch(paths: string, options: IOptions): FSWatcher;
|
||||
export function watch(paths: string | string[], options: IOptions): FSWatcher;
|
||||
|
||||
export interface IOptions {
|
||||
|
||||
|
||||
Vendored
+991
-273
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Generated by typings
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/3c56e866d6edd234416a92c3d35c15ccd7fe6b72/core-js/index.d.ts
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
//declare type PropertyKey = string | number | symbol;
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Object & Function
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2017, Daniel Imms (Source EULA).
|
||||
*/
|
||||
|
||||
declare module 'node-pty' {
|
||||
|
||||
Vendored
+6222
-3360
File diff suppressed because it is too large
Load Diff
Vendored
+85
-11
@@ -23,13 +23,16 @@ declare module "vscode-textmate" {
|
||||
readonly name?: string;
|
||||
readonly settings: IRawThemeSetting[];
|
||||
}
|
||||
export interface Thenable<T> extends PromiseLike<T> {
|
||||
}
|
||||
/**
|
||||
* A registry helper that can locate grammar file paths given scope names.
|
||||
*/
|
||||
export interface RegistryOptions {
|
||||
theme?: IRawTheme;
|
||||
getFilePath(scopeName: string): string;
|
||||
loadGrammar(scopeName: string): Thenable<IRawGrammar>;
|
||||
getInjections?(scopeName: string): string[];
|
||||
getOnigLib?(): Thenable<IOnigLib>;
|
||||
}
|
||||
/**
|
||||
* A map from scope name to a language id. Please do not use language id 0.
|
||||
@@ -38,10 +41,10 @@ declare module "vscode-textmate" {
|
||||
[scopeName: string]: number;
|
||||
}
|
||||
/**
|
||||
* A map from scope name to a token type.
|
||||
* A map from selectors to token types.
|
||||
*/
|
||||
export interface ITokenTypeMap {
|
||||
[scopeName: string]: StandardTokenType;
|
||||
[selector: string]: StandardTokenType;
|
||||
}
|
||||
export const enum StandardTokenType {
|
||||
Other = 0,
|
||||
@@ -72,25 +75,25 @@ declare module "vscode-textmate" {
|
||||
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
|
||||
* Please do not use language id 0.
|
||||
*/
|
||||
loadGrammarWithEmbeddedLanguages(initialScopeName: string, initialLanguage: number, embeddedLanguages: IEmbeddedLanguagesMap, callback: (err: any, grammar: IGrammar) => void): void;
|
||||
loadGrammarWithEmbeddedLanguages(initialScopeName: string, initialLanguage: number, embeddedLanguages: IEmbeddedLanguagesMap): Thenable<IGrammar>;
|
||||
/**
|
||||
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
|
||||
* Please do not use language id 0.
|
||||
*/
|
||||
loadGrammarWithConfiguration(initialScopeName: string, initialLanguage: number, configuration: IGrammarConfiguration, callback: (err: any, grammar: IGrammar) => void): void;
|
||||
loadGrammarWithConfiguration(initialScopeName: string, initialLanguage: number, configuration: IGrammarConfiguration): Thenable<IGrammar>;
|
||||
/**
|
||||
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
|
||||
*/
|
||||
loadGrammar(initialScopeName: string, callback: (err: any, grammar: IGrammar) => void): void;
|
||||
private _loadGrammar(initialScopeName, callback);
|
||||
loadGrammar(initialScopeName: string): Thenable<IGrammar>;
|
||||
private _loadGrammar(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes);
|
||||
/**
|
||||
* Load the grammar at `path` synchronously.
|
||||
* Adds a rawGrammar.
|
||||
*/
|
||||
loadGrammarFromPathSync(path: string, initialLanguage?: number, embeddedLanguages?: IEmbeddedLanguagesMap): IGrammar;
|
||||
addGrammar(rawGrammar: IRawGrammar, injections?: string[], initialLanguage?: number, embeddedLanguages?: IEmbeddedLanguagesMap): Thenable<IGrammar>;
|
||||
/**
|
||||
* Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `loadGrammarFromPathSync`.
|
||||
* Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`.
|
||||
*/
|
||||
grammarForScopeName(scopeName: string, initialLanguage?: number, embeddedLanguages?: IEmbeddedLanguagesMap, tokenTypes?: ITokenTypeMap): IGrammar;
|
||||
grammarForScopeName(scopeName: string, initialLanguage?: number, embeddedLanguages?: IEmbeddedLanguagesMap, tokenTypes?: ITokenTypeMap): Thenable<IGrammar>;
|
||||
}
|
||||
/**
|
||||
* A grammar
|
||||
@@ -179,4 +182,75 @@ declare module "vscode-textmate" {
|
||||
equals(other: StackElement): boolean;
|
||||
}
|
||||
export const INITIAL: StackElement;
|
||||
export const parseRawGrammar: (content: string, filePath: string) => IRawGrammar;
|
||||
export interface ILocation {
|
||||
readonly filename: string;
|
||||
readonly line: number;
|
||||
readonly char: number;
|
||||
}
|
||||
export interface ILocatable {
|
||||
readonly $vscodeTextmateLocation?: ILocation;
|
||||
}
|
||||
export interface IRawGrammar extends ILocatable {
|
||||
repository: IRawRepository;
|
||||
readonly scopeName: string;
|
||||
readonly patterns: IRawRule[];
|
||||
readonly injections?: {
|
||||
[expression: string]: IRawRule;
|
||||
};
|
||||
readonly injectionSelector?: string;
|
||||
readonly fileTypes?: string[];
|
||||
readonly name?: string;
|
||||
readonly firstLineMatch?: string;
|
||||
}
|
||||
export interface IRawRepositoryMap {
|
||||
[name: string]: IRawRule;
|
||||
$self: IRawRule;
|
||||
$base: IRawRule;
|
||||
}
|
||||
export type IRawRepository = IRawRepositoryMap & ILocatable;
|
||||
export interface IRawRule extends ILocatable {
|
||||
id?: number;
|
||||
readonly include?: string;
|
||||
readonly name?: string;
|
||||
readonly contentName?: string;
|
||||
readonly match?: string;
|
||||
readonly captures?: IRawCaptures;
|
||||
readonly begin?: string;
|
||||
readonly beginCaptures?: IRawCaptures;
|
||||
readonly end?: string;
|
||||
readonly endCaptures?: IRawCaptures;
|
||||
readonly while?: string;
|
||||
readonly whileCaptures?: IRawCaptures;
|
||||
readonly patterns?: IRawRule[];
|
||||
readonly repository?: IRawRepository;
|
||||
readonly applyEndPatternLast?: boolean;
|
||||
}
|
||||
export interface IRawCapturesMap {
|
||||
[captureId: string]: IRawRule;
|
||||
}
|
||||
export type IRawCaptures = IRawCapturesMap & ILocatable;
|
||||
export interface IOnigLib {
|
||||
createOnigScanner(sources: string[]): OnigScanner;
|
||||
createOnigString(sources: string): OnigString;
|
||||
}
|
||||
export interface IOnigCaptureIndex {
|
||||
start: number;
|
||||
end: number;
|
||||
length: number;
|
||||
}
|
||||
export interface IOnigMatch {
|
||||
index: number;
|
||||
captureIndices: IOnigCaptureIndex[];
|
||||
scanner: OnigScanner;
|
||||
}
|
||||
export interface OnigScanner {
|
||||
findNextMatchSync(string: string | OnigString, startPosition: number): IOnigMatch;
|
||||
}
|
||||
export interface OnigString {
|
||||
readonly content: string;
|
||||
readonly dispose?: () => void;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Vendored
+86
-7
@@ -13,6 +13,11 @@ declare module 'vscode-xterm' {
|
||||
*/
|
||||
export type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
||||
|
||||
/**
|
||||
* A string representing a renderer type.
|
||||
*/
|
||||
export type RendererType = 'dom' | 'canvas';
|
||||
|
||||
/**
|
||||
* An object containing start up options for the terminal.
|
||||
*/
|
||||
@@ -54,6 +59,11 @@ declare module 'vscode-xterm' {
|
||||
*/
|
||||
disableStdin?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to draw bold text in bright colors. The default is true.
|
||||
*/
|
||||
drawBoldTextInBrightColors?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to enable the rendering of bold text.
|
||||
*
|
||||
@@ -61,6 +71,24 @@ declare module 'vscode-xterm' {
|
||||
*/
|
||||
enableBold?: boolean;
|
||||
|
||||
/**
|
||||
* What character atlas implementation to use. The character atlas caches drawn characters,
|
||||
* speeding up rendering significantly. However, it can introduce some minor rendering
|
||||
* artifacts.
|
||||
*
|
||||
* - 'none': Don't use an atlas.
|
||||
* - 'static': Generate an atlas when the terminal starts or is reconfigured. This atlas will
|
||||
* only contain ASCII characters in 16 colors.
|
||||
* - 'dynamic': Generate an atlas using a LRU cache as characters are requested. Limited to
|
||||
* ASCII characters (for now), but supports 256 colors. For characters covered by the static
|
||||
* cache, it's slightly slower in comparison, since there's more overhead involved in
|
||||
* managing the cache.
|
||||
*
|
||||
* Currently defaults to 'static'. This option may be removed in the future. If it is, passed
|
||||
* parameters will be ignored.
|
||||
*/
|
||||
experimentalCharAtlas?: 'none' | 'static' | 'dynamic';
|
||||
|
||||
/**
|
||||
* The font size used to render text.
|
||||
*/
|
||||
@@ -96,6 +124,32 @@ declare module 'vscode-xterm' {
|
||||
*/
|
||||
macOptionIsMeta?: boolean;
|
||||
|
||||
/**
|
||||
* Whether holding a modifier key will force normal selection behavior,
|
||||
* regardless of whether the terminal is in mouse events mode. This will
|
||||
* also prevent mouse events from being emitted by the terminal. For example,
|
||||
* this allows you to use xterm.js' regular selection inside tmux with
|
||||
* mouse mode enabled.
|
||||
*/
|
||||
macOptionClickForcesSelection?: boolean;
|
||||
|
||||
/**
|
||||
* (EXPERIMENTAL) The type of renderer to use, this allows using the
|
||||
* fallback DOM renderer when canvas is too slow for the environment. The
|
||||
* following features do not work when the DOM renderer is used:
|
||||
*
|
||||
* - Links
|
||||
* - Line height
|
||||
* - Letter spacing
|
||||
* - Cursor blink
|
||||
* - Cursor style
|
||||
*
|
||||
* This option is marked as experiemental because it will eventually be
|
||||
* moved to an addon. You can only set this option in the constructor (not
|
||||
* setOption).
|
||||
*/
|
||||
rendererType?: RendererType;
|
||||
|
||||
/**
|
||||
* Whether to select the word under the cursor on right click, this is
|
||||
* standard behavior in a lot of macOS applications.
|
||||
@@ -251,7 +305,7 @@ declare module 'vscode-xterm' {
|
||||
/**
|
||||
* The class that represents an xterm.js terminal.
|
||||
*/
|
||||
export class Terminal implements IEventEmitter {
|
||||
export class Terminal implements IEventEmitter, IDisposable {
|
||||
/**
|
||||
* The element containing the terminal.
|
||||
*/
|
||||
@@ -451,8 +505,16 @@ declare module 'vscode-xterm' {
|
||||
*/
|
||||
selectLines(start: number, end: number): void;
|
||||
|
||||
/*
|
||||
* Disposes of the terminal, detaching it from the DOM and removing any
|
||||
* active listeners.
|
||||
*/
|
||||
dispose(): void;
|
||||
|
||||
/**
|
||||
* Destroys the terminal and detaches it from the DOM.
|
||||
*
|
||||
* @deprecated Use dispose() instead.
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
@@ -499,7 +561,7 @@ declare module 'vscode-xterm' {
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
*/
|
||||
getOption(key: 'bellSound' | 'bellStyle' | 'cursorStyle' | 'fontFamily' | 'fontWeight' | 'fontWeightBold' | 'termName'): string;
|
||||
getOption(key: 'bellSound' | 'bellStyle' | 'cursorStyle' | 'fontFamily' | 'fontWeight' | 'fontWeightBold' | 'rendererType' | 'termName'): string;
|
||||
/**
|
||||
* Retrieves an option's value from the terminal.
|
||||
* @param key The option key.
|
||||
@@ -617,19 +679,40 @@ declare module 'vscode-xterm' {
|
||||
|
||||
// Modifications to official .d.ts below
|
||||
declare module 'vscode-xterm' {
|
||||
interface Terminal {
|
||||
interface TerminalCore {
|
||||
debug: boolean;
|
||||
|
||||
buffer: {
|
||||
y: number;
|
||||
ybase: number;
|
||||
ydisp: number;
|
||||
x: number;
|
||||
lines: any[];
|
||||
|
||||
translateBufferLineToString(lineIndex: number, trimRight: boolean): string;
|
||||
};
|
||||
|
||||
send(text: string): void;
|
||||
|
||||
/**
|
||||
* Emit an event on the terminal.
|
||||
*/
|
||||
emit(type: string, data: any): void;
|
||||
|
||||
charMeasure?: { height: number, width: number };
|
||||
|
||||
renderer: {
|
||||
_renderLayers: any[];
|
||||
onIntersectionChange: any;
|
||||
};
|
||||
}
|
||||
|
||||
interface Terminal {
|
||||
_core: TerminalCore;
|
||||
|
||||
webLinksInit(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions): void;
|
||||
winptyCompatInit(): void;
|
||||
|
||||
/**
|
||||
* Find the next instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
@@ -645,9 +728,5 @@ declare module 'vscode-xterm' {
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
findPrevious(term: string): boolean;
|
||||
|
||||
webLinksInit(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions): void;
|
||||
winptyCompatInit(): void;
|
||||
charMeasure?: { height: number, width: number };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,8 +157,19 @@ export const isSafari = (userAgent.indexOf('Chrome') === -1) && (userAgent.index
|
||||
export const isIPad = (userAgent.indexOf('iPad') >= 0);
|
||||
export const isEdgeWebView = isEdge && (userAgent.indexOf('WebView/') >= 0);
|
||||
|
||||
export const isChromev56 = (
|
||||
userAgent.indexOf('Chrome/56.') >= 0
|
||||
// Edge likes to impersonate Chrome sometimes
|
||||
&& userAgent.indexOf('Edge/') === -1
|
||||
);
|
||||
export function hasClipboardSupport() {
|
||||
if (isIE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isEdge) {
|
||||
let index = userAgent.indexOf('Edge/');
|
||||
let version = parseInt(userAgent.substring(index + 5, userAgent.indexOf('.', index)), 10);
|
||||
|
||||
if (!version || (version >= 12 && version <= 16)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
+136
-137
@@ -5,9 +5,8 @@
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./builder';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as assert from 'vs/base/common/assert';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
@@ -70,8 +69,8 @@ export class Builder implements IDisposable {
|
||||
private offdom: boolean;
|
||||
private container: HTMLElement;
|
||||
private createdElements: HTMLElement[];
|
||||
private toUnbind: { [type: string]: IDisposable[]; };
|
||||
private captureToUnbind: { [type: string]: IDisposable[]; };
|
||||
private toDispose: { [type: string]: IDisposable[]; };
|
||||
private captureToDispose: { [type: string]: IDisposable[]; };
|
||||
|
||||
constructor(element?: HTMLElement, offdom?: boolean) {
|
||||
this.offdom = offdom;
|
||||
@@ -81,27 +80,27 @@ export class Builder implements IDisposable {
|
||||
this.currentElement = element;
|
||||
this.createdElements = [];
|
||||
|
||||
this.toUnbind = {};
|
||||
this.captureToUnbind = {};
|
||||
this.toDispose = {};
|
||||
this.captureToDispose = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new builder that lets the current HTML Element of this builder be the container
|
||||
* for future additions on the builder.
|
||||
*/
|
||||
public asContainer(): Builder {
|
||||
asContainer(): Builder {
|
||||
return withBuilder(this, this.offdom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones the builder providing the same properties as this one.
|
||||
*/
|
||||
public clone(): Builder {
|
||||
clone(): Builder {
|
||||
let builder = new Builder(this.container, this.offdom);
|
||||
builder.currentElement = this.currentElement;
|
||||
builder.createdElements = this.createdElements;
|
||||
builder.captureToUnbind = this.captureToUnbind;
|
||||
builder.toUnbind = this.toUnbind;
|
||||
builder.captureToDispose = this.captureToDispose;
|
||||
builder.toDispose = this.toDispose;
|
||||
|
||||
return builder;
|
||||
}
|
||||
@@ -113,9 +112,9 @@ export class Builder implements IDisposable {
|
||||
* at the end.
|
||||
* This method is a no-op unless the builder was created with the offdom option to be true.
|
||||
*/
|
||||
public build(container?: Builder, index?: number): Builder;
|
||||
public build(container?: HTMLElement, index?: number): Builder;
|
||||
public build(container?: any, index?: number): Builder {
|
||||
build(container?: Builder, index?: number): Builder;
|
||||
build(container?: HTMLElement, index?: number): Builder;
|
||||
build(container?: any, index?: number): Builder {
|
||||
assert.ok(this.offdom, 'This builder was not created off-dom, so build() can not be called.');
|
||||
|
||||
// Use builders own container if present
|
||||
@@ -154,9 +153,9 @@ export class Builder implements IDisposable {
|
||||
* attached the current element. If the current element has a parent, it will be
|
||||
* detached from that parent.
|
||||
*/
|
||||
public appendTo(container?: Builder, index?: number): Builder;
|
||||
public appendTo(container?: HTMLElement, index?: number): Builder;
|
||||
public appendTo(container?: any, index?: number): Builder {
|
||||
appendTo(container?: Builder, index?: number): Builder;
|
||||
appendTo(container?: HTMLElement, index?: number): Builder;
|
||||
appendTo(container?: any, index?: number): Builder {
|
||||
|
||||
// Use builders own container if present
|
||||
if (!container) {
|
||||
@@ -194,9 +193,9 @@ export class Builder implements IDisposable {
|
||||
* of the return value being the builder which called the operation (`a` in the
|
||||
* first case; `b` in the second case).
|
||||
*/
|
||||
public append(child: HTMLElement, index?: number): Builder;
|
||||
public append(child: Builder, index?: number): Builder;
|
||||
public append(child: any, index?: number): Builder {
|
||||
append(child: HTMLElement, index?: number): Builder;
|
||||
append(child: Builder, index?: number): Builder;
|
||||
append(child: any, index?: number): Builder {
|
||||
assert.ok(child, 'Need a child to append');
|
||||
|
||||
if (DOM.isHTMLElement(child)) {
|
||||
@@ -213,7 +212,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Removes the current element of this builder from its parent node.
|
||||
*/
|
||||
public offDOM(): Builder {
|
||||
offDOM(): Builder {
|
||||
if (this.currentElement.parentNode) {
|
||||
this.currentElement.parentNode.removeChild(this.currentElement);
|
||||
}
|
||||
@@ -224,14 +223,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Returns the HTML Element the builder is currently active on.
|
||||
*/
|
||||
public getHTMLElement(): HTMLElement {
|
||||
getHTMLElement(): HTMLElement {
|
||||
return this.currentElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTML Element the builder is building in.
|
||||
*/
|
||||
public getContainer(): HTMLElement {
|
||||
getContainer(): HTMLElement {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
@@ -245,7 +244,7 @@ export class Builder implements IDisposable {
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public div(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
div(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('div', attributes, fn);
|
||||
}
|
||||
|
||||
@@ -257,7 +256,7 @@ export class Builder implements IDisposable {
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public p(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
p(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('p', attributes, fn);
|
||||
}
|
||||
|
||||
@@ -269,7 +268,7 @@ export class Builder implements IDisposable {
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public ul(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
ul(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('ul', attributes, fn);
|
||||
}
|
||||
|
||||
@@ -281,7 +280,7 @@ export class Builder implements IDisposable {
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public li(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
li(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('li', attributes, fn);
|
||||
}
|
||||
|
||||
@@ -293,7 +292,7 @@ export class Builder implements IDisposable {
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public span(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
span(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('span', attributes, fn);
|
||||
}
|
||||
|
||||
@@ -305,7 +304,7 @@ export class Builder implements IDisposable {
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public img(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
img(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('img', attributes, fn);
|
||||
}
|
||||
|
||||
@@ -317,7 +316,7 @@ export class Builder implements IDisposable {
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public a(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
a(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('a', attributes, fn);
|
||||
}
|
||||
|
||||
@@ -329,7 +328,7 @@ export class Builder implements IDisposable {
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public element(name: string, attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
element(name: string, attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement(name, attributes, fn);
|
||||
}
|
||||
|
||||
@@ -371,7 +370,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Calls focus() on the current HTML element;
|
||||
*/
|
||||
public domFocus(): Builder {
|
||||
domFocus(): Builder {
|
||||
this.currentElement.focus();
|
||||
|
||||
return this;
|
||||
@@ -380,7 +379,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Calls blur() on the current HTML element;
|
||||
*/
|
||||
public domBlur(): Builder {
|
||||
domBlur(): Builder {
|
||||
this.currentElement.blur();
|
||||
|
||||
return this;
|
||||
@@ -389,14 +388,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Registers listener on event types on the current element.
|
||||
*/
|
||||
public on<E extends Event = Event>(type: string, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public on<E extends Event = Event>(typeArray: string[], fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public on<E extends Event = Event>(arg1: any, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
on<E extends Event = Event>(type: string, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToDisposeContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
on<E extends Event = Event>(typeArray: string[], fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToDisposeContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
on<E extends Event = Event>(arg1: any, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToDisposeContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
|
||||
// Event Type Array
|
||||
if (types.isArray(arg1)) {
|
||||
arg1.forEach((type: string) => {
|
||||
this.on(type, fn, listenerToUnbindContainer, useCapture);
|
||||
this.on(type, fn, listenerToDisposeContainer, useCapture);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -411,15 +410,15 @@ export class Builder implements IDisposable {
|
||||
|
||||
// Remember for off() use
|
||||
if (useCapture) {
|
||||
if (!this.captureToUnbind[type]) {
|
||||
this.captureToUnbind[type] = [];
|
||||
if (!this.captureToDispose[type]) {
|
||||
this.captureToDispose[type] = [];
|
||||
}
|
||||
this.captureToUnbind[type].push(unbind);
|
||||
this.captureToDispose[type].push(unbind);
|
||||
} else {
|
||||
if (!this.toUnbind[type]) {
|
||||
this.toUnbind[type] = [];
|
||||
if (!this.toDispose[type]) {
|
||||
this.toDispose[type] = [];
|
||||
}
|
||||
this.toUnbind[type].push(unbind);
|
||||
this.toDispose[type].push(unbind);
|
||||
}
|
||||
|
||||
// Bind to Element
|
||||
@@ -428,8 +427,8 @@ export class Builder implements IDisposable {
|
||||
this.setProperty(LISTENER_BINDING_ID, listenerBinding);
|
||||
|
||||
// Add to Array if passed in
|
||||
if (listenerToUnbindContainer && types.isArray(listenerToUnbindContainer)) {
|
||||
listenerToUnbindContainer.push(unbind);
|
||||
if (listenerToDisposeContainer && types.isArray(listenerToDisposeContainer)) {
|
||||
listenerToDisposeContainer.push(unbind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,9 +438,9 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Removes all listeners from all elements created by the builder for the given event type.
|
||||
*/
|
||||
public off(type: string, useCapture?: boolean): Builder;
|
||||
public off(typeArray: string[], useCapture?: boolean): Builder;
|
||||
public off(arg1: any, useCapture?: boolean): Builder {
|
||||
off(type: string, useCapture?: boolean): Builder;
|
||||
off(typeArray: string[], useCapture?: boolean): Builder;
|
||||
off(arg1: any, useCapture?: boolean): Builder {
|
||||
|
||||
// Event Type Array
|
||||
if (types.isArray(arg1)) {
|
||||
@@ -454,12 +453,12 @@ export class Builder implements IDisposable {
|
||||
else {
|
||||
let type = arg1;
|
||||
if (useCapture) {
|
||||
if (this.captureToUnbind[type]) {
|
||||
this.captureToUnbind[type] = dispose(this.captureToUnbind[type]);
|
||||
if (this.captureToDispose[type]) {
|
||||
this.captureToDispose[type] = dispose(this.captureToDispose[type]);
|
||||
}
|
||||
} else {
|
||||
if (this.toUnbind[type]) {
|
||||
this.toUnbind[type] = dispose(this.toUnbind[type]);
|
||||
if (this.toDispose[type]) {
|
||||
this.toDispose[type] = dispose(this.toDispose[type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,9 +480,9 @@ export class Builder implements IDisposable {
|
||||
* Registers listener on event types on the current element and removes
|
||||
* them after first invocation.
|
||||
*/
|
||||
public once<E extends Event = Event>(type: string, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public once<E extends Event = Event>(typesArray: string[], fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public once<E extends Event = Event>(arg1: any, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
once<E extends Event = Event>(type: string, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToDisposeContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
once<E extends Event = Event>(typesArray: string[], fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToDisposeContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
once<E extends Event = Event>(arg1: any, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToDisposeContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
|
||||
// Event Type Array
|
||||
if (types.isArray(arg1)) {
|
||||
@@ -503,8 +502,8 @@ export class Builder implements IDisposable {
|
||||
}, useCapture || false);
|
||||
|
||||
// Add to Array if passed in
|
||||
if (listenerToUnbindContainer && types.isArray(listenerToUnbindContainer)) {
|
||||
listenerToUnbindContainer.push(unbind);
|
||||
if (listenerToDisposeContainer && types.isArray(listenerToDisposeContainer)) {
|
||||
listenerToDisposeContainer.push(unbind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,12 +519,12 @@ export class Builder implements IDisposable {
|
||||
* c) an object literal passed in will apply the properties of the literal as attributes
|
||||
* to the current element of the builder.
|
||||
*/
|
||||
public attr(name: string): string;
|
||||
public attr(name: string, value: string): Builder;
|
||||
public attr(name: string, value: boolean): Builder;
|
||||
public attr(name: string, value: number): Builder;
|
||||
public attr(attributes: any): Builder;
|
||||
public attr(firstP: any, secondP?: any): any {
|
||||
attr(name: string): string;
|
||||
attr(name: string, value: string): Builder;
|
||||
attr(name: string, value: boolean): Builder;
|
||||
attr(name: string, value: number): Builder;
|
||||
attr(attributes: any): Builder;
|
||||
attr(firstP: any, secondP?: any): any {
|
||||
|
||||
// Apply Object Literal to Attributes of Element
|
||||
if (types.isObject(firstP)) {
|
||||
@@ -574,14 +573,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Removes an attribute by the given name.
|
||||
*/
|
||||
public removeAttribute(prop: string): void {
|
||||
removeAttribute(prop: string): void {
|
||||
this.currentElement.removeAttribute(prop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the id attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public id(id: string): Builder {
|
||||
id(id: string): Builder {
|
||||
this.currentElement.setAttribute('id', id);
|
||||
|
||||
return this;
|
||||
@@ -590,7 +589,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the title attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public title(title: string): Builder {
|
||||
title(title: string): Builder {
|
||||
this.currentElement.setAttribute('title', title);
|
||||
|
||||
return this;
|
||||
@@ -599,7 +598,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the type attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public type(type: string): Builder {
|
||||
type(type: string): Builder {
|
||||
this.currentElement.setAttribute('type', type);
|
||||
|
||||
return this;
|
||||
@@ -608,7 +607,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the value attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public value(value: string): Builder {
|
||||
value(value: string): Builder {
|
||||
this.currentElement.setAttribute('value', value);
|
||||
|
||||
return this;
|
||||
@@ -617,7 +616,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the tabindex attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public tabindex(index: number): Builder {
|
||||
tabindex(index: number): Builder {
|
||||
this.currentElement.setAttribute('tabindex', index.toString());
|
||||
|
||||
return this;
|
||||
@@ -633,10 +632,10 @@ export class Builder implements IDisposable {
|
||||
* c) an object literal passed in will apply the properties of the literal as styles
|
||||
* to the current element of the builder.
|
||||
*/
|
||||
public style(name: string): string;
|
||||
public style(name: string, value: string): Builder;
|
||||
public style(attributes: any): Builder;
|
||||
public style(firstP: any, secondP?: any): any {
|
||||
style(name: string): string;
|
||||
style(name: string, value: string): Builder;
|
||||
style(attributes: any): Builder;
|
||||
style(firstP: any, secondP?: any): any {
|
||||
|
||||
// Apply Object Literal to Styles of Element
|
||||
if (types.isObject(firstP)) {
|
||||
@@ -702,14 +701,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Returns the computed CSS style for the current HTML element of the builder.
|
||||
*/
|
||||
public getComputedStyle(): CSSStyleDeclaration {
|
||||
getComputedStyle(): CSSStyleDeclaration {
|
||||
return DOM.getComputedStyle(this.currentElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the variable list of arguments as class names to the current HTML element of the builder.
|
||||
*/
|
||||
public addClass(...classes: string[]): Builder {
|
||||
addClass(...classes: string[]): Builder {
|
||||
classes.forEach((nameValue: string) => {
|
||||
let names = nameValue.split(' ');
|
||||
names.forEach((name: string) => {
|
||||
@@ -724,7 +723,7 @@ export class Builder implements IDisposable {
|
||||
* Sets the class name of the current HTML element of the builder to the provided className.
|
||||
* If shouldAddClass is provided - for true class is added, for false class is removed.
|
||||
*/
|
||||
public setClass(className: string, shouldAddClass: boolean = null): Builder {
|
||||
setClass(className: string, shouldAddClass: boolean = null): Builder {
|
||||
if (shouldAddClass === null) {
|
||||
this.currentElement.className = className;
|
||||
} else if (shouldAddClass) {
|
||||
@@ -739,14 +738,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Returns whether the current HTML element of the builder has the provided class assigned.
|
||||
*/
|
||||
public hasClass(className: string): boolean {
|
||||
hasClass(className: string): boolean {
|
||||
return DOM.hasClass(this.currentElement, className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the variable list of arguments as class names from the current HTML element of the builder.
|
||||
*/
|
||||
public removeClass(...classes: string[]): Builder {
|
||||
removeClass(...classes: string[]): Builder {
|
||||
classes.forEach((nameValue: string) => {
|
||||
let names = nameValue.split(' ');
|
||||
names.forEach((name: string) => {
|
||||
@@ -760,7 +759,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Adds or removes the provided className for the current HTML element of the builder.
|
||||
*/
|
||||
public toggleClass(className: string): Builder {
|
||||
toggleClass(className: string): Builder {
|
||||
if (this.hasClass(className)) {
|
||||
this.removeClass(className);
|
||||
} else {
|
||||
@@ -773,7 +772,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the CSS property color.
|
||||
*/
|
||||
public color(color: string): Builder {
|
||||
color(color: string): Builder {
|
||||
this.currentElement.style.color = color;
|
||||
|
||||
return this;
|
||||
@@ -782,10 +781,10 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the CSS property padding.
|
||||
*/
|
||||
public padding(padding: string): Builder;
|
||||
public padding(top: number, right?: number, bottom?: number, left?: number): Builder;
|
||||
public padding(top: string, right?: string, bottom?: string, left?: string): Builder;
|
||||
public padding(top: any, right?: any, bottom?: any, left?: any): Builder {
|
||||
padding(padding: string): Builder;
|
||||
padding(top: number, right?: number, bottom?: number, left?: number): Builder;
|
||||
padding(top: string, right?: string, bottom?: string, left?: string): Builder;
|
||||
padding(top: any, right?: any, bottom?: any, left?: any): Builder {
|
||||
if (types.isString(top) && top.indexOf(' ') >= 0) {
|
||||
return this.padding.apply(this, top.split(' '));
|
||||
}
|
||||
@@ -812,10 +811,10 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the CSS property margin.
|
||||
*/
|
||||
public margin(margin: string): Builder;
|
||||
public margin(top: number, right?: number, bottom?: number, left?: number): Builder;
|
||||
public margin(top: string, right?: string, bottom?: string, left?: string): Builder;
|
||||
public margin(top: any, right?: any, bottom?: any, left?: any): Builder {
|
||||
margin(margin: string): Builder;
|
||||
margin(top: number, right?: number, bottom?: number, left?: number): Builder;
|
||||
margin(top: string, right?: string, bottom?: string, left?: string): Builder;
|
||||
margin(top: any, right?: any, bottom?: any, left?: any): Builder {
|
||||
if (types.isString(top) && top.indexOf(' ') >= 0) {
|
||||
return this.margin.apply(this, top.split(' '));
|
||||
}
|
||||
@@ -842,10 +841,10 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the CSS property position.
|
||||
*/
|
||||
public position(position: string): Builder;
|
||||
public position(top: number, right?: number, bottom?: number, left?: number, position?: string): Builder;
|
||||
public position(top: string, right?: string, bottom?: string, left?: string, position?: string): Builder;
|
||||
public position(top: any, right?: any, bottom?: any, left?: any, position?: string): Builder {
|
||||
position(position: string): Builder;
|
||||
position(top: number, right?: number, bottom?: number, left?: number, position?: string): Builder;
|
||||
position(top: string, right?: string, bottom?: string, left?: string, position?: string): Builder;
|
||||
position(top: any, right?: any, bottom?: any, left?: any, position?: string): Builder {
|
||||
if (types.isString(top) && top.indexOf(' ') >= 0) {
|
||||
return this.position.apply(this, top.split(' '));
|
||||
}
|
||||
@@ -878,10 +877,10 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the CSS property size.
|
||||
*/
|
||||
public size(size: string): Builder;
|
||||
public size(width: number, height?: number): Builder;
|
||||
public size(width: string, height?: string): Builder;
|
||||
public size(width: any, height?: any): Builder {
|
||||
size(size: string): Builder;
|
||||
size(width: number, height?: number): Builder;
|
||||
size(width: string, height?: string): Builder;
|
||||
size(width: any, height?: any): Builder {
|
||||
if (types.isString(width) && width.indexOf(' ') >= 0) {
|
||||
return this.size.apply(this, width.split(' '));
|
||||
}
|
||||
@@ -900,7 +899,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the CSS property display.
|
||||
*/
|
||||
public display(display: string): Builder {
|
||||
display(display: string): Builder {
|
||||
this.currentElement.style.display = display;
|
||||
|
||||
return this;
|
||||
@@ -909,7 +908,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Shows the current element of the builder.
|
||||
*/
|
||||
public show(): Builder {
|
||||
show(): Builder {
|
||||
if (this.hasClass('monaco-builder-hidden')) {
|
||||
this.removeClass('monaco-builder-hidden');
|
||||
}
|
||||
@@ -917,7 +916,7 @@ export class Builder implements IDisposable {
|
||||
this.attr('aria-hidden', 'false');
|
||||
|
||||
// Cancel any pending showDelayed() invocation
|
||||
this.cancelVisibilityPromise();
|
||||
this.cancelVisibilityTimeout();
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -929,18 +928,18 @@ export class Builder implements IDisposable {
|
||||
* only show the element when a specific delay is reached (e.g. for a long running
|
||||
* operation.
|
||||
*/
|
||||
public showDelayed(delay: number): Builder {
|
||||
showDelayed(delay: number): Builder {
|
||||
|
||||
// Cancel any pending showDelayed() invocation
|
||||
this.cancelVisibilityPromise();
|
||||
this.cancelVisibilityTimeout();
|
||||
|
||||
let promise = TPromise.timeout(delay);
|
||||
this.setProperty(VISIBILITY_BINDING_ID, promise);
|
||||
|
||||
promise.done(() => {
|
||||
// Install new delay for showing
|
||||
const handle = setTimeout(() => {
|
||||
this.removeProperty(VISIBILITY_BINDING_ID);
|
||||
this.show();
|
||||
});
|
||||
}, delay);
|
||||
|
||||
this.setProperty(VISIBILITY_BINDING_ID, toDisposable(() => clearTimeout(handle)));
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -948,14 +947,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Hides the current element of the builder.
|
||||
*/
|
||||
public hide(): Builder {
|
||||
hide(): Builder {
|
||||
if (!this.hasClass('monaco-builder-hidden')) {
|
||||
this.addClass('monaco-builder-hidden');
|
||||
}
|
||||
this.attr('aria-hidden', 'true');
|
||||
|
||||
// Cancel any pending showDelayed() invocation
|
||||
this.cancelVisibilityPromise();
|
||||
this.cancelVisibilityTimeout();
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -963,14 +962,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Returns true if the current element of the builder is hidden.
|
||||
*/
|
||||
public isHidden(): boolean {
|
||||
isHidden(): boolean {
|
||||
return this.hasClass('monaco-builder-hidden') || this.currentElement.style.display === 'none';
|
||||
}
|
||||
|
||||
private cancelVisibilityPromise(): void {
|
||||
let promise: TPromise<void> = this.getProperty(VISIBILITY_BINDING_ID);
|
||||
if (promise) {
|
||||
promise.cancel();
|
||||
private cancelVisibilityTimeout(): void {
|
||||
const visibilityDisposable = this.getProperty(VISIBILITY_BINDING_ID) as IDisposable;
|
||||
if (visibilityDisposable) {
|
||||
visibilityDisposable.dispose();
|
||||
this.removeProperty(VISIBILITY_BINDING_ID);
|
||||
}
|
||||
}
|
||||
@@ -986,7 +985,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the innerHTML attribute.
|
||||
*/
|
||||
public innerHtml(html: string, append?: boolean): Builder {
|
||||
innerHtml(html: string, append?: boolean): Builder {
|
||||
if (append) {
|
||||
this.currentElement.innerHTML += html;
|
||||
} else {
|
||||
@@ -1000,7 +999,7 @@ export class Builder implements IDisposable {
|
||||
* Sets the textContent property of the element.
|
||||
* All HTML special characters will be escaped.
|
||||
*/
|
||||
public text(text: string, append?: boolean): Builder {
|
||||
text(text: string, append?: boolean): Builder {
|
||||
if (append) {
|
||||
// children is child Elements versus childNodes includes textNodes
|
||||
if (this.currentElement.children.length === 0) {
|
||||
@@ -1021,14 +1020,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Sets the innerHTML attribute in escaped form.
|
||||
*/
|
||||
public safeInnerHtml(html: string, append?: boolean): Builder {
|
||||
safeInnerHtml(html: string, append?: boolean): Builder {
|
||||
return this.innerHtml(strings.escape(html), append);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to store arbritary data into the current element.
|
||||
*/
|
||||
public setProperty(key: string, value: any): Builder {
|
||||
setProperty(key: string, value: any): Builder {
|
||||
setPropertyOnElement(this.currentElement, key, value);
|
||||
|
||||
return this;
|
||||
@@ -1037,14 +1036,14 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Allows to get arbritary data from the current element.
|
||||
*/
|
||||
public getProperty(key: string, fallback?: any): any {
|
||||
getProperty(key: string, fallback?: any): any {
|
||||
return getPropertyFromElement(this.currentElement, key, fallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a property from the current element that is stored under the given key.
|
||||
*/
|
||||
public removeProperty(key: string): Builder {
|
||||
removeProperty(key: string): Builder {
|
||||
if (hasData(this.currentElement)) {
|
||||
delete data(this.currentElement)[key];
|
||||
}
|
||||
@@ -1055,7 +1054,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Returns a new builder with the child at the given index.
|
||||
*/
|
||||
public child(index = 0): Builder {
|
||||
child(index = 0): Builder {
|
||||
let children = this.currentElement.children;
|
||||
|
||||
return withElement(<HTMLElement>children.item(index));
|
||||
@@ -1095,7 +1094,7 @@ export class Builder implements IDisposable {
|
||||
* event listners registered and also clear any data binding and properties stored
|
||||
* to any child element.
|
||||
*/
|
||||
public empty(): Builder {
|
||||
empty(): Builder {
|
||||
this.unbindDescendants(this.currentElement);
|
||||
|
||||
this.clearChildren();
|
||||
@@ -1110,7 +1109,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Removes all HTML elements from the current element of the builder.
|
||||
*/
|
||||
public clearChildren(): Builder {
|
||||
clearChildren(): Builder {
|
||||
|
||||
// Remove Elements
|
||||
if (this.currentElement) {
|
||||
@@ -1124,7 +1123,7 @@ export class Builder implements IDisposable {
|
||||
* Removes the current HTML element and all its children from its parent and unbinds
|
||||
* all listeners and properties set to the data slots.
|
||||
*/
|
||||
public destroy(): void {
|
||||
destroy(): void {
|
||||
|
||||
if (this.currentElement) {
|
||||
|
||||
@@ -1154,15 +1153,15 @@ export class Builder implements IDisposable {
|
||||
|
||||
let type: string;
|
||||
|
||||
for (type in this.toUnbind) {
|
||||
if (this.toUnbind.hasOwnProperty(type) && types.isArray(this.toUnbind[type])) {
|
||||
this.toUnbind[type] = dispose(this.toUnbind[type]);
|
||||
for (type in this.toDispose) {
|
||||
if (this.toDispose.hasOwnProperty(type) && types.isArray(this.toDispose[type])) {
|
||||
this.toDispose[type] = dispose(this.toDispose[type]);
|
||||
}
|
||||
}
|
||||
|
||||
for (type in this.captureToUnbind) {
|
||||
if (this.captureToUnbind.hasOwnProperty(type) && types.isArray(this.captureToUnbind[type])) {
|
||||
this.captureToUnbind[type] = dispose(this.captureToUnbind[type]);
|
||||
for (type in this.captureToDispose) {
|
||||
if (this.captureToDispose.hasOwnProperty(type) && types.isArray(this.captureToDispose[type])) {
|
||||
this.captureToDispose[type] = dispose(this.captureToDispose[type]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1171,22 +1170,22 @@ export class Builder implements IDisposable {
|
||||
this.container = null;
|
||||
this.offdom = null;
|
||||
this.createdElements = null;
|
||||
this.captureToUnbind = null;
|
||||
this.toUnbind = null;
|
||||
this.captureToDispose = null;
|
||||
this.toDispose = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the current HTML element and all its children from its parent and unbinds
|
||||
* all listeners and properties set to the data slots.
|
||||
*/
|
||||
public dispose(): void {
|
||||
dispose(): void {
|
||||
this.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size (in pixels) of an element, including the margin.
|
||||
*/
|
||||
public getTotalSize(): DOM.Dimension {
|
||||
getTotalSize(): DOM.Dimension {
|
||||
let totalWidth = DOM.getTotalWidth(this.currentElement);
|
||||
let totalHeight = DOM.getTotalHeight(this.currentElement);
|
||||
|
||||
@@ -1196,7 +1195,7 @@ export class Builder implements IDisposable {
|
||||
/**
|
||||
* Another variant of getting the inner dimensions of an element.
|
||||
*/
|
||||
public getClientArea(): DOM.Dimension {
|
||||
getClientArea(): DOM.Dimension {
|
||||
return DOM.getClientArea(this.currentElement);
|
||||
}
|
||||
}
|
||||
@@ -1207,7 +1206,7 @@ export class Builder implements IDisposable {
|
||||
*/
|
||||
export class MultiBuilder extends Builder {
|
||||
|
||||
public length: number;
|
||||
length: number;
|
||||
|
||||
private builders: Builder[];
|
||||
|
||||
@@ -1288,11 +1287,11 @@ export class MultiBuilder extends Builder {
|
||||
}
|
||||
}
|
||||
|
||||
public item(i: number): Builder {
|
||||
item(i: number): Builder {
|
||||
return this.builders[i];
|
||||
}
|
||||
|
||||
public push(...items: Builder[]): void {
|
||||
push(...items: Builder[]): void {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
this.builders.push(items[i]);
|
||||
}
|
||||
@@ -1300,7 +1299,7 @@ export class MultiBuilder extends Builder {
|
||||
this.length = this.builders.length;
|
||||
}
|
||||
|
||||
public clone(): MultiBuilder {
|
||||
clone(): MultiBuilder {
|
||||
return new MultiBuilder(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { IAction, IActionRunner, Action } from 'vs/base/common/actions';
|
||||
import { IAction, IActionRunner } from 'vs/base/common/actions';
|
||||
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { SubmenuAction } from 'vs/base/browser/ui/menu/menu';
|
||||
|
||||
export interface IEvent {
|
||||
shiftKey?: boolean;
|
||||
@@ -16,9 +17,9 @@ export interface IEvent {
|
||||
metaKey?: boolean;
|
||||
}
|
||||
|
||||
export class ContextSubMenu extends Action {
|
||||
export class ContextSubMenu extends SubmenuAction {
|
||||
constructor(label: string, public entries: (ContextSubMenu | IAction)[]) {
|
||||
super('contextsubmenu', label, '', true);
|
||||
super(label, entries, 'contextsubmenu');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,19 +5,20 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { addDisposableListener } from 'vs/base/browser/dom';
|
||||
|
||||
/**
|
||||
* A helper that will execute a provided function when the provided HTMLElement receives
|
||||
* dragover event for 800ms. If the drag is aborted before, the callback will not be triggered.
|
||||
*/
|
||||
export class DelayedDragHandler {
|
||||
private toDispose: IDisposable[] = [];
|
||||
export class DelayedDragHandler extends Disposable {
|
||||
private timeout: number;
|
||||
|
||||
constructor(container: HTMLElement, callback: () => void) {
|
||||
this.toDispose.push(addDisposableListener(container, 'dragover', () => {
|
||||
super();
|
||||
|
||||
this._register(addDisposableListener(container, 'dragover', () => {
|
||||
if (!this.timeout) {
|
||||
this.timeout = setTimeout(() => {
|
||||
callback();
|
||||
@@ -28,7 +29,7 @@ export class DelayedDragHandler {
|
||||
}));
|
||||
|
||||
['dragleave', 'drop', 'dragend'].forEach(type => {
|
||||
this.toDispose.push(addDisposableListener(container, type, () => {
|
||||
this._register(addDisposableListener(container, type, () => {
|
||||
this.clearDragTimeout();
|
||||
}));
|
||||
});
|
||||
@@ -41,8 +42,9 @@ export class DelayedDragHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.toDispose = dispose(this.toDispose);
|
||||
dispose(): void {
|
||||
super.dispose();
|
||||
|
||||
this.clearDragTimeout();
|
||||
}
|
||||
}
|
||||
@@ -70,3 +72,15 @@ export const DataTransfers = {
|
||||
*/
|
||||
TEXT: 'text/plain'
|
||||
};
|
||||
|
||||
export function applyDragImage(event: DragEvent, label: string, clazz: string): void {
|
||||
const dragImage = document.createElement('div');
|
||||
dragImage.className = clazz;
|
||||
dragImage.textContent = label;
|
||||
|
||||
document.body.appendChild(dragImage);
|
||||
event.dataTransfer.setDragImage(dragImage, -10, -10);
|
||||
|
||||
// Removes the element when the DND operation is done
|
||||
setTimeout(() => document.body.removeChild(dragImage), 0);
|
||||
}
|
||||
@@ -539,7 +539,6 @@ const sizeUtils = {
|
||||
getMarginBottom: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'margin-bottom', 'marginBottom');
|
||||
},
|
||||
|
||||
__commaSentinel: false
|
||||
};
|
||||
|
||||
@@ -635,11 +634,11 @@ export function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePositi
|
||||
}
|
||||
|
||||
export interface IStandardWindow {
|
||||
scrollX: number;
|
||||
scrollY: number;
|
||||
readonly scrollX: number;
|
||||
readonly scrollY: number;
|
||||
}
|
||||
|
||||
export const StandardWindow: IStandardWindow = new class {
|
||||
export const StandardWindow: IStandardWindow = new class implements IStandardWindow {
|
||||
get scrollX(): number {
|
||||
if (typeof window.scrollX === 'number') {
|
||||
// modern browsers
|
||||
@@ -724,14 +723,22 @@ export function isAncestor(testChild: Node, testAncestor: Node): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazz?: string): HTMLElement {
|
||||
export function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement {
|
||||
while (node) {
|
||||
if (hasClass(node, clazz)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (stopAtClazz && hasClass(node, stopAtClazz)) {
|
||||
return null;
|
||||
if (stopAtClazzOrNode) {
|
||||
if (typeof stopAtClazzOrNode === 'string') {
|
||||
if (hasClass(node, stopAtClazzOrNode)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (node === stopAtClazzOrNode) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
node = <HTMLElement>node.parentNode;
|
||||
@@ -812,6 +819,8 @@ export const EventType = {
|
||||
MOUSE_OVER: 'mouseover',
|
||||
MOUSE_MOVE: 'mousemove',
|
||||
MOUSE_OUT: 'mouseout',
|
||||
MOUSE_ENTER: 'mouseenter',
|
||||
MOUSE_LEAVE: 'mouseleave',
|
||||
CONTEXT_MENU: 'contextmenu',
|
||||
WHEEL: 'wheel',
|
||||
// Keyboard
|
||||
@@ -831,6 +840,8 @@ export const EventType = {
|
||||
SUBMIT: 'submit',
|
||||
RESET: 'reset',
|
||||
FOCUS: 'focus',
|
||||
FOCUS_IN: 'focusin',
|
||||
FOCUS_OUT: 'focusout',
|
||||
BLUR: 'blur',
|
||||
INPUT: 'input',
|
||||
// Local Storage
|
||||
@@ -979,7 +990,7 @@ export function $<T extends HTMLElement>(description: string, attrs?: { [key: st
|
||||
|
||||
Object.keys(attrs || {}).forEach(name => {
|
||||
if (/^on\w+$/.test(name)) {
|
||||
result[name] = attrs[name];
|
||||
(<any>result)[name] = attrs[name];
|
||||
} else if (name === 'selected') {
|
||||
const value = attrs[name];
|
||||
if (value) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user