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:
Karl Burtram
2018-09-04 14:55:00 -07:00
committed by GitHub
parent 3763278366
commit 81329fa7fa
2638 changed files with 118456 additions and 64012 deletions

View File

@@ -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();

View File

@@ -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);

View File

@@ -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());

View File

@@ -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;
}
});
}

View File

@@ -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> {

View File

@@ -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 {

View File

@@ -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()}")`);
}

View File

@@ -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);
});
}

View File

@@ -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);
}
/**

View File

@@ -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';

View File

@@ -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;

View File

@@ -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[] {

View File

@@ -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())
);

View File

@@ -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()}")`);
}

View File

@@ -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 => {

View File

@@ -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();

View File

@@ -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 {

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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.

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -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)));

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -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 => {

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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';

View File

@@ -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();

View File

@@ -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

View File

@@ -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) {

View File

@@ -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,

View File

@@ -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));
}
}

View File

@@ -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;

View File

@@ -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();

View File

@@ -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)));

View File

@@ -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);

View File

@@ -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 => {

View File

@@ -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;

View File

@@ -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,

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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,

View File

@@ -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,

View File

@@ -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);
}
/**

View File

@@ -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);
}

View File

@@ -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 },

View File

@@ -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()) {

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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
/**

View File

@@ -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);
}
/**

View File

@@ -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' },

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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);
}
/**

View File

@@ -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();
}
}

View File

@@ -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;

View File

@@ -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>();

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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
};

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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[]>;
}

View File

@@ -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';