Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)

This commit is contained in:
Cory Rivera
2021-08-25 16:28:29 -07:00
committed by GitHub
parent ab1112bfb3
commit cb7b7da0a4
1752 changed files with 59525 additions and 33878 deletions

View File

@@ -7,7 +7,7 @@ import * as strings from 'vs/base/common/strings';
import * as DOM from 'vs/base/browser/dom';
import * as nls from 'vs/nls';
import { EditorOptions, EditorInput, IEditorControl, IEditorPane, IEditorOpenContext } from 'vs/workbench/common/editor';
import { IEditorControl, IEditorPane, IEditorOpenContext } from 'vs/workbench/common/editor';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -35,9 +35,12 @@ import { EditDataResultsEditor } from 'sql/workbench/contrib/editData/browser/ed
import { EditDataResultsInput } from 'sql/workbench/browser/editData/editDataResultsInput';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import { DisposableStore } from 'vs/base/common/lifecycle';
/**
* Editor that hosts an action bar and a resultSetInput for an edit data session
@@ -71,6 +74,7 @@ export class EditDataEditor extends EditorPane {
private _queryEditorVisible: IContextKey<boolean>;
private hideQueryResultsView = false;
private readonly _disposables = new DisposableStore();
constructor(
@ITelemetryService _telemetryService: ITelemetryService,
@IThemeService themeService: IThemeService,
@@ -79,7 +83,8 @@ export class EditDataEditor extends EditorPane {
@IQueryModelService private _queryModelService: IQueryModelService,
@IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService,
@IContextKeyService contextKeyService: IContextKeyService,
@IStorageService storageService: IStorageService
@IStorageService storageService: IStorageService,
@IEditorGroupsService editorGroupsService: IEditorGroupsService
) {
super(EditDataEditor.ID, _telemetryService, themeService, storageService);
@@ -87,18 +92,28 @@ export class EditDataEditor extends EditorPane {
this._queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
}
if (_editorService) {
_editorService.overrideOpenEditor({
open: (editor, options, group) => {
if (this.isVisible() && (editor !== this.input || group !== this.group)) {
this.saveEditorViewState();
}
return {};
}
});
if (editorGroupsService) {
// Add all the initial groups to be listened to
editorGroupsService.whenReady.then(() => editorGroupsService.groups.forEach(group => {
this.registerGroupListener(group);
}));
// Additional groups added should also be listened to
this._register(editorGroupsService.onDidAddGroup((group) => this.registerGroupListener(group)));
this._register(this._disposables);
}
}
private registerGroupListener(group: IEditorGroup): void {
const listener = group.onWillOpenEditor(e => {
if (this.isVisible() && (e.editor !== this.input || group !== this.group)) {
this.saveEditorViewState();
}
});
this._disposables.add(listener);
}
// PUBLIC METHODS ////////////////////////////////////////////////////////////
// Getters and Setters
@@ -214,7 +229,7 @@ export class EditDataEditor extends EditorPane {
/**
* Sets the input data for this editor.
*/
public override setInput(newInput: EditDataInput, options?: EditorOptions, context?: IEditorOpenContext): Promise<void> {
public override setInput(newInput: EditDataInput, options?: IEditorOptions, context?: IEditorOpenContext): Promise<void> {
let oldInput = <EditDataInput>this.input;
if (!newInput.setup) {
this._initialized = false;
@@ -492,7 +507,7 @@ export class EditDataEditor extends EditorPane {
/**
* Sets input for the results editor after it has been created.
*/
private _onResultsEditorCreated(resultsEditor: EditDataResultsEditor, resultsInput: EditDataResultsInput, options: EditorOptions): Promise<void> {
private _onResultsEditorCreated(resultsEditor: EditDataResultsEditor, resultsInput: EditDataResultsInput, options: IEditorOptions): Promise<void> {
this._resultsEditor = resultsEditor;
return this._resultsEditor.setInput(resultsInput, options, undefined);
}
@@ -500,7 +515,7 @@ export class EditDataEditor extends EditorPane {
/**
* Sets input for the SQL editor after it has been created.
*/
private _onSqlEditorCreated(sqlEditor: TextResourceEditor, sqlInput: UntitledTextEditorInput, options: EditorOptions): Thenable<void> {
private _onSqlEditorCreated(sqlEditor: TextResourceEditor, sqlInput: UntitledTextEditorInput, options: IEditorOptions): Thenable<void> {
this._sqlEditor = sqlEditor;
return this._sqlEditor.setInput(sqlInput, options, undefined, CancellationToken.None);
}
@@ -520,7 +535,7 @@ export class EditDataEditor extends EditorPane {
* - Opened for the first time
* - Opened with a new EditDataInput
*/
private _setNewInput(newInput: EditDataInput, options?: EditorOptions): Promise<any> {
private _setNewInput(newInput: EditDataInput, options?: IEditorOptions): Promise<any> {
// Promises that will ensure proper ordering of editor creation logic
let createEditors: () => Promise<any>;
@@ -606,7 +621,7 @@ export class EditDataEditor extends EditorPane {
* Handles setting input for this editor. If this new input does not match the old input (e.g. a new file
* has been opened with the same editor, or we are opening the editor for the first time).
*/
private _updateInput(oldInput: EditDataInput, newInput: EditDataInput, options?: EditorOptions): Promise<void> {
private _updateInput(oldInput: EditDataInput, newInput: EditDataInput, options?: IEditorOptions): Promise<void> {
if (this._sqlEditor) {
this._sqlEditor.clearInput();
}

View File

@@ -30,7 +30,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { EditUpdateCellResult } from 'azdata';
import { ILogService } from 'vs/platform/log/common/log';
import { deepClone, assign } from 'vs/base/common/objects';
import { deepClone } from 'vs/base/common/objects';
import { Event } from 'vs/base/common/event';
import { equals } from 'vs/base/common/arrays';
import * as DOM from 'vs/base/browser/dom';
@@ -362,7 +362,7 @@ export class EditDataGridPanel extends GridParentComponent {
async handleResultSet(self: EditDataGridPanel, event: any): Promise<void> {
// Clone the data before altering it to avoid impacting other subscribers
let resultSet = assign({}, event.data);
let resultSet = Object.assign({}, event.data);
if (!resultSet.complete) {
return;
}

View File

@@ -5,7 +5,7 @@
import * as DOM from 'vs/base/browser/dom';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
import { IEditorOpenContext } from 'vs/workbench/common/editor';
import { getZoomLevel } from 'vs/base/browser/browser';
import { Configuration } from 'vs/editor/browser/config/configuration';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -20,6 +20,7 @@ import { EditDataGridPanel } from 'sql/workbench/contrib/editData/browser/editDa
import { EditDataResultsInput } from 'sql/workbench/browser/editData/editDataResultsInput';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
export class EditDataResultsEditor extends EditorPane {
@@ -63,7 +64,7 @@ export class EditDataResultsEditor extends EditorPane {
public layout(dimension: DOM.Dimension): void {
}
public override setInput(input: EditDataResultsInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
public override setInput(input: EditDataResultsInput, options: IEditorOptions, context: IEditorOpenContext): Promise<void> {
super.setInput(input, options, context, CancellationToken.None);
this._applySettings();
if (!input.hasBootstrapped) {