mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 17:23:02 -05:00
Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 (#15681)
* Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 * Fixes and cleanup * Distro * Fix hygiene yarn * delete no yarn lock changes file * Fix hygiene * Fix layer check * Fix CI * Skip lib checks * Remove tests deleted in vs code * Fix tests * Distro * Fix tests and add removed extension point * Skip failing notebook tests for now * Disable broken tests and cleanup build folder * Update yarn.lock and fix smoke tests * Bump sqlite * fix contributed actions and file spacing * Fix user data path * Update yarn.locks Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
@@ -19,10 +19,10 @@ import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { getErrorMessage } from 'vs/base/common/errors';
|
||||
import { SaveFormat } from 'sql/workbench/services/query/common/resultSerializer';
|
||||
import { IExtensionRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
||||
import { IEncodingSupport } from 'vs/workbench/common/editor';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { getChartMaxRowCount, notifyMaxRowCountExceeded } from 'sql/workbench/contrib/charts/browser/utils';
|
||||
import { IEncodingSupport } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
|
||||
export interface IGridActionContext {
|
||||
gridDataProvider: IGridDataProvider;
|
||||
@@ -71,7 +71,7 @@ export class SaveResultAction extends Action {
|
||||
super(id, label, icon);
|
||||
}
|
||||
|
||||
public async run(context: IGridActionContext): Promise<void> {
|
||||
public override async run(context: IGridActionContext): Promise<void> {
|
||||
|
||||
const activeEditor = this.editorService.activeEditorPane as unknown as IEncodingSupport;
|
||||
if (typeof activeEditor.getEncoding === 'function' && activeEditor.getEncoding() !== 'utf8') {
|
||||
@@ -111,7 +111,7 @@ export class CopyResultAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public async run(context: IGridActionContext): Promise<void> {
|
||||
public override async run(context: IGridActionContext): Promise<void> {
|
||||
const selection = this.accountForNumberColumn ? mapForNumberColumn(context.selection) : context.selection;
|
||||
await context.gridDataProvider.copyResults(selection, this.copyHeader, context.table.getData());
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export class SelectAllGridAction extends Action {
|
||||
super(SelectAllGridAction.ID, SelectAllGridAction.LABEL);
|
||||
}
|
||||
|
||||
public async run(context: IGridActionContext): Promise<void> {
|
||||
public override async run(context: IGridActionContext): Promise<void> {
|
||||
context.selectionModel.setSelectedRanges([new Slick.Range(0, 0, context.table.getData().getLength() - 1, context.table.columns.length - 1)]);
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ export class MaximizeTableAction extends Action {
|
||||
super(MaximizeTableAction.ID, MaximizeTableAction.LABEL, MaximizeTableAction.ICON);
|
||||
}
|
||||
|
||||
public async run(context: IGridActionContext): Promise<void> {
|
||||
public override async run(context: IGridActionContext): Promise<void> {
|
||||
context.tableState.maximized = true;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ export class RestoreTableAction extends Action {
|
||||
super(RestoreTableAction.ID, RestoreTableAction.LABEL, RestoreTableAction.ICON);
|
||||
}
|
||||
|
||||
public async run(context: IGridActionContext): Promise<void> {
|
||||
public override async run(context: IGridActionContext): Promise<void> {
|
||||
context.tableState.maximized = false;
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ export class ChartDataAction extends Action {
|
||||
super(ChartDataAction.ID, ChartDataAction.LABEL, ChartDataAction.ICON);
|
||||
}
|
||||
|
||||
public async run(context: IGridActionContext): Promise<void> {
|
||||
public override async run(context: IGridActionContext): Promise<void> {
|
||||
// show the visualizer extension recommendation notification
|
||||
this.extensionTipsService.promptRecommendedExtensionsByScenario(Constants.visualizerExtensions);
|
||||
const maxRowCount = getChartMaxRowCount(this.configurationService);
|
||||
@@ -206,7 +206,7 @@ export class VisualizerDataAction extends Action {
|
||||
super(VisualizerDataAction.ID, VisualizerDataAction.LABEL, VisualizerDataAction.ICON);
|
||||
}
|
||||
|
||||
public async run(context: IGridActionContext): Promise<void> {
|
||||
public override async run(context: IGridActionContext): Promise<void> {
|
||||
this.adsTelemetryService.sendActionEvent(
|
||||
TelemetryKeys.TelemetryView.ResultsPanel,
|
||||
TelemetryKeys.TelemetryAction.Click,
|
||||
|
||||
@@ -185,7 +185,7 @@ export class ChangeFlavorAction extends Action {
|
||||
super(actionId, actionLabel);
|
||||
}
|
||||
|
||||
public run(): Promise<any> {
|
||||
public override run(): Promise<any> {
|
||||
let activeEditor = this._editorService.activeEditorPane;
|
||||
let currentUri = activeEditor?.input.resource?.toString(true);
|
||||
if (this._connectionManagementService.isConnected(currentUri)) {
|
||||
|
||||
@@ -311,7 +311,7 @@ export class GridPanel extends Disposable {
|
||||
return this._state;
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
public override dispose() {
|
||||
dispose(this.tables);
|
||||
this.tables = undefined;
|
||||
super.dispose();
|
||||
@@ -692,7 +692,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
||||
let content = value.displayValue;
|
||||
|
||||
const input = this.untitledEditorService.create({ mode: column.isXml ? 'xml' : 'json', initialValue: content });
|
||||
await input.load();
|
||||
await input.resolve();
|
||||
await this.instantiationService.invokeFunction(formatDocumentWithSelectedProvider, input.textEditorModel, FormattingMode.Explicit, Progress.None, CancellationToken.None);
|
||||
return this.editorService.openEditor(input);
|
||||
});
|
||||
@@ -852,7 +852,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
||||
}
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
public override dispose() {
|
||||
this.container.remove();
|
||||
if (this.table) {
|
||||
this.table.dispose();
|
||||
|
||||
@@ -153,7 +153,7 @@ export class GridTable<T> extends Disposable implements IView {
|
||||
return Math.max(this.maxSize, BOTTOM_PADDING);
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
public override dispose() {
|
||||
this.element.remove();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ export class FocusOnCurrentQueryKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): Promise<void> {
|
||||
public override run(): Promise<void> {
|
||||
const editor = this._editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor) {
|
||||
editor.focus();
|
||||
@@ -99,7 +99,7 @@ export class RunQueryKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): Promise<void> {
|
||||
public override run(): Promise<void> {
|
||||
const editor = this._editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor || editor instanceof EditDataEditor) {
|
||||
editor.runQuery();
|
||||
@@ -124,7 +124,7 @@ export class RunCurrentQueryKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): Promise<void> {
|
||||
public override run(): Promise<void> {
|
||||
const editor = this._editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor) {
|
||||
editor.runCurrentQuery();
|
||||
@@ -185,7 +185,7 @@ export class CopyQueryWithResultsKeyboardAction extends Action {
|
||||
return { text: allResults, html: allHtmlResults };
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
const editor = this._editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor) {
|
||||
let allResults = await this.getFormattedResults(editor);
|
||||
@@ -219,7 +219,7 @@ export class RunCurrentQueryWithActualPlanKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): Promise<void> {
|
||||
public override run(): Promise<void> {
|
||||
const editor = this._editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor) {
|
||||
editor.runCurrentQueryWithActualPlan();
|
||||
@@ -245,7 +245,7 @@ export class CancelQueryKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): Promise<void> {
|
||||
public override run(): Promise<void> {
|
||||
const editor = this._editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor || editor instanceof EditDataEditor) {
|
||||
editor.cancelQuery();
|
||||
@@ -271,7 +271,7 @@ export class RefreshIntellisenseKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): Promise<void> {
|
||||
public override run(): Promise<void> {
|
||||
const editor = this.editorService.activeEditor;
|
||||
if (editor instanceof QueryEditorInput) {
|
||||
this.connectionManagementService.rebuildIntelliSenseCache(editor.uri);
|
||||
@@ -297,7 +297,7 @@ export class ToggleQueryResultsKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): Promise<void> {
|
||||
public override run(): Promise<void> {
|
||||
const editor = this._editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor) {
|
||||
editor.toggleResultsEditorVisibility();
|
||||
@@ -324,7 +324,7 @@ export class ToggleFocusBetweenQueryEditorAndResultsAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
const editor = this._editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor) {
|
||||
editor.toggleFocusBetweenQueryEditorAndResults();
|
||||
@@ -348,7 +348,7 @@ export class RunQueryShortcutAction extends Action {
|
||||
super(RunQueryShortcutAction.ID);
|
||||
}
|
||||
|
||||
public run(index: number): Promise<void> {
|
||||
public override run(index: number): Promise<void> {
|
||||
let promise: Thenable<void> = Promise.resolve(null);
|
||||
runActionOnActiveQueryEditor(this.editorService, (editor) => {
|
||||
promise = this.runQueryShortcut(editor, index);
|
||||
@@ -508,7 +508,7 @@ export class ParseSyntaxAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): Promise<void> {
|
||||
public override run(): Promise<void> {
|
||||
const editor = this.editorService.activeEditorPane;
|
||||
if (editor instanceof QueryEditor) {
|
||||
if (!editor.isSelectionEmpty()) {
|
||||
|
||||
@@ -236,7 +236,7 @@ export class MessagePanel extends Disposable {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
public override dispose() {
|
||||
if (this.container) {
|
||||
this.container.remove();
|
||||
this.container = undefined;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
|
||||
import { EditorDescriptor, IEditorRegistry } 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 } fr
|
||||
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 { IEditorInputFactoryRegistry, Extensions as EditorInputFactoryExtensions } from 'vs/workbench/common/editor';
|
||||
import { EditorExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/common/fileQueryEditorInput';
|
||||
import { FileQueryEditorInputFactory, UntitledQueryEditorInputFactory, QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryInputFactory';
|
||||
import { FileQueryEditorInputSerializer, UntitledQueryEditorInputSerializer, QueryEditorLanguageAssociation } from 'sql/workbench/contrib/query/browser/queryInputFactory';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/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';
|
||||
@@ -46,11 +46,11 @@ 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>(EditorInputFactoryExtensions.EditorInputFactories)
|
||||
.registerEditorInputFactory(FileQueryEditorInput.ID, FileQueryEditorInputFactory);
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
|
||||
.registerEditorInputSerializer(FileQueryEditorInput.ID, FileQueryEditorInputSerializer);
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorInputFactoryExtensions.EditorInputFactories)
|
||||
.registerEditorInputFactory(UntitledQueryEditorInput.ID, UntitledQueryEditorInputFactory);
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)
|
||||
.registerEditorInputSerializer(UntitledQueryEditorInput.ID, UntitledQueryEditorInputSerializer);
|
||||
|
||||
Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.LanguageAssociations)
|
||||
.registerLanguageAssociation(QueryEditorLanguageAssociation.languages, QueryEditorLanguageAssociation, QueryEditorLanguageAssociation.isDefault);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import 'vs/css!./media/queryActions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { Action, IActionViewItem, IActionRunner } from 'vs/base/common/actions';
|
||||
import { Action, 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';
|
||||
@@ -45,6 +45,7 @@ import { IQueryManagementService } from 'sql/workbench/services/query/common/que
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { getErrorMessage, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
|
||||
/**
|
||||
* Action class that query-based Actions will extend. This base class automatically handles activating and
|
||||
@@ -65,11 +66,6 @@ export abstract class QueryTaskbarAction extends Action {
|
||||
this._setCssClass(enabledClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is executed when the button is clicked.
|
||||
*/
|
||||
public abstract run(): Promise<void>;
|
||||
|
||||
protected updateCssClass(enabledClass: string): void {
|
||||
// set the class, useful on change of label or icon
|
||||
this._setCssClass(enabledClass);
|
||||
@@ -207,7 +203,7 @@ export class RunQueryAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('runQueryLabel', "Run");
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
if (!this.editor.isSelectionEmpty()) {
|
||||
if (this.isConnected(this.editor)) {
|
||||
// If we are already connected, run the query
|
||||
@@ -279,7 +275,7 @@ export class CancelQueryAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('cancelQueryLabel', "Cancel");
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
if (this.isConnected(this.editor)) {
|
||||
if (!this.editor.input) {
|
||||
this.logService.error('editor input was null');
|
||||
@@ -306,7 +302,7 @@ export class EstimatedQueryPlanAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('estimatedQueryPlan', "Explain");
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
if (!this.editor.isSelectionEmpty()) {
|
||||
if (this.isConnected(this.editor)) {
|
||||
// If we are already connected, run the query
|
||||
@@ -345,7 +341,7 @@ export class ActualQueryPlanAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('actualQueryPlan', "Actual");
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
if (!this.editor.isSelectionEmpty()) {
|
||||
if (this.isConnected(this.editor)) {
|
||||
// If we are already connected, run the query
|
||||
@@ -392,7 +388,7 @@ export class DisconnectDatabaseAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('disconnectDatabaseLabel', "Disconnect");
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
// Call disconnectEditor regardless of the connection state and let the ConnectionManagementService
|
||||
// determine if we need to disconnect, cancel an in-progress conneciton, or do nothing
|
||||
this.connectionManagementService.disconnectEditor(this.editor.input);
|
||||
@@ -430,7 +426,7 @@ export class ConnectDatabaseAction extends QueryTaskbarAction {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
this.connectEditor(this.editor);
|
||||
return;
|
||||
}
|
||||
@@ -478,7 +474,7 @@ export class ToggleConnectDatabaseAction extends QueryTaskbarAction {
|
||||
}
|
||||
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
if (!this.editor.input.isSharedSession) {
|
||||
if (this.connected) {
|
||||
// Call disconnectEditor regardless of the connection state and let the ConnectionManagementService
|
||||
@@ -509,7 +505,7 @@ export class ListDatabasesAction extends QueryTaskbarAction {
|
||||
this.class = ListDatabasesAction.EnabledClass;
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -551,7 +547,7 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction {
|
||||
this.isSqlCmdMode ? this.updateCssClass(ToggleSqlCmdModeAction.DisableSqlcmdClass) : this.updateCssClass(ToggleSqlCmdModeAction.EnableSqlcmdClass);
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
const toSqlCmdState = !this.isSqlCmdMode; // input.state change triggers event that changes this.isSqlCmdMode, so store it before using
|
||||
this.editor.input.state.isSqlCmdMode = toSqlCmdState;
|
||||
|
||||
@@ -844,7 +840,7 @@ export class ExportAsNotebookAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('queryEditor.exportSqlAsNotebook', "Export as Notebook");
|
||||
}
|
||||
|
||||
public async run(): Promise<void> {
|
||||
public override async run(): Promise<void> {
|
||||
this._commandService.executeCommand('mssql.exportSqlAsNotebook', this.editor.input.uri);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor
|
||||
import { SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IActionViewItem, IAction } from 'vs/base/common/actions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
@@ -39,6 +39,7 @@ import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
import * as actions from 'sql/workbench/contrib/query/browser/queryActions';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
|
||||
const QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'queryEditorViewState';
|
||||
|
||||
@@ -121,12 +122,12 @@ export class QueryEditor extends EditorPane {
|
||||
}
|
||||
}
|
||||
|
||||
protected getEditorMemento<T>(editorGroupService: IEditorGroupsService, key: string, limit: number = 10): IEditorMemento<T> {
|
||||
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
|
||||
}
|
||||
|
||||
// PUBLIC METHODS ////////////////////////////////////////////////////////////
|
||||
public get input(): QueryEditorInput | null {
|
||||
public override get input(): QueryEditorInput | null {
|
||||
return this._input as QueryEditorInput;
|
||||
}
|
||||
|
||||
@@ -320,7 +321,7 @@ export class QueryEditor extends EditorPane {
|
||||
this.taskbar.setContent(content);
|
||||
}
|
||||
|
||||
public async setInput(newInput: QueryEditorInput, options: EditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
public override async setInput(newInput: QueryEditorInput, options: EditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
const oldInput = this.input;
|
||||
|
||||
if (newInput.matches(oldInput)) {
|
||||
@@ -402,7 +403,7 @@ export class QueryEditor extends EditorPane {
|
||||
return this.group ? this.editorMemento.loadEditorState(this.group, resource) : undefined;
|
||||
}
|
||||
|
||||
protected saveState(): void {
|
||||
protected override saveState(): void {
|
||||
|
||||
// Update/clear editor view State
|
||||
this.saveQueryEditorViewState(this.input);
|
||||
@@ -421,7 +422,7 @@ export class QueryEditor extends EditorPane {
|
||||
/**
|
||||
* Sets this editor and the 2 sub-editors to visible.
|
||||
*/
|
||||
public setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
public override setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
this.textFileEditor.setVisible(visible, group);
|
||||
this.textResourceEditor.setVisible(visible, group);
|
||||
this.resultsEditor.setVisible(visible, group);
|
||||
@@ -454,7 +455,7 @@ export class QueryEditor extends EditorPane {
|
||||
* Called to indicate to the editor that the input should be cleared and resources associated with the
|
||||
* input should be freed.
|
||||
*/
|
||||
public clearInput(): void {
|
||||
public override clearInput(): void {
|
||||
|
||||
this.saveQueryEditorViewState(this.input);
|
||||
|
||||
@@ -466,7 +467,7 @@ export class QueryEditor extends EditorPane {
|
||||
/**
|
||||
* Sets focus on this editor. Specifically, it sets the focus on the hosted text editor.
|
||||
*/
|
||||
public focus(): void {
|
||||
public override focus(): void {
|
||||
this.currentTextEditor.focus();
|
||||
}
|
||||
|
||||
@@ -492,11 +493,11 @@ export class QueryEditor extends EditorPane {
|
||||
/**
|
||||
* Returns the editor control for the text editor.
|
||||
*/
|
||||
public getControl(): IEditorControl {
|
||||
public override getControl(): IEditorControl {
|
||||
return this.currentTextEditor.getControl();
|
||||
}
|
||||
|
||||
public setOptions(options: EditorOptions): void {
|
||||
public override setOptions(options: EditorOptions): void {
|
||||
this.currentTextEditor.setOptions(options);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEditorInputFactory, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IEditorInputFactoryRegistry, IEditorInput, IEditorInputSerializer, 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>(EditorInputExtensions.EditorInputFactories);
|
||||
const editorInputFactoryRegistry = Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories);
|
||||
|
||||
export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
static readonly isDefault = true;
|
||||
@@ -47,7 +47,7 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
queryEditorInput = this.instantiationService.createInstance(FileQueryEditorInput, '', activeEditor, queryResultsInput);
|
||||
} else if (activeEditor instanceof UntitledTextEditorInput) {
|
||||
const content = (await activeEditor.resolve()).textEditorModel.getValue();
|
||||
queryEditorInput = await this.queryEditorService.newSqlEditor({ resource: this.editorService.isOpen(activeEditor) ? activeEditor.resource : undefined, open: false, initalContent: content }) as UntitledQueryEditorInput;
|
||||
queryEditorInput = await this.queryEditorService.newSqlEditor({ resource: this.editorService.isOpened(activeEditor) ? activeEditor.resource : undefined, open: false, initalContent: content }) as UntitledQueryEditorInput;
|
||||
}
|
||||
|
||||
const profile = getCurrentGlobalConnection(this.objectExplorerService, this.connectionManagementService, this.editorService);
|
||||
@@ -96,13 +96,13 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
}
|
||||
}
|
||||
|
||||
export class FileQueryEditorInputFactory implements IEditorInputFactory {
|
||||
export class FileQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
|
||||
constructor(@IFileService private readonly fileService: IFileService) {
|
||||
|
||||
}
|
||||
serialize(editorInput: FileQueryEditorInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(FILE_EDITOR_INPUT_ID);
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(FILE_EDITOR_INPUT_ID);
|
||||
if (factory) {
|
||||
return factory.serialize(editorInput.text); // serialize based on the underlying input
|
||||
}
|
||||
@@ -110,7 +110,7 @@ export class FileQueryEditorInputFactory implements IEditorInputFactory {
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileQueryEditorInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(FILE_EDITOR_INPUT_ID);
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(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)) {
|
||||
@@ -127,11 +127,11 @@ export class FileQueryEditorInputFactory implements IEditorInputFactory {
|
||||
}
|
||||
}
|
||||
|
||||
export class UntitledQueryEditorInputFactory implements IEditorInputFactory {
|
||||
export class UntitledQueryEditorInputSerializer implements IEditorInputSerializer {
|
||||
|
||||
constructor(@IConfigurationService private readonly configurationService: IConfigurationService) { }
|
||||
serialize(editorInput: UntitledQueryEditorInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(UntitledTextEditorInput.ID);
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(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
|
||||
@@ -140,7 +140,7 @@ export class UntitledQueryEditorInputFactory implements IEditorInputFactory {
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledQueryEditorInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(UntitledTextEditorInput.ID);
|
||||
const factory = editorInputFactoryRegistry.getEditorInputSerializer(UntitledTextEditorInput.ID);
|
||||
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
|
||||
const queryResultsInput = instantiationService.createInstance(QueryResultsInput, untitledEditorInput.resource.toString());
|
||||
return instantiationService.createInstance(UntitledQueryEditorInput, '', untitledEditorInput, queryResultsInput);
|
||||
|
||||
@@ -25,7 +25,7 @@ export const TextCompareEditorVisible = new RawContextKey<boolean>('textCompareE
|
||||
|
||||
export class BareResultsGridInfo extends BareFontInfo {
|
||||
|
||||
public static createFromRawSettings(opts: {
|
||||
public static override createFromRawSettings(opts: {
|
||||
fontFamily?: string;
|
||||
fontWeight?: string;
|
||||
fontSize?: number;
|
||||
@@ -96,7 +96,7 @@ export class QueryResultsEditor extends EditorPane {
|
||||
this.applySettings();
|
||||
}
|
||||
|
||||
public get input(): QueryResultsInput {
|
||||
public override get input(): QueryResultsInput {
|
||||
return this._input as QueryResultsInput;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ export class QueryResultsEditor extends EditorPane {
|
||||
}
|
||||
}
|
||||
|
||||
dispose() {
|
||||
override dispose() {
|
||||
this.styleSheet.remove();
|
||||
this.styleSheet = undefined;
|
||||
super.dispose();
|
||||
@@ -130,13 +130,13 @@ export class QueryResultsEditor extends EditorPane {
|
||||
this.resultsView.layout(dimension);
|
||||
}
|
||||
|
||||
setInput(input: QueryResultsInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
override setInput(input: QueryResultsInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
super.setInput(input, options, context, CancellationToken.None);
|
||||
this.resultsView.input = input;
|
||||
return Promise.resolve<void>(null);
|
||||
}
|
||||
|
||||
clearInput() {
|
||||
override clearInput() {
|
||||
this.resultsView.clearInput();
|
||||
super.clearInput();
|
||||
}
|
||||
@@ -153,7 +153,7 @@ export class QueryResultsEditor extends EditorPane {
|
||||
this.resultsView.registerQueryModelViewTab(title, componentId);
|
||||
}
|
||||
|
||||
public focus(): void {
|
||||
public override focus(): void {
|
||||
this.resultsView.focus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ export class QueryResultsView extends Disposable {
|
||||
this.dynamicModelViewTabs = [];
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
public override dispose() {
|
||||
this.runnerDisposables.dispose();
|
||||
this.runnerDisposables = new DisposableStore();
|
||||
super.dispose();
|
||||
|
||||
@@ -10,9 +10,9 @@ import { IQueryModelService } from 'sql/workbench/services/query/common/queryMod
|
||||
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { EncodingMode, IMoveResult, GroupIdentifier } from 'vs/workbench/common/editor';
|
||||
import { IMoveResult, GroupIdentifier } from 'vs/workbench/common/editor';
|
||||
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
|
||||
import { ITextFileEditorModel } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { EncodingMode, ITextFileEditorModel } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export class FileQueryEditorInput extends QueryEditorInput {
|
||||
@@ -30,15 +30,15 @@ export class FileQueryEditorInput extends QueryEditorInput {
|
||||
super(description, text, results, connectionManagementService, queryModelService, configurationService);
|
||||
}
|
||||
|
||||
public resolve(): Promise<ITextFileEditorModel | BinaryEditorModel> {
|
||||
public override resolve(): Promise<ITextFileEditorModel | BinaryEditorModel> {
|
||||
return this.text.resolve();
|
||||
}
|
||||
|
||||
public get text(): FileEditorInput {
|
||||
public override get text(): FileEditorInput {
|
||||
return this._text as FileEditorInput;
|
||||
}
|
||||
|
||||
public getTypeId(): string {
|
||||
override get typeId(): string {
|
||||
return FileQueryEditorInput.ID;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export class FileQueryEditorInput extends QueryEditorInput {
|
||||
return this.text.isResolved();
|
||||
}
|
||||
|
||||
public rename(group: GroupIdentifier, target: URI): IMoveResult {
|
||||
public override rename(group: GroupIdentifier, target: URI): IMoveResult {
|
||||
return this.text.rename(group, target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ suite('Query Input Factory', () => {
|
||||
const untitledService = instantiationService.invokeFunction(accessor => accessor.get(IUntitledTextEditorService));
|
||||
const queryeditorservice = instantiationService.invokeFunction(accessor => accessor.get(IQueryEditorService));
|
||||
const input = instantiationService.createInstance(UntitledTextEditorInput, untitledService.create());
|
||||
sinon.stub(editorService, 'isOpen', (editor: IEditorInput) => extUri.isEqual(editor.resource, input.resource));
|
||||
sinon.stub(editorService, 'isOpened', (editor: IEditorInput) => extUri.isEqual(editor.resource, input.resource));
|
||||
const newsqlEditorStub = sinon.stub(queryeditorservice, 'newSqlEditor', () => {
|
||||
const untitledInput = instantiationService.createInstance(UntitledTextEditorInput, untitledService.create());
|
||||
const queryResultsInput: QueryResultsInput = instantiationService.createInstance(QueryResultsInput, untitledInput.resource.toString());
|
||||
@@ -171,7 +171,7 @@ class ServiceAccessor {
|
||||
|
||||
class MockEditorService extends TestEditorService {
|
||||
private __activeEditor: IEditorInput | undefined = undefined;
|
||||
public get activeEditor(): IEditorInput | undefined {
|
||||
public override get activeEditor(): IEditorInput | undefined {
|
||||
return this.__activeEditor;
|
||||
}
|
||||
|
||||
@@ -188,14 +188,14 @@ class MockEditorService extends TestEditorService {
|
||||
}
|
||||
|
||||
class MockObjectExplorerService extends TestObjectExplorerService {
|
||||
public getSelectedProfileAndDatabase(): { profile: ConnectionProfile, databaseName: string } {
|
||||
public override getSelectedProfileAndDatabase(): { profile: ConnectionProfile, databaseName: string } {
|
||||
return {
|
||||
profile: <ConnectionProfile>{}, // Not actually used so fine to cast
|
||||
databaseName: ''
|
||||
};
|
||||
}
|
||||
|
||||
public isFocused(): boolean {
|
||||
public override isFocused(): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -204,16 +204,16 @@ class MockConnectionManagementService extends TestConnectionManagementService {
|
||||
|
||||
public numberConnects = 0;
|
||||
|
||||
public isProfileConnected(connectionProfile: IConnectionProfile): boolean {
|
||||
public override isProfileConnected(connectionProfile: IConnectionProfile): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
public connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
|
||||
public override connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
|
||||
this.numberConnects++;
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
public getConnectionProfile(fileUri: string): IConnectionProfile {
|
||||
public override getConnectionProfile(fileUri: string): IConnectionProfile {
|
||||
return <IConnectionProfile>{}; // Not actually used so fine to cast
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user