mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
VS Code merge to df8fe74bd55313de0dd2303bc47a4aab0ca56b0e (#17979)
* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9 * delete unused folders * distro * Bump build node version * update chokidar * FIx hygiene errors * distro * Fix extension lint issues * Remove strict-vscode * Add copyright header exemptions * Bump vscode-extension-telemetry to fix webpacking issue with zone.js * distro * Fix failing tests (revert marked.js back to current one until we decide to update) * Skip searchmodel test * Fix mac build * temp debug script loading * Try disabling coverage * log error too * Revert "log error too" This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f. * Revert "temp debug script loading" This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c. * Add comments explaining coverage disabling * Fix ansi_up loading issue * Merge latest from ads * Use newer option * Fix compile * add debug logging warn * Always log stack * log more * undo debug * Update to use correct base path (+cleanup) * distro * fix compile errors * Remove strict-vscode * Fix sql editors not showing * Show db dropdown input & fix styling * Fix more info in gallery * Fix gallery asset requests * Delete unused workflow * Fix tapable resolutions for smoke test compile error * Fix smoke compile * Disable crash reporting * Disable interactive Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { FocusedViewContext, IViewDescriptorService, IViewsService, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||
|
||||
@@ -14,14 +14,14 @@ import * as azdata from 'azdata';
|
||||
import { TitledComponent } from 'sql/workbench/browser/modelComponents/titledComponent';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { registerThemingParticipant, IColorTheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
|
||||
import { textLinkForeground, textLinkActiveForeground, focusBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { textLinkForeground, textLinkActiveForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { DomEmitter } from 'vs/base/browser/event';
|
||||
|
||||
@Component({
|
||||
selector: 'modelview-hyperlink',
|
||||
@@ -41,12 +41,13 @@ export default class HyperlinkComponent extends TitledComponent<azdata.Hyperlink
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
const onClick = domEvent(this._el.nativeElement, 'click');
|
||||
const onEnter = Event.chain(domEvent(this._el.nativeElement, 'keydown'))
|
||||
const onClick = this._register(new DomEmitter(this._el.nativeElement, 'click'));
|
||||
const keydown = this._register(new DomEmitter(this._el.nativeElement, 'keydown'));
|
||||
const onEnter = Event.chain(keydown.event)
|
||||
.map(e => new StandardKeyboardEvent(e))
|
||||
.filter(e => e.keyCode === KeyCode.Enter)
|
||||
.event;
|
||||
const onOpen = Event.any<DOM.EventLike>(onClick, onEnter);
|
||||
const onOpen = Event.any<DOM.EventLike>(onClick.event, onEnter);
|
||||
|
||||
this._register(onOpen(e => {
|
||||
this.open(e);
|
||||
@@ -121,13 +122,4 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
|
||||
}
|
||||
`);
|
||||
}
|
||||
|
||||
const outlineColor = theme.getColor(focusBorder);
|
||||
if (outlineColor) {
|
||||
collector.addRule(`
|
||||
modelview-hyperlink a {
|
||||
outline-color: ${outlineColor};
|
||||
}
|
||||
`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,9 +9,3 @@ modelview-hyperlink .link-with-icon::after {
|
||||
margin-left: 5px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
modelview-hyperlink a:focus {
|
||||
outline-width: 1px;
|
||||
outline-style: solid;
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
|
||||
import { ModelViewInput } from 'sql/workbench/browser/modelComponents/modelViewInput';
|
||||
@@ -11,11 +11,11 @@ import { ModelViewEditor } from 'sql/workbench/browser/modelComponents/modelView
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
|
||||
// Model View editor registration
|
||||
const viewModelEditorDescriptor = EditorDescriptor.create(
|
||||
const viewModelEditorDescriptor = EditorPaneDescriptor.create(
|
||||
ModelViewEditor,
|
||||
ModelViewEditor.ID,
|
||||
'ViewModel'
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(viewModelEditorDescriptor, [new SyncDescriptor(ModelViewInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(viewModelEditorDescriptor, [new SyncDescriptor(ModelViewInput)]);
|
||||
|
||||
@@ -63,7 +63,7 @@ export class TreeViewDataProvider extends vsTreeView.TreeViewDataProvider implem
|
||||
* @override
|
||||
* @param elements The elements to map
|
||||
*/
|
||||
protected override async postGetChildren(elements: ITreeComponentItem[]): Promise<ResolvableTreeComponentItem[]> {
|
||||
protected override async postGetChildren(elements: ResolvableTreeItem[] | undefined): Promise<ResolvableTreeComponentItem[]> {
|
||||
const result: ResolvableTreeComponentItem[] = [];
|
||||
const hasResolve = await this.hasResolve;
|
||||
if (elements) {
|
||||
|
||||
@@ -44,7 +44,6 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { TaskRegistry } from 'sql/workbench/services/tasks/browser/tasksRegistry';
|
||||
import { MenuRegistry, IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { fillInActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { NAV_SECTION } from 'sql/workbench/contrib/dashboard/browser/containers/dashboardNavSection.contribution';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { EDITOR_PANE_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
@@ -54,6 +53,7 @@ import { focusBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { LabeledMenuItemActionItem } from 'sql/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { DASHBOARD_BORDER, TOOLBAR_OVERFLOW_SHADOW } from 'sql/workbench/common/theme';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
const dashboardRegistry = Registry.as<IDashboardRegistry>(DashboardExtensions.DashboardContributions);
|
||||
const homeTabGroupId = 'home';
|
||||
@@ -125,8 +125,8 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
@Inject(ICommandService) private commandService: ICommandService,
|
||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
||||
@Inject(IMenuService) private menuService: IMenuService,
|
||||
@Inject(IKeybindingService) private keybindingService: IKeybindingService,
|
||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService
|
||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
this._tabName = DashboardPage.tabName.bindTo(contextKeyService);
|
||||
@@ -278,7 +278,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
private createActionItemProvider(action: Action): IActionViewItem {
|
||||
// Create ActionItem for actions contributed by extensions
|
||||
if (action instanceof MenuItemAction) {
|
||||
return new LabeledMenuItemActionItem(action, this.keybindingService, this.notificationService);
|
||||
return this.instantiationService.createInstance(LabeledMenuItemActionItem, action, undefined);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { DashboardEditor } from 'sql/workbench/contrib/dashboard/browser/dashboa
|
||||
import { DashboardInput } from 'sql/workbench/browser/editor/profiler/dashboardInput';
|
||||
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { localize } from 'vs/nls';
|
||||
@@ -58,11 +58,11 @@ MenuRegistry.appendMenuItem(MenuId.ObjectExplorerItemContext, {
|
||||
when: ContextKeyExpr.or(ContextKeyExpr.and(TreeNodeContextKey.Status.notEqualsTo('Unavailable'), TreeNodeContextKey.NodeType.isEqualTo('Server')), ContextKeyExpr.and(TreeNodeContextKey.Status.notEqualsTo('Unavailable'), TreeNodeContextKey.NodeType.isEqualTo('Database')))
|
||||
});
|
||||
|
||||
const dashboardEditorDescriptor = EditorDescriptor.create(
|
||||
const dashboardEditorDescriptor = EditorPaneDescriptor.create(
|
||||
DashboardEditor,
|
||||
DashboardEditor.ID,
|
||||
localize('dashboard.editor.label', "Dashboard")
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(dashboardEditorDescriptor, [new SyncDescriptor(DashboardInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(dashboardEditorDescriptor, [new SyncDescriptor(DashboardInput)]);
|
||||
|
||||
@@ -20,8 +20,8 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export class DatabaseDashboardPage extends DashboardPage implements OnInit {
|
||||
protected propertiesWidget: WidgetConfig = {
|
||||
@@ -51,10 +51,10 @@ export class DatabaseDashboardPage extends DashboardPage implements OnInit {
|
||||
@Inject(ICommandService) commandService: ICommandService,
|
||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
||||
@Inject(IMenuService) menuService: IMenuService,
|
||||
@Inject(IKeybindingService) keybindingService: IKeybindingService,
|
||||
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService
|
||||
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService,
|
||||
@Inject(IInstantiationService) instantiationService: IInstantiationService
|
||||
) {
|
||||
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, keybindingService, themeService);
|
||||
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, themeService, instantiationService);
|
||||
this._register(dashboardService.onUpdatePage(() => {
|
||||
this.refresh(true);
|
||||
this._cd.detectChanges();
|
||||
|
||||
@@ -21,10 +21,9 @@ import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export class ServerDashboardPage extends DashboardPage implements OnInit {
|
||||
protected propertiesWidget: WidgetConfig = {
|
||||
@@ -55,11 +54,10 @@ export class ServerDashboardPage extends DashboardPage implements OnInit {
|
||||
@Inject(ICommandService) commandService: ICommandService,
|
||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
||||
@Inject(IMenuService) menuService: IMenuService,
|
||||
@Inject(IKeybindingService) keybindingService: IKeybindingService,
|
||||
@Inject(IContextMenuService) contextMenuService: IContextMenuService,
|
||||
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService
|
||||
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService,
|
||||
@Inject(IInstantiationService) instantiationService: IInstantiationService
|
||||
) {
|
||||
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, keybindingService, themeService);
|
||||
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, themeService, instantiationService);
|
||||
|
||||
// special-case handling for MSSQL data provider
|
||||
const connInfo = this.dashboardService.connectionManagementService.connectionInfo;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { EditDataInput } from 'sql/workbench/browser/editData/editDataInput';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { EditDataResultsEditor } from 'sql/workbench/contrib/editData/browser/editDataResultsEditor';
|
||||
import { EditDataResultsInput } from 'sql/workbench/browser/editData/editDataResultsInput';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -18,7 +18,7 @@ import * as editDataActions from 'sql/workbench/contrib/editData/browser/editDat
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
// Editor
|
||||
const editDataEditorDescriptor = EditorDescriptor.create(
|
||||
const editDataEditorDescriptor = EditorPaneDescriptor.create(
|
||||
EditDataEditor,
|
||||
EditDataEditor.ID,
|
||||
'EditData'
|
||||
@@ -38,18 +38,18 @@ configurationRegistry.registerConfiguration({
|
||||
}
|
||||
});
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(editDataEditorDescriptor, [new SyncDescriptor(EditDataInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(editDataEditorDescriptor, [new SyncDescriptor(EditDataInput)]);
|
||||
|
||||
// Editor
|
||||
const editDataResultsEditorDescriptor = EditorDescriptor.create(
|
||||
const editDataResultsEditorDescriptor = EditorPaneDescriptor.create(
|
||||
EditDataResultsEditor,
|
||||
EditDataResultsEditor.ID,
|
||||
'EditDataResults'
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(editDataResultsEditorDescriptor, [new SyncDescriptor(EditDataResultsInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(editDataResultsEditorDescriptor, [new SyncDescriptor(EditDataResultsInput)]);
|
||||
|
||||
// Keybinding for toggling the query pane
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Action, IActionRunner } from 'vs/base/common/actions';
|
||||
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
|
||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
@@ -157,6 +157,7 @@ export class ChangeMaxRowsActionItem extends Disposable implements IActionViewIt
|
||||
|
||||
constructor(
|
||||
private _editor: EditDataEditor,
|
||||
public action: IAction,
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IThemeService private _themeService: IThemeService) {
|
||||
super();
|
||||
|
||||
@@ -371,7 +371,7 @@ export class EditDataEditor extends EditorPane {
|
||||
let actionID = ChangeMaxRowsAction.ID;
|
||||
if (action.id === actionID) {
|
||||
if (!this._changeMaxRowsActionItem) {
|
||||
this._changeMaxRowsActionItem = this._instantiationService.createInstance(ChangeMaxRowsActionItem, this);
|
||||
this._changeMaxRowsActionItem = this._instantiationService.createInstance(ChangeMaxRowsActionItem, this, action);
|
||||
}
|
||||
return this._changeMaxRowsActionItem;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewPaneContainer } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionRecommendation } from 'sql/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionRecommendation } from 'sql/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { visualizerExtensions } from 'sql/workbench/contrib/extensions/common/constants';
|
||||
|
||||
@@ -106,6 +106,7 @@ export class CellToolbarComponent {
|
||||
);
|
||||
}
|
||||
taskbarContent.push(
|
||||
{ action: splitCellButton },
|
||||
{ element: addCellDropdownContainer },
|
||||
{ action: moveCellDownButton },
|
||||
{ action: moveCellUpButton },
|
||||
|
||||
@@ -10,10 +10,9 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { NotebookFindMatch, NotebookFindDecorations } from 'sql/workbench/contrib/notebook/browser/find/notebookFindDecorations';
|
||||
import * as model from 'vs/editor/common/model';
|
||||
import { ModelDecorationOptions, DidChangeDecorationsEmitter, createTextBuffer } from 'vs/editor/common/model/textModel';
|
||||
import { ModelDecorationOptions, DidChangeDecorationsEmitter, createTextBuffer, TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { IModelDecorationsChangedEvent } from 'vs/editor/common/model/textModelEvents';
|
||||
import { IntervalNode } from 'vs/editor/common/model/intervalTree';
|
||||
import { EDITOR_MODEL_DEFAULTS } from 'vs/editor/common/config/editorOptions';
|
||||
import { Range, IRange } from 'vs/editor/common/core/range';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { singleLetterHash, isHighSurrogate } from 'vs/base/common/strings';
|
||||
@@ -55,7 +54,7 @@ export class NotebookFindModel extends Disposable implements INotebookFindModel
|
||||
public findExpression: string;
|
||||
|
||||
//#region Decorations
|
||||
private readonly _onDidChangeDecorations: DidChangeDecorationsEmitter = this._register(new DidChangeDecorationsEmitter());
|
||||
private readonly _onDidChangeDecorations: DidChangeDecorationsEmitter = this._register(new DidChangeDecorationsEmitter(affectedInjectedTextLines => { } /* this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines) */)); // Do we need this event?
|
||||
public readonly onDidChangeDecorations: Event<IModelDecorationsChangedEvent> = this._onDidChangeDecorations.event;
|
||||
private _decorations: { [decorationId: string]: NotebookIntervalNode; };
|
||||
//#endregion
|
||||
@@ -72,7 +71,7 @@ export class NotebookFindModel extends Disposable implements INotebookFindModel
|
||||
|
||||
this._decorations = Object.create(null);
|
||||
|
||||
const { textBuffer, } = createTextBuffer('', NotebookFindModel.DEFAULT_CREATION_OPTIONS.defaultEOL);
|
||||
const { textBuffer, } = createTextBuffer('', TextModel.DEFAULT_CREATION_OPTIONS.defaultEOL);
|
||||
this._buffer = textBuffer;
|
||||
this._versionId = 1;
|
||||
this.id = '$model' + MODEL_ID;
|
||||
@@ -100,17 +99,6 @@ export class NotebookFindModel extends Disposable implements INotebookFindModel
|
||||
this.clearFind();
|
||||
}
|
||||
|
||||
public static DEFAULT_CREATION_OPTIONS: model.ITextModelCreationOptions = {
|
||||
isForSimpleWidget: false,
|
||||
tabSize: EDITOR_MODEL_DEFAULTS.tabSize,
|
||||
indentSize: EDITOR_MODEL_DEFAULTS.indentSize,
|
||||
insertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,
|
||||
detectIndentation: false,
|
||||
defaultEOL: model.DefaultEndOfLine.LF,
|
||||
trimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
|
||||
largeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,
|
||||
};
|
||||
|
||||
public get onFindCountChange(): Event<number> { return this._onFindCountChange.event; }
|
||||
|
||||
public get VersionId(): number {
|
||||
@@ -289,7 +277,7 @@ export class NotebookFindModel extends Disposable implements INotebookFindModel
|
||||
*/
|
||||
private _validateRangeRelaxedNoAllocations(range: IRange): NotebookRange {
|
||||
if (range instanceof NotebookRange) {
|
||||
const { textBuffer, } = createTextBuffer(range.cell.source instanceof Array ? range.cell.source.join('\n') : range.cell.source, NotebookFindModel.DEFAULT_CREATION_OPTIONS.defaultEOL);
|
||||
const { textBuffer, } = createTextBuffer(range.cell.source instanceof Array ? range.cell.source.join('\n') : range.cell.source, TextModel.DEFAULT_CREATION_OPTIONS.defaultEOL);
|
||||
this._buffer = textBuffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ export class DiffNotebookInput extends SideBySideEditorInput {
|
||||
@INotebookService notebookService: INotebookService,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
let originalInput = instantiationService.createInstance(FileNotebookInput, diffInput.primary.getName(), diffInput.primary.resource, diffInput.originalInput as FileEditorInput, false);
|
||||
let modifiedInput = instantiationService.createInstance(FileNotebookInput, diffInput.secondary.getName(), diffInput.secondary.resource, diffInput.modifiedInput as FileEditorInput, false);
|
||||
let originalInput = instantiationService.createInstance(FileNotebookInput, diffInput.primary.getName(), diffInput.primary.resource, diffInput.original as FileEditorInput, false);
|
||||
let modifiedInput = instantiationService.createInstance(FileNotebookInput, diffInput.secondary.getName(), diffInput.secondary.resource, diffInput.modified as FileEditorInput, false);
|
||||
super(title, diffInput.getTitle(), modifiedInput, originalInput);
|
||||
this._notebookService = notebookService;
|
||||
this._logService = logService;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEditorInputFactoryRegistry, IEditorInput, IEditorInputSerializer, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { IEditorFactoryRegistry, IEditorInput, IEditorSerializer, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FILE_EDITOR_INPUT_ID } from 'vs/workbench/contrib/files/common/files';
|
||||
@@ -18,9 +18,9 @@ import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||
import { DiffNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/diffNotebookInput';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
const editorInputFactoryRegistry = Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories);
|
||||
const editorFactoryRegistry = Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory);
|
||||
|
||||
export class NotebookEditorInputAssociation implements ILanguageAssociation {
|
||||
export class NotebookEditorLanguageAssociation implements ILanguageAssociation {
|
||||
/**
|
||||
* The language IDs that are associated with Notebooks. These are case sensitive for comparing with what's
|
||||
* registered in the ModeService registry.
|
||||
@@ -53,9 +53,9 @@ export class NotebookEditorInputAssociation implements ILanguageAssociation {
|
||||
}
|
||||
}
|
||||
|
||||
export class FileNoteBookEditorInputSerializer implements IEditorInputSerializer {
|
||||
export class FileNoteBookEditorSerializer implements IEditorSerializer {
|
||||
serialize(editorInput: FileNotebookInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
|
||||
if (factory) {
|
||||
return factory.serialize(editorInput.textInput); // serialize based on the underlying input
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export class FileNoteBookEditorInputSerializer implements IEditorInputSerializer
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileNotebookInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
|
||||
return instantiationService.createInstance(FileNotebookInput, fileEditorInput.getName(), fileEditorInput.resource, fileEditorInput, true);
|
||||
}
|
||||
@@ -73,9 +73,9 @@ export class FileNoteBookEditorInputSerializer implements IEditorInputSerializer
|
||||
}
|
||||
}
|
||||
|
||||
export class UntitledNotebookEditorInputSerializer implements IEditorInputSerializer {
|
||||
export class UntitledNotebookEditorSerializer implements IEditorSerializer {
|
||||
serialize(editorInput: UntitledNotebookInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
|
||||
if (factory) {
|
||||
return factory.serialize(editorInput.textInput); // serialize based on the underlying input
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export class UntitledNotebookEditorInputSerializer implements IEditorInputSerial
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledNotebookInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
|
||||
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
|
||||
return instantiationService.createInstance(UntitledNotebookInput, untitledEditorInput.getName(), untitledEditorInput.resource, untitledEditorInput);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IRevertOptions, GroupIdentifier, IEditorInput, EditorInputCapabilities } from 'vs/workbench/common/editor';
|
||||
import { IRevertOptions, GroupIdentifier, IEditorInput, EditorInputCapabilities, IUntypedEditorInput } from 'vs/workbench/common/editor';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
@@ -513,7 +513,7 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
|
||||
return this._model.updateModel();
|
||||
}
|
||||
|
||||
public override matches(otherInput: any): boolean {
|
||||
public override matches(otherInput: IEditorInput | IUntypedEditorInput): boolean {
|
||||
if (otherInput instanceof NotebookInput) {
|
||||
return this.textInput.matches(otherInput.textInput);
|
||||
} else {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { MenuId, IMenuService, MenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { IAction, Action, SubmenuAction } from 'vs/base/common/actions';
|
||||
import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
|
||||
import { AngularDisposable } from 'sql/base/browser/lifecycle';
|
||||
@@ -104,7 +103,6 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
@Inject(IConnectionDialogService) private connectionDialogService: IConnectionDialogService,
|
||||
@Inject(IContextKeyService) private contextKeyService: IContextKeyService,
|
||||
@Inject(IMenuService) private menuService: IMenuService,
|
||||
@Inject(IKeybindingService) private keybindingService: IKeybindingService,
|
||||
@Inject(ICapabilitiesService) private capabilitiesService: ICapabilitiesService,
|
||||
@Inject(ITextFileService) private textFileService: ITextFileService,
|
||||
@Inject(ILogService) private readonly logService: ILogService,
|
||||
@@ -624,7 +622,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
action.tooltip = action.label;
|
||||
action.label = '';
|
||||
}
|
||||
return new MaskedLabeledMenuItemActionItem(action, this.keybindingService, this.notificationService);
|
||||
return this.instantiationService.createInstance(MaskedLabeledMenuItemActionItem, action);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IEditorInputFactoryRegistry, ActiveEditorContext, IEditorInput, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { IEditorFactoryRegistry, ActiveEditorContext, IEditorInput, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { UntitledNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/untitledNotebookInput';
|
||||
import { FileNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/fileNotebookInput';
|
||||
import { FileNoteBookEditorInputSerializer, NotebookEditorInputAssociation, UntitledNotebookEditorInputSerializer } from 'sql/workbench/contrib/notebook/browser/models/notebookInputFactory';
|
||||
import { FileNoteBookEditorSerializer, NotebookEditorLanguageAssociation, UntitledNotebookEditorSerializer } from 'sql/workbench/contrib/notebook/browser/models/notebookEditorFactory';
|
||||
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionsExtensions } from 'vs/workbench/common/actions';
|
||||
import { SyncActionDescriptor, registerAction2, MenuRegistry, MenuId, Action2 } from 'vs/platform/actions/common/actions';
|
||||
|
||||
@@ -56,7 +56,7 @@ import { INotebookModel } from 'sql/workbench/services/notebook/browser/models/m
|
||||
import { DEFAULT_NOTEBOOK_FILETYPE, IExecuteManager, SQL_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { NotebookExplorerViewletViewsContribution } from 'sql/workbench/contrib/notebook/browser/notebookExplorer/notebookExplorerViewlet';
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { ContributedEditorPriority, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IEditorResolverService, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -65,17 +65,17 @@ import { useNewMarkdownRendererKey } from 'sql/workbench/contrib/notebook/common
|
||||
import { JUPYTER_PROVIDER_ID, NotebookLanguage } from 'sql/workbench/common/constants';
|
||||
import { INotebookProviderRegistry, NotebookProviderRegistryId } from 'sql/workbench/services/notebook/common/notebookRegistry';
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
|
||||
.registerEditorInputSerializer(FileNotebookInput.ID, FileNoteBookEditorInputSerializer);
|
||||
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
|
||||
.registerEditorSerializer(FileNotebookInput.ID, FileNoteBookEditorSerializer);
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
|
||||
.registerEditorInputSerializer(UntitledNotebookInput.ID, UntitledNotebookEditorInputSerializer);
|
||||
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
|
||||
.registerEditorSerializer(UntitledNotebookInput.ID, UntitledNotebookEditorSerializer);
|
||||
|
||||
Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.LanguageAssociations)
|
||||
.registerLanguageAssociation(NotebookEditorInputAssociation.languages, NotebookEditorInputAssociation);
|
||||
.registerLanguageAssociation(NotebookEditorLanguageAssociation.languages, NotebookEditorLanguageAssociation);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(EditorDescriptor.create(NotebookEditor, NotebookEditor.ID, NotebookEditor.LABEL), [new SyncDescriptor(UntitledNotebookInput), new SyncDescriptor(FileNotebookInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(EditorPaneDescriptor.create(NotebookEditor, NotebookEditor.ID, NotebookEditor.LABEL), [new SyncDescriptor(UntitledNotebookInput), new SyncDescriptor(FileNotebookInput)]);
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(NotebookThemingContribution, LifecyclePhase.Restored);
|
||||
@@ -701,7 +701,7 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
|
||||
constructor(
|
||||
@ILogService private _logService: ILogService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IEditorOverrideService private _editorOverrideService: IEditorOverrideService,
|
||||
@IEditorResolverService private _editorResolverService: IEditorResolverService,
|
||||
@IModeService private _modeService: IModeService
|
||||
) {
|
||||
super();
|
||||
@@ -726,7 +726,7 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
|
||||
let allExtensions: string[] = [];
|
||||
|
||||
// List of built-in language IDs to associate the query editor for. These are case sensitive.
|
||||
NotebookEditorInputAssociation.languages.forEach(lang => {
|
||||
NotebookEditorLanguageAssociation.languages.forEach(lang => {
|
||||
const langExtensions = this._modeService.getExtensions(lang);
|
||||
allExtensions = allExtensions.concat(langExtensions);
|
||||
});
|
||||
@@ -737,37 +737,37 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
|
||||
// Create the selector from the list of all the language extensions we want to associate with the
|
||||
// notebook editor
|
||||
const selector = `*{${allExtensions.join(',')}}`;
|
||||
this._registeredOverrides.add(this._editorOverrideService.registerEditor(
|
||||
this._registeredOverrides.add(this._editorResolverService.registerEditor(
|
||||
selector,
|
||||
{
|
||||
id: NotebookEditor.ID,
|
||||
label: NotebookEditor.LABEL,
|
||||
describes: (currentEditor) => currentEditor instanceof FileNotebookInput,
|
||||
priority: ContributedEditorPriority.builtin
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
(resource, options, group) => {
|
||||
const fileInput = this._editorService.createEditorInput({
|
||||
resource: resource
|
||||
}) as FileEditorInput;
|
||||
(editorInput, group) => {
|
||||
const fileInput = this._editorService.createEditorInput(editorInput) as FileEditorInput;
|
||||
// Try to convert the input, falling back to just a plain file input if we're unable to
|
||||
const newInput = this.tryConvertInput(fileInput) ?? fileInput;
|
||||
return { editor: newInput, options: options, group: group };
|
||||
const newInput = this.convertInput(fileInput);
|
||||
return { editor: newInput, options: editorInput.options, group: group };
|
||||
},
|
||||
(diffEditorInput, options, group) => {
|
||||
undefined,
|
||||
(diffEditorInput, group) => {
|
||||
const diffEditorInputImpl = this._editorService.createEditorInput(diffEditorInput) as DiffEditorInput;
|
||||
// Try to convert the input, falling back to the original input if we're unable to
|
||||
const newInput = this.tryConvertInput(diffEditorInput) ?? diffEditorInput;
|
||||
return { editor: newInput, options: options, group: group };
|
||||
const newInput = this.convertInput(diffEditorInputImpl);
|
||||
return { editor: newInput, options: diffEditorInput.options, group: group };
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
private tryConvertInput(input: IEditorInput): IEditorInput | undefined {
|
||||
private convertInput(input: IEditorInput): IEditorInput {
|
||||
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(NotebookLanguage.Ipynb);
|
||||
const notebookEditorInput = langAssociation?.syncConvertInput?.(input);
|
||||
if (!notebookEditorInput) {
|
||||
this._logService.warn('Unable to create input for overriding editor ', input instanceof DiffEditorInput ? `${input.primary.resource.toString()} <-> ${input.secondary.resource.toString()}` : input.resource.toString());
|
||||
return undefined;
|
||||
// Fall back to original input if we failed to convert
|
||||
this._logService.warn('Unable to create input for resolving editor ', input instanceof DiffEditorInput ? `${input.primary.resource.toString()} <-> ${input.secondary.resource.toString()}` : input.resource.toString());
|
||||
return input;
|
||||
}
|
||||
return notebookEditorInput;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import { IBootstrapParams } from 'sql/workbench/services/bootstrap/common/bootst
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
import { MenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
@@ -71,7 +70,6 @@ export class NotebookViewComponent extends AngularDisposable implements INoteboo
|
||||
@Inject(IBootstrapParams) private _notebookParams: INotebookParams,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||
@Inject(IInstantiationService) private _instantiationService: IInstantiationService,
|
||||
@Inject(IKeybindingService) private _keybindingService: IKeybindingService,
|
||||
@Inject(IContextMenuService) private _contextMenuService: IContextMenuService,
|
||||
@Inject(INotificationService) private _notificationService: INotificationService,
|
||||
@Inject(INotebookService) private _notebookService: INotebookService,
|
||||
@@ -315,7 +313,7 @@ export class NotebookViewComponent extends AngularDisposable implements INoteboo
|
||||
action.tooltip = action.label;
|
||||
action.label = '';
|
||||
}
|
||||
return new LabeledMenuItemActionItem(action, this._keybindingService, this._notificationService, 'notebook-button fixed-width');
|
||||
return this._instantiationService.createInstance(LabeledMenuItemActionItem, action, 'notebook-button fixed-width');
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ suite('MarkdownTextTransformer', () => {
|
||||
assert(!isUndefinedOrNull(widget), 'widget is undefined');
|
||||
|
||||
// Create new text model
|
||||
textModel = new TextModel('', { isForSimpleWidget: true, defaultEOL: DefaultEndOfLine.LF, detectIndentation: true, indentSize: 0, insertSpaces: false, largeFileOptimizations: false, tabSize: 4, trimAutoWhitespace: false }, null, undefined, undoRedoService);
|
||||
textModel = new TextModel('', { isForSimpleWidget: true, defaultEOL: DefaultEndOfLine.LF, detectIndentation: true, indentSize: 0, insertSpaces: false, largeFileOptimizations: false, tabSize: 4, trimAutoWhitespace: false, bracketPairColorizationOptions: { enabled: true } }, null, undefined, undoRedoService);
|
||||
|
||||
// Couple widget with newly created text model
|
||||
widget.setModel(textModel);
|
||||
|
||||
@@ -33,7 +33,7 @@ import { FindReplaceStateChangedEvent, INewFindReplaceState } from 'vs/editor/co
|
||||
import { getRandomString } from 'vs/editor/test/common/model/linesTextBuffer/textBufferAutoTestUtils';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ContextViewService } from 'vs/platform/contextview/browser/contextViewService';
|
||||
import { DidInstallExtensionEvent, DidUninstallExtensionEvent, IExtensionManagementService, InstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { DidUninstallExtensionEvent, IExtensionManagementService, InstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
@@ -672,7 +672,6 @@ async function findStateChangeSetup(instantiationService: TestInstantiationServi
|
||||
|
||||
function setupServices(arg: { workbenchThemeService?: WorkbenchThemeService, instantiationService?: TestInstantiationService } = {}) {
|
||||
const installEvent: Emitter<InstallExtensionEvent> = new Emitter<InstallExtensionEvent>();
|
||||
const didInstallEvent = new Emitter<DidInstallExtensionEvent>();
|
||||
const uninstallEvent = new Emitter<IExtensionIdentifier>();
|
||||
const didUninstallEvent = new Emitter<DidUninstallExtensionEvent>();
|
||||
|
||||
@@ -684,7 +683,6 @@ function setupServices(arg: { workbenchThemeService?: WorkbenchThemeService, ins
|
||||
|
||||
instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
|
||||
instantiationService.stub(IExtensionManagementService, 'onInstallExtension', installEvent.event);
|
||||
instantiationService.stub(IExtensionManagementService, 'onDidInstallExtension', didInstallEvent.event);
|
||||
instantiationService.stub(IExtensionManagementService, 'onUninstallExtension', uninstallEvent.event);
|
||||
instantiationService.stub(IExtensionManagementService, 'onDidUninstallExtension', didUninstallEvent.event);
|
||||
|
||||
|
||||
@@ -173,8 +173,6 @@ suite('Notebook Input', function (): void {
|
||||
});
|
||||
|
||||
test('Matches other input', async function (): Promise<void> {
|
||||
assert.strictEqual(untitledNotebookInput.matches(undefined), false, 'Input should not match undefined.');
|
||||
|
||||
assert.ok(untitledNotebookInput.matches(untitledNotebookInput), 'Input should match itself.');
|
||||
|
||||
let otherTestUri = URI.from({ scheme: Schemas.untitled, path: 'OtherTestPath' });
|
||||
|
||||
@@ -20,7 +20,7 @@ import * as TypeMoq from 'typemoq';
|
||||
import { errorHandler, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { DidInstallExtensionEvent, DidUninstallExtensionEvent, IExtensionIdentifier, IExtensionManagementService, InstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { DidUninstallExtensionEvent, IExtensionIdentifier, IExtensionManagementService, InstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
@@ -154,7 +154,6 @@ suite.skip('NotebookService:', function (): void {
|
||||
let editorGroupsService: IEditorGroupsService;
|
||||
|
||||
let installExtensionEmitter: Emitter<InstallExtensionEvent>,
|
||||
didInstallExtensionEmitter: Emitter<DidInstallExtensionEvent>,
|
||||
uninstallExtensionEmitter: Emitter<IExtensionIdentifier>,
|
||||
didUninstallExtensionEmitter: Emitter<DidUninstallExtensionEvent>;
|
||||
let configurationService: IConfigurationService;
|
||||
@@ -178,14 +177,12 @@ suite.skip('NotebookService:', function (): void {
|
||||
instantiationService = new TestInstantiationService();
|
||||
|
||||
installExtensionEmitter = new Emitter<InstallExtensionEvent>();
|
||||
didInstallExtensionEmitter = new Emitter<DidInstallExtensionEvent>();
|
||||
uninstallExtensionEmitter = new Emitter<IExtensionIdentifier>();
|
||||
didUninstallExtensionEmitter = new Emitter<DidUninstallExtensionEvent>();
|
||||
configurationService = new TestConfigurationService();
|
||||
|
||||
instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
|
||||
instantiationService.stub(IExtensionManagementService, 'onInstallExtension', installExtensionEmitter.event);
|
||||
instantiationService.stub(IExtensionManagementService, 'onDidInstallExtension', didInstallExtensionEmitter.event);
|
||||
instantiationService.stub(IExtensionManagementService, 'onUninstallExtension', uninstallExtensionEmitter.event);
|
||||
instantiationService.stub(IExtensionManagementService, 'onDidUninstallExtension', didUninstallExtensionEmitter.event);
|
||||
extensionManagementService = instantiationService.get(IExtensionManagementService);
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
|
||||
import { TestFileDialogService, TestLayoutService, TestPathService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
|
||||
import { ILinkCalloutDialogOptions, LinkCalloutDialog } from 'sql/workbench/contrib/notebook/browser/calloutDialog/linkCalloutDialog';
|
||||
|
||||
@@ -555,22 +555,22 @@ export class NodeStub implements Node {
|
||||
get baseURI(): string {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get childNodes(): NodeListOf<ChildNode> {
|
||||
get childNodes(): NodeListOf<ChildNode & Node> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get firstChild(): ChildNode {
|
||||
get firstChild(): ChildNode & Node {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get isConnected(): boolean {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get lastChild(): ChildNode {
|
||||
get lastChild(): ChildNode & Node {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get namespaceURI(): string {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get nextSibling(): ChildNode {
|
||||
get nextSibling(): ChildNode & Node {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get nodeName(): string {
|
||||
@@ -588,7 +588,7 @@ export class NodeStub implements Node {
|
||||
get parentNode(): Node & ParentNode {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
get previousSibling(): ChildNode {
|
||||
get previousSibling(): ChildNode & Node {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
nodeValue: string;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -15,14 +15,14 @@ import { ProfilerInput } from 'sql/workbench/browser/editor/profiler/profilerInp
|
||||
import { ProfilerEditor } from 'sql/workbench/contrib/profiler/browser/profilerEditor';
|
||||
import { PROFILER_VIEW_TEMPLATE_SETTINGS, PROFILER_SESSION_TEMPLATE_SETTINGS, IProfilerViewTemplate, IProfilerSessionTemplate, EngineType, PROFILER_FILTER_SETTINGS } from 'sql/workbench/services/profiler/browser/interfaces';
|
||||
|
||||
const profilerDescriptor = EditorDescriptor.create(
|
||||
const profilerDescriptor = EditorPaneDescriptor.create(
|
||||
ProfilerEditor,
|
||||
ProfilerEditor.ID,
|
||||
'ProfilerEditor'
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(profilerDescriptor, [new SyncDescriptor(ProfilerInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(profilerDescriptor, [new SyncDescriptor(ProfilerInput)]);
|
||||
|
||||
const profilerViewTemplateSchema: IJSONSchema = {
|
||||
description: nls.localize('profiler.settings.viewTemplates', "Specifies view templates"),
|
||||
|
||||
@@ -518,7 +518,8 @@ export class ProfilerEditor extends EditorPane {
|
||||
shouldFocus: FindStartFocusAction.FocusFindInput,
|
||||
shouldAnimate: true,
|
||||
updateSearchScope: false,
|
||||
loop: true
|
||||
loop: true,
|
||||
seedSearchStringFromNonEmptySelection: false
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IConfigurationRegistry, Extensions as ConfigExtensions, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
@@ -29,9 +29,9 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWo
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { TimeElapsedStatusBarContributions, RowCountStatusBarContributions, QueryStatusStatusBarContributions, QueryResultSelectionSummaryStatusBarContribution } from 'sql/workbench/contrib/query/browser/statusBarItems';
|
||||
import { SqlFlavorStatusbarItem, ChangeFlavorAction } from 'sql/workbench/contrib/query/browser/flavorStatus';
|
||||
import { EditorExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
|
||||
import { EditorExtensions, IEditorFactoryRegistry } from 'vs/workbench/common/editor';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/browser/fileQueryEditorInput';
|
||||
import { FileQueryEditorInputSerializer, QueryEditorLanguageAssociation, UntitledQueryEditorInputSerializer } from 'sql/workbench/contrib/query/browser/queryInputFactory';
|
||||
import { FileQueryEditorSerializer, QueryEditorLanguageAssociation, UntitledQueryEditorSerializer } from 'sql/workbench/contrib/query/browser/queryEditorFactory';
|
||||
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
|
||||
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { NewQueryTask, OE_NEW_QUERY_ACTION_ID, DE_NEW_QUERY_COMMAND_ID } from 'sql/workbench/contrib/query/browser/queryActions';
|
||||
@@ -44,7 +44,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { IEditorOverrideService, ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IEditorResolverService, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@@ -52,20 +52,20 @@ export const QueryEditorVisibleCondition = ContextKeyExpr.has(queryContext.query
|
||||
export const ResultsGridFocusCondition = ContextKeyExpr.and(ContextKeyExpr.has(queryContext.resultsVisibleId), ContextKeyExpr.has(queryContext.resultsGridFocussedId));
|
||||
export const ResultsMessagesFocusCondition = ContextKeyExpr.and(ContextKeyExpr.has(queryContext.resultsVisibleId), ContextKeyExpr.has(queryContext.resultsMessagesFocussedId));
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
|
||||
.registerEditorInputSerializer(FileQueryEditorInput.ID, FileQueryEditorInputSerializer);
|
||||
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
|
||||
.registerEditorSerializer(FileQueryEditorInput.ID, FileQueryEditorSerializer);
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
|
||||
.registerEditorInputSerializer(UntitledQueryEditorInput.ID, UntitledQueryEditorInputSerializer);
|
||||
Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory)
|
||||
.registerEditorSerializer(UntitledQueryEditorInput.ID, UntitledQueryEditorSerializer);
|
||||
|
||||
Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.LanguageAssociations)
|
||||
.registerLanguageAssociation(QueryEditorLanguageAssociation.languages, QueryEditorLanguageAssociation, QueryEditorLanguageAssociation.isDefault);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(EditorDescriptor.create(QueryResultsEditor, QueryResultsEditor.ID, localize('queryResultsEditor.name', "Query Results")), [new SyncDescriptor(QueryResultsInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(EditorPaneDescriptor.create(QueryResultsEditor, QueryResultsEditor.ID, localize('queryResultsEditor.name', "Query Results")), [new SyncDescriptor(QueryResultsInput)]);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(EditorDescriptor.create(QueryEditor, QueryEditor.ID, QueryEditor.LABEL), [new SyncDescriptor(FileQueryEditorInput), new SyncDescriptor(UntitledQueryEditorInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(EditorPaneDescriptor.create(QueryEditor, QueryEditor.ID, QueryEditor.LABEL), [new SyncDescriptor(FileQueryEditorInput), new SyncDescriptor(UntitledQueryEditorInput)]);
|
||||
|
||||
const actionRegistry = <IWorkbenchActionRegistry>Registry.as(ActionExtensions.WorkbenchActions);
|
||||
|
||||
@@ -500,7 +500,7 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
|
||||
constructor(
|
||||
@ILogService private _logService: ILogService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IEditorOverrideService private _editorOverrideService: IEditorOverrideService,
|
||||
@IEditorResolverService private _editorResolverService: IEditorResolverService,
|
||||
@IModeService private _modeService: IModeService
|
||||
) {
|
||||
super();
|
||||
@@ -523,26 +523,23 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
|
||||
// Create the selector from the list of all the language extensions we want to associate with the
|
||||
// query editor (filtering out any languages which didn't have any extensions registered yet)
|
||||
const selector = `*{${langExtensions.join(',')}}`;
|
||||
this._registeredOverrides.add(this._editorOverrideService.registerEditor(
|
||||
this._registeredOverrides.add(this._editorResolverService.registerEditor(
|
||||
selector,
|
||||
{
|
||||
id: QueryEditor.ID,
|
||||
label: QueryEditor.LABEL,
|
||||
describes: (currentEditor) => currentEditor instanceof FileQueryEditorInput,
|
||||
priority: ContributedEditorPriority.builtin
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
(resource, options, group) => {
|
||||
const fileInput = this._editorService.createEditorInput({
|
||||
resource: resource
|
||||
}) as FileEditorInput;
|
||||
(editorInput, group) => {
|
||||
const fileInput = this._editorService.createEditorInput(editorInput) as FileEditorInput;
|
||||
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(lang);
|
||||
const queryEditorInput = langAssociation?.syncConvertInput?.(fileInput);
|
||||
if (!queryEditorInput) {
|
||||
this._logService.warn('Unable to create input for overriding editor ', resource);
|
||||
this._logService.warn('Unable to create input for resolving editor ', editorInput.resource);
|
||||
return undefined;
|
||||
}
|
||||
return { editor: queryEditorInput, options: options, group: group };
|
||||
return { editor: queryEditorInput, options: editorInput.options, group: group };
|
||||
}
|
||||
));
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import 'vs/css!./media/queryActions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { Action, IActionRunner } from 'vs/base/common/actions';
|
||||
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -583,6 +583,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
||||
// CONSTRUCTOR /////////////////////////////////////////////////////////
|
||||
constructor(
|
||||
private _editor: QueryEditor,
|
||||
public action: IAction,
|
||||
@IContextViewService contextViewProvider: IContextViewService,
|
||||
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
|
||||
@@ -42,6 +42,7 @@ import { IRange } from 'vs/editor/common/core/range';
|
||||
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ConnectionOptionSpecialType } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
@@ -109,11 +110,12 @@ export class QueryEditor extends EditorPane {
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IModeService private readonly modeService: IModeService,
|
||||
@ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService,
|
||||
@ICapabilitiesService private readonly capabilitiesService: ICapabilitiesService
|
||||
) {
|
||||
super(QueryEditor.ID, telemetryService, themeService, storageService);
|
||||
|
||||
this.editorMemento = this.getEditorMemento<IQueryEditorViewState>(editorGroupService, QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
|
||||
this.editorMemento = this.getEditorMemento<IQueryEditorViewState>(editorGroupService, textResourceConfigurationService, QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
|
||||
|
||||
this.queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
|
||||
|
||||
@@ -122,14 +124,21 @@ export class QueryEditor extends EditorPane {
|
||||
}
|
||||
|
||||
private onFilesChanged(e: FileChangesEvent): void {
|
||||
const deleted = e.getDeleted();
|
||||
if (deleted && deleted.length) {
|
||||
this.clearTextEditorViewState(deleted.map(d => d.resource));
|
||||
const deleted = e.rawDeleted;
|
||||
if (!deleted) {
|
||||
return;
|
||||
}
|
||||
const changes = [];
|
||||
for (const [, change] of deleted) {
|
||||
changes.push(change);
|
||||
}
|
||||
if (changes.length) {
|
||||
this.clearTextEditorViewState(changes.map(d => d.resource));
|
||||
}
|
||||
}
|
||||
|
||||
protected override getEditorMemento<T>(editorGroupService: IEditorGroupsService, key: string, limit: number = 10): IEditorMemento<T> {
|
||||
return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService); // do not persist in storage as results are never persisted
|
||||
protected override getEditorMemento<T>(editorGroupService: IEditorGroupsService, configurationService: ITextResourceConfigurationService, key: string, limit: number = 10): IEditorMemento<T> {
|
||||
return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService, configurationService); // do not persist in storage as results are never persisted
|
||||
}
|
||||
|
||||
// PUBLIC METHODS ////////////////////////////////////////////////////////////
|
||||
@@ -222,9 +231,9 @@ export class QueryEditor extends EditorPane {
|
||||
this._changeConnectionAction.enabled = this.input.state.connected;
|
||||
this.setTaskbarContent();
|
||||
if (this.input.state.connected) {
|
||||
this.listDatabasesActionItem.onConnected();
|
||||
this.listDatabasesActionItem?.onConnected();
|
||||
} else {
|
||||
this.listDatabasesActionItem.onDisconnect();
|
||||
this.listDatabasesActionItem?.onDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,17 +268,17 @@ export class QueryEditor extends EditorPane {
|
||||
*/
|
||||
private _getActionItemForAction(action: IAction): IActionViewItem {
|
||||
if (action.id === actions.ListDatabasesAction.ID) {
|
||||
return this.listDatabasesActionItem;
|
||||
if (!this._listDatabasesActionItem) {
|
||||
this._listDatabasesActionItem = this.instantiationService.createInstance(actions.ListDatabasesActionItem, this, action);
|
||||
this._register(this._listDatabasesActionItem.attachStyler(this.themeService));
|
||||
}
|
||||
return this._listDatabasesActionItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private get listDatabasesActionItem(): actions.ListDatabasesActionItem {
|
||||
if (!this._listDatabasesActionItem) {
|
||||
this._listDatabasesActionItem = this.instantiationService.createInstance(actions.ListDatabasesActionItem, this);
|
||||
this._register(this._listDatabasesActionItem.attachStyler(this.themeService));
|
||||
}
|
||||
private get listDatabasesActionItem(): actions.ListDatabasesActionItem | undefined {
|
||||
return this._listDatabasesActionItem;
|
||||
}
|
||||
|
||||
@@ -324,7 +333,7 @@ export class QueryEditor extends EditorPane {
|
||||
public override async setInput(newInput: QueryEditorInput, options: IEditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
const oldInput = this.input;
|
||||
|
||||
if (newInput.matches(oldInput)) {
|
||||
if (oldInput && newInput.matches(oldInput)) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEditorInputFactoryRegistry, IEditorInput, IEditorInputSerializer, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { IEditorFactoryRegistry, IEditorInput, IEditorSerializer, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
|
||||
@@ -24,7 +24,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
|
||||
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
|
||||
|
||||
const editorInputFactoryRegistry = Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories);
|
||||
const editorFactoryRegistry = Registry.as<IEditorFactoryRegistry>(EditorExtensions.EditorFactory);
|
||||
|
||||
export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
static readonly isDefault = true;
|
||||
@@ -99,13 +99,13 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
}
|
||||
}
|
||||
|
||||
export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
export class FileQueryEditorSerializer implements IEditorSerializer {
|
||||
|
||||
constructor(@IFileService private readonly fileService: IFileService) {
|
||||
|
||||
}
|
||||
serialize(editorInput: FileQueryEditorInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
|
||||
if (factory) {
|
||||
return factory.serialize(editorInput.text); // serialize based on the underlying input
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileQueryEditorInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(FILE_EDITOR_INPUT_ID);
|
||||
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
|
||||
// only successfully deserilize the file if the resource actually exists
|
||||
if (this.fileService.exists(fileEditorInput.resource)) {
|
||||
@@ -130,11 +130,11 @@ export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
export class UntitledQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
export class UntitledQueryEditorSerializer implements IEditorSerializer {
|
||||
|
||||
constructor(@IConfigurationService private readonly configurationService: IConfigurationService) { }
|
||||
serialize(editorInput: UntitledQueryEditorInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
|
||||
// only serialize non-dirty files if the user has that setting
|
||||
if (factory && (editorInput.isDirty() || this.configurationService.getValue<IQueryEditorConfiguration>('queryEditor').promptToSaveGeneratedFiles)) {
|
||||
return factory.serialize(editorInput.text); // serialize based on the underlying input
|
||||
@@ -143,7 +143,7 @@ export class UntitledQueryEditorInputSerializer implements IEditorInputSerialize
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledQueryEditorInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
|
||||
const factory = editorFactoryRegistry.getEditorSerializer(UntitledTextEditorInput.ID);
|
||||
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
|
||||
const queryResultsInput = instantiationService.createInstance(QueryResultsInput, untitledEditorInput.resource.toString());
|
||||
return instantiationService.createInstance(UntitledQueryEditorInput, '', untitledEditorInput, queryResultsInput);
|
||||
@@ -21,7 +21,7 @@ import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { TestFileService, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestFileService, TestTextResourceConfigurationService, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import { UntitledQueryEditorInput } from 'sql/base/query/browser/untitledQueryEditorInput';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
@@ -51,7 +51,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
|
||||
// Setup a reusable mock QueryEditor
|
||||
editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
editor.setup(x => x.input).returns(() => testQueryInput.object);
|
||||
|
||||
editor.setup(x => x.getSelection()).returns(() => undefined);
|
||||
@@ -101,7 +101,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
|
||||
// Setup a reusable mock QueryEditor
|
||||
editor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
editor.setup(x => x.input).returns(() => testQueryInput.object);
|
||||
|
||||
// If I create a QueryTaskbarAction and I pass a non-connected editor to _getConnectedQueryEditorUri
|
||||
@@ -193,7 +193,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
|
||||
// Setup a reusable mock QueryEditor
|
||||
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
queryEditor.setup(x => x.input).returns(() => queryInput.object);
|
||||
queryEditor.setup(x => x.getSelection()).returns(() => undefined);
|
||||
queryEditor.setup(x => x.getSelection(false)).returns(() => undefined);
|
||||
@@ -248,7 +248,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
|
||||
// Setup a reusable mock QueryEditor
|
||||
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Strict, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
queryEditor.setup(x => x.input).returns(() => queryInput.object);
|
||||
queryEditor.setup(x => x.isSelectionEmpty()).returns(() => false);
|
||||
queryEditor.setup(x => x.getSelection()).returns(() => {
|
||||
@@ -472,7 +472,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
|
||||
|
||||
// If I query without having initialized anything, state should be clear
|
||||
listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
|
||||
listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
|
||||
|
||||
assert.strictEqual(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
|
||||
assert.strictEqual(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
|
||||
@@ -505,7 +505,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
|
||||
|
||||
// ... Create a database dropdown that has been connected
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
|
||||
listItem.onConnected();
|
||||
|
||||
// If: I raise a connection changed event
|
||||
@@ -529,7 +529,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.changeDatabase(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())).returns(() => Promise.resolve(true));
|
||||
|
||||
// ... Create a database dropdown that has been connected
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
|
||||
listItem.onConnected();
|
||||
|
||||
// If: I raise a connection changed event for the 'wrong' URI
|
||||
@@ -554,7 +554,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
|
||||
|
||||
// ... Create a database dropdown
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, undefined, connectionManagementService.object, undefined, undefined);
|
||||
|
||||
// If: I raise a connection changed event
|
||||
let eventParams = <IConnectionParams>{
|
||||
@@ -579,7 +579,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
// mocking query editor
|
||||
const contextkeyservice = new MockContextKeyService();
|
||||
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
queryEditor.setup(x => x.input).returns(() => testQueryInput.object);
|
||||
queryEditor.setup(x => x.getSelection(false)).returns(() => { return predefinedSelection; });
|
||||
|
||||
@@ -636,7 +636,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
// mocking query editor
|
||||
const contextkeyservice = new MockContextKeyService();
|
||||
let queryEditor = TypeMoq.Mock.ofType(QueryEditor, TypeMoq.MockBehavior.Loose, undefined, new TestThemeService(),
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined);
|
||||
new TestStorageService(), contextkeyservice, undefined, new TestFileService(), undefined, undefined, undefined, undefined, undefined, new TestTextResourceConfigurationService());
|
||||
queryEditor.setup(x => x.input).returns(() => testQueryInput.object);
|
||||
|
||||
// mocking isConnected in ConnectionManagementService
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { IEditorDescriptor } from 'vs/workbench/browser/editor';
|
||||
import { IEditorPaneDescriptor } from 'vs/workbench/browser/editor';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
|
||||
@@ -64,7 +64,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => {
|
||||
if (classDef.ID) {
|
||||
if (classDef.ID === 'listDatabaseQueryActionItem') {
|
||||
return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, undefined);
|
||||
return new ListDatabasesActionItem(editor, action, undefined, connectionManagementService.object, undefined, undefined);
|
||||
}
|
||||
}
|
||||
// Default
|
||||
@@ -72,7 +72,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
});
|
||||
|
||||
// Mock EditorDescriptorService to give us a mock editor description
|
||||
let descriptor: IEditorDescriptor = {
|
||||
let descriptor: IEditorPaneDescriptor = {
|
||||
typeId: 'id',
|
||||
name: 'name',
|
||||
describes: function (obj: any): boolean { return true; },
|
||||
@@ -292,7 +292,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||
.returns((definition, editor, action, selectBox) => {
|
||||
if (definition.ID === 'listDatabaseQueryActionItem') {
|
||||
let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, undefined);
|
||||
let item = new ListDatabasesActionItem(editor, action, undefined, connectionManagementService.object, undefined, undefined);
|
||||
return item;
|
||||
}
|
||||
// Default
|
||||
|
||||
@@ -11,7 +11,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { workbenchInstantiationService } from 'sql/workbench/test/workbenchTestServices';
|
||||
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryInputFactory';
|
||||
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryEditorFactory';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { TestObjectExplorerService } from 'sql/workbench/services/objectExplorer/test/browser/testObjectExplorerService';
|
||||
|
||||
@@ -4,50 +4,49 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { QueryPlanInput } from 'sql/workbench/contrib/queryPlan/common/queryPlanInput';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { QueryPlanEditor } from 'sql/workbench/contrib/queryPlan/browser/queryPlanEditor';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { ContributedEditorPriority, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IEditorResolverService, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
// Query Plan editor registration
|
||||
|
||||
const queryPlanEditorDescriptor = EditorDescriptor.create(
|
||||
const queryPlanEditorDescriptor = EditorPaneDescriptor.create(
|
||||
QueryPlanEditor,
|
||||
QueryPlanEditor.ID,
|
||||
QueryPlanEditor.LABEL
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(queryPlanEditorDescriptor, [new SyncDescriptor(QueryPlanInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(queryPlanEditorDescriptor, [new SyncDescriptor(QueryPlanInput)]);
|
||||
|
||||
export class QueryPlanEditorOverrideContribution extends Disposable implements IWorkbenchContribution {
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IEditorOverrideService private _editorOverrideService: IEditorOverrideService
|
||||
@IEditorResolverService private _editorResolverService: IEditorResolverService
|
||||
) {
|
||||
super();
|
||||
this.registerEditorOverride();
|
||||
}
|
||||
|
||||
private registerEditorOverride(): void {
|
||||
this._editorOverrideService.registerEditor(
|
||||
this._editorResolverService.registerEditor(
|
||||
'*.sqlplan',
|
||||
{
|
||||
id: QueryPlanEditor.ID,
|
||||
label: QueryPlanEditor.LABEL,
|
||||
describes: (currentEditor) => currentEditor instanceof QueryPlanInput,
|
||||
priority: ContributedEditorPriority.builtin
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
(resource, options, group) => {
|
||||
const queryPlanInput = this._instantiationService.createInstance(QueryPlanInput, resource);
|
||||
return { editor: queryPlanInput };
|
||||
(editorInput, group) => {
|
||||
const queryPlanInput = this._instantiationService.createInstance(QueryPlanInput, editorInput.resource);
|
||||
return { editor: queryPlanInput, options: editorInput.options, group: group };
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
@@ -39,14 +39,14 @@ CommandsRegistry.registerCommand({
|
||||
}
|
||||
});
|
||||
|
||||
const resourceViewerDescriptor = EditorDescriptor.create(
|
||||
const resourceViewerDescriptor = EditorPaneDescriptor.create(
|
||||
ResourceViewerEditor,
|
||||
ResourceViewerEditor.ID,
|
||||
'ResourceViewerEditor'
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(resourceViewerDescriptor, [new SyncDescriptor(ResourceViewerInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(resourceViewerDescriptor, [new SyncDescriptor(ResourceViewerInput)]);
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ResourceViewResourcesExtensionHandler, LifecyclePhase.Ready);
|
||||
|
||||
|
||||
@@ -7,19 +7,19 @@ import { TableDesignerInput } from 'sql/workbench/browser/editor/tableDesigner/t
|
||||
import { TableDesignerEditor } from 'sql/workbench/contrib/tableDesigner/browser/tableDesignerEditor';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
|
||||
const tableDesignerDescriptor = EditorDescriptor.create(
|
||||
const tableDesignerDescriptor = EditorPaneDescriptor.create(
|
||||
TableDesignerEditor,
|
||||
TableDesignerEditor.ID,
|
||||
'TableDesignerEditor'
|
||||
);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(tableDesignerDescriptor, [new SyncDescriptor(TableDesignerInput)]);
|
||||
Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane)
|
||||
.registerEditorPane(tableDesignerDescriptor, [new SyncDescriptor(TableDesignerInput)]);
|
||||
|
||||
Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration).registerConfiguration({
|
||||
id: 'tableDesigner',
|
||||
|
||||
@@ -382,9 +382,9 @@ export class TreeView extends Disposable implements ITreeView {
|
||||
private createTree() {
|
||||
const actionViewItemProvider = (action: IAction) => {
|
||||
if (action instanceof MenuItemAction) {
|
||||
return this.instantiationService.createInstance(MenuEntryActionViewItem, action);
|
||||
return this.instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
|
||||
} else if (action instanceof SubmenuItemAction) {
|
||||
return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action);
|
||||
return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action, undefined);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
||||
@@ -30,7 +30,7 @@ import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/com
|
||||
import { tileBorder, gradientOne, gradientTwo, gradientBackground, extensionPackHeaderShadow, extensionPackGradientColorOneColor, extensionPackGradientColorTwoColor, tileBoxShadow, hoverShadow } from 'sql/platform/theme/common/colorRegistry';
|
||||
import { registerColor, foreground, textLinkActiveForeground, descriptionForeground, activeContrastBorder, buttonForeground, menuBorder, menuForeground, editorWidgetBorder, selectBackground, buttonHoverBackground, selectBorder, iconForeground, textLinkForeground, inputBackground, focusBorder, listFocusBackground, listFocusForeground, buttonSecondaryBackground, buttonSecondaryBorder, buttonDisabledForeground, buttonDisabledBackground, buttonSecondaryForeground, buttonSecondaryHoverBackground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { IEditorInputSerializer } from 'vs/workbench/common/editor';
|
||||
import { IEditorSerializer } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { TimeoutTimer } from 'vs/base/common/async';
|
||||
@@ -821,7 +821,7 @@ class WelcomePage extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
export class WelcomeInputSerializer implements IEditorInputSerializer {
|
||||
export class WelcomeInputSerializer implements IEditorSerializer {
|
||||
|
||||
static readonly ID = welcomeInputTypeId;
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ export class ConnectionBrowserView extends Disposable implements IPanelView {
|
||||
this.treeMenus = this.instantiationService.createInstance(ConnectionBrowseTreeMenuProvider);
|
||||
const actionViewItemProvider = (action: IAction) => {
|
||||
if (action instanceof MenuItemAction) {
|
||||
return this.instantiationService.createInstance(MenuEntryActionViewItem, action);
|
||||
return this.instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
@@ -368,9 +368,9 @@ export class TreeView extends Disposable implements ITreeView {
|
||||
private createTree() {
|
||||
const actionViewItemProvider = (action: IAction) => {
|
||||
if (action instanceof MenuItemAction) {
|
||||
return this.instantiationService.createInstance(MenuEntryActionViewItem, action);
|
||||
return this.instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
|
||||
} else if (action instanceof SubmenuItemAction) {
|
||||
return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action);
|
||||
return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action, undefined);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -851,7 +851,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
targetElements: [this],
|
||||
dispose: () => { }
|
||||
};
|
||||
hoverOptions = { text: tooltip, target };
|
||||
hoverOptions = { content: tooltip, target };
|
||||
}
|
||||
if (mouseX !== undefined) {
|
||||
(<IHoverTarget>hoverOptions.target).x = mouseX;
|
||||
|
||||
@@ -98,7 +98,7 @@ export class ErrorMessageDialog extends Modal {
|
||||
this.ok();
|
||||
// Run the action if possible
|
||||
if (this._actions && index < this._actions.length) {
|
||||
this._actions[index].run().catch(err => onUnexpectedError(err));
|
||||
this._actions[index].run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IWorkspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
|
||||
export interface IExtensionsConfigContent {
|
||||
recommendations: string[];
|
||||
unwantedRecommendations: string[];
|
||||
}
|
||||
|
||||
export type DynamicRecommendation = 'dynamic';
|
||||
export type ConfigRecommendation = 'config';
|
||||
export type ExecutableRecommendation = 'executable';
|
||||
export type CachedRecommendation = 'cached';
|
||||
export type ApplicationRecommendation = 'application';
|
||||
export type ExperimentalRecommendation = 'experimental';
|
||||
export type ExtensionRecommendationSource = IWorkspace | IWorkspaceFolder | URI | DynamicRecommendation | ExecutableRecommendation | CachedRecommendation | ApplicationRecommendation | ExperimentalRecommendation | ConfigRecommendation;
|
||||
|
||||
export interface IExtensionRecommendation {
|
||||
extensionId: string;
|
||||
sources: ExtensionRecommendationSource[];
|
||||
}
|
||||
@@ -7,8 +7,9 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IContentLoader } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { IStandardKernelWithProvider } from 'sql/workbench/services/notebook/browser/models/notebookUtils';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
|
||||
export interface INotebookInput {
|
||||
export interface INotebookInput extends IEditorInput {
|
||||
defaultKernel?: azdata.nb.IKernelSpec,
|
||||
connectionProfile?: azdata.IConnectionProfile,
|
||||
isDirty(): boolean;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { nb } from 'azdata';
|
||||
import { ICellModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { INotebookView } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViews';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { IEditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { IEditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor';
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -13,7 +13,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
|
||||
export interface IEditorDescriptorService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
getEditor(input: EditorInput): IEditorDescriptor | undefined;
|
||||
getEditor(input: EditorInput): IEditorPaneDescriptor | undefined;
|
||||
}
|
||||
|
||||
export class EditorDescriptorService implements IEditorDescriptorService {
|
||||
@@ -22,8 +22,8 @@ export class EditorDescriptorService implements IEditorDescriptorService {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
public getEditor(input: EditorInput): IEditorDescriptor | undefined {
|
||||
return Registry.as<IEditorRegistry>(EditorExtensions.Editors).getEditor(input);
|
||||
public getEditor(input: EditorInput): IEditorPaneDescriptor | undefined {
|
||||
return Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane).getEditorPane(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export class TestQueryEditorService implements IQueryEditorService {
|
||||
}
|
||||
|
||||
newSqlEditor(options?: INewSqlEditorOptions): Promise<IUntitledQueryEditorInput> {
|
||||
const base = this.editorService.createEditorInput({ forceUntitled: true }) as UntitledTextEditorInput;
|
||||
const base = this.editorService.createEditorInput({ resource: undefined, forceUntitled: true }) as UntitledTextEditorInput;
|
||||
return Promise.resolve(this.instantiationService.createInstance(UntitledQueryEditorInput, '', base, new QueryResultsInput(base.resource.toString(true))));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import * as assert from 'assert';
|
||||
import * as sinon from 'sinon';
|
||||
import { setMode } from 'sql/workbench/browser/parts/editor/editorStatusModeSelect';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryInputFactory';
|
||||
import { NotebookEditorInputAssociation } from 'sql/workbench/contrib/notebook/browser/models/notebookInputFactory';
|
||||
import { QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryEditorFactory';
|
||||
import { NotebookEditorLanguageAssociation } from 'sql/workbench/contrib/notebook/browser/models/notebookEditorFactory';
|
||||
import { workbenchInstantiationService } from 'sql/workbench/test/workbenchTestServices';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -45,7 +45,7 @@ suite('set mode', () => {
|
||||
|
||||
setup(() => {
|
||||
disposables.push(languageAssociations.registerLanguageAssociation(QueryEditorLanguageAssociation.languages, QueryEditorLanguageAssociation, QueryEditorLanguageAssociation.isDefault));
|
||||
disposables.push(languageAssociations.registerLanguageAssociation(NotebookEditorInputAssociation.languages, NotebookEditorInputAssociation));
|
||||
disposables.push(languageAssociations.registerLanguageAssociation(NotebookEditorLanguageAssociation.languages, NotebookEditorLanguageAssociation));
|
||||
instantiationService = workbenchInstantiationService();
|
||||
instantiationService.stub(INotebookService, new NotebookServiceStub());
|
||||
const editorService = new MockEditorService(instantiationService);
|
||||
|
||||
Reference in New Issue
Block a user