mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 17:23:25 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { QueryEditorInput } from 'sql/workbench/common/editor/query/queryEditorInput';
|
||||
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
|
||||
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IMoveResult, GroupIdentifier } from 'vs/workbench/common/editor';
|
||||
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
|
||||
import { EncodingMode, ITextFileEditorModel } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export class FileQueryEditorInput extends QueryEditorInput {
|
||||
|
||||
public static readonly ID = 'workbench.editorInput.fileQueryInput';
|
||||
|
||||
constructor(
|
||||
description: string,
|
||||
text: FileEditorInput,
|
||||
results: QueryResultsInput,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@IQueryModelService queryModelService: IQueryModelService,
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
) {
|
||||
super(description, text, results, connectionManagementService, queryModelService, configurationService);
|
||||
}
|
||||
|
||||
public override resolve(): Promise<ITextFileEditorModel | BinaryEditorModel> {
|
||||
return this.text.resolve();
|
||||
}
|
||||
|
||||
public override get text(): FileEditorInput {
|
||||
return this._text as FileEditorInput;
|
||||
}
|
||||
|
||||
override get typeId(): string {
|
||||
return FileQueryEditorInput.ID;
|
||||
}
|
||||
|
||||
public getEncoding(): string {
|
||||
return this.text.getEncoding();
|
||||
}
|
||||
|
||||
public setEncoding(encoding: string, mode: EncodingMode) {
|
||||
this.text.setEncoding(encoding, mode);
|
||||
}
|
||||
|
||||
public getPreferredEncoding(): string {
|
||||
return this.text.getPreferredEncoding();
|
||||
}
|
||||
|
||||
public setPreferredEncoding(encoding: string) {
|
||||
this.text.setPreferredEncoding(encoding);
|
||||
}
|
||||
|
||||
public getPreferredMode(): string {
|
||||
return this.text.getPreferredMode();
|
||||
}
|
||||
|
||||
public setMode(mode: string) {
|
||||
this.text.setMode(mode);
|
||||
}
|
||||
|
||||
public setPreferredMode(mode: string) {
|
||||
this.text.setPreferredMode(mode);
|
||||
}
|
||||
|
||||
public setForceOpenAsText() {
|
||||
this.text.setForceOpenAsText();
|
||||
}
|
||||
|
||||
public setForceOpenAsBinary() {
|
||||
this.text.setForceOpenAsBinary();
|
||||
}
|
||||
|
||||
public isResolved(): boolean {
|
||||
return this.text.isResolved();
|
||||
}
|
||||
|
||||
public override rename(group: GroupIdentifier, target: URI): IMoveResult {
|
||||
return this.text.rename(group, target);
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,7 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
private statusItem: IStatusbarEntryAccessor;
|
||||
|
||||
private _sqlStatusEditors: { [editorUri: string]: SqlProviderEntry };
|
||||
private readonly name = nls.localize('status.query.flavor', "SQL Language Flavor");
|
||||
|
||||
constructor(
|
||||
@IStatusbarService private readonly statusbarService: IStatusbarService,
|
||||
@@ -73,12 +74,12 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
|
||||
this.statusItem = this._register(
|
||||
this.statusbarService.addEntry({
|
||||
name: this.name,
|
||||
text: nls.localize('changeProvider', "Change SQL language provider"),
|
||||
ariaLabel: nls.localize('changeProvider', "Change SQL language provider"),
|
||||
command: 'sql.action.editor.changeProvider'
|
||||
},
|
||||
SqlFlavorStatusbarItem.ID,
|
||||
nls.localize('status.query.flavor', "SQL Language Flavor"),
|
||||
StatusbarAlignment.RIGHT, 100)
|
||||
);
|
||||
|
||||
@@ -160,7 +161,8 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
|
||||
private updateFlavorElement(text: string): void {
|
||||
const props: IStatusbarEntry = {
|
||||
text,
|
||||
name: this.name,
|
||||
text: text,
|
||||
ariaLabel: text,
|
||||
command: 'sql.action.editor.changeProvider'
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { WorkbenchDataTree } from 'vs/platform/list/browser/listService';
|
||||
import { isArray, isString } from 'vs/base/common/types';
|
||||
import { Disposable, DisposableStore, dispose } from 'vs/base/common/lifecycle';
|
||||
import { $, Dimension, createStyleSheet, addStandardDisposableGenericMouseDownListner, toggleClass } from 'vs/base/browser/dom';
|
||||
import { $, Dimension, createStyleSheet, addStandardDisposableGenericMouseDownListner } from 'vs/base/browser/dom';
|
||||
import { resultsErrorColor } from 'sql/platform/theme/common/colors';
|
||||
import { CachedListVirtualDelegate, IIdentityProvider } from 'vs/base/browser/ui/list/list';
|
||||
import { FuzzyScore } from 'vs/base/common/filters';
|
||||
@@ -34,7 +34,6 @@ import { IDataTreeViewState } from 'vs/base/browser/ui/tree/dataTree';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
|
||||
import { push } from 'vs/base/common/arrays';
|
||||
|
||||
export interface IResultMessageIntern {
|
||||
id?: string;
|
||||
@@ -109,7 +108,7 @@ export class MessagePanel extends Disposable {
|
||||
) {
|
||||
super();
|
||||
const wordWrap = this.configurationService.getValue<IQueryEditorConfiguration>('queryEditor').messages.wordwrap;
|
||||
toggleClass(this.container, 'word-wrap', wordWrap);
|
||||
this.container.classList.toggle('word-wrap', wordWrap);
|
||||
this.tree = <WorkbenchDataTree<Model, IResultMessageIntern, FuzzyScore>>instantiationService.createInstance(
|
||||
WorkbenchDataTree,
|
||||
'MessagePanel',
|
||||
@@ -202,7 +201,7 @@ export class MessagePanel extends Disposable {
|
||||
|
||||
private onMessage(message: IQueryMessage | IQueryMessage[], setInput: boolean = false) {
|
||||
if (isArray(message)) {
|
||||
push(this.model.messages, message);
|
||||
this.model.messages.push(...message);
|
||||
} else {
|
||||
this.model.messages.push(message);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ 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 { FileQueryEditorInput } from 'sql/workbench/contrib/query/common/fileQueryEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/browser/fileQueryEditorInput';
|
||||
import { FileQueryEditorInputSerializer, QueryEditorLanguageAssociation, UntitledQueryEditorInputSerializer } 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';
|
||||
@@ -43,7 +43,7 @@ import { ItemContextKey } from 'sql/workbench/contrib/dashboard/browser/widgets/
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { IEditorOverrideService, ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -523,7 +523,7 @@ 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.registerContributionPoint(
|
||||
this._registeredOverrides.add(this._editorOverrideService.registerEditor(
|
||||
selector,
|
||||
{
|
||||
id: QueryEditor.ID,
|
||||
@@ -537,7 +537,7 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
|
||||
resource: resource
|
||||
}) as FileEditorInput;
|
||||
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(lang);
|
||||
const queryEditorInput = langAssociation?.syncConvertinput?.(fileInput);
|
||||
const queryEditorInput = langAssociation?.syncConvertInput?.(fileInput);
|
||||
if (!queryEditorInput) {
|
||||
this._logService.warn('Unable to create input for overriding editor ', resource);
|
||||
return undefined;
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'vs/css!./media/queryEditor';
|
||||
import { localize } from 'vs/nls';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { EditorOptions, IEditorControl, IEditorMemento, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorControl, IEditorMemento, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { EditorPane, EditorMemento } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
import { Orientation } from 'vs/base/browser/ui/sash/sash';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -28,7 +28,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
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';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IFileService, FileChangesEvent } from 'vs/platform/files/common/files';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
@@ -41,6 +41,7 @@ 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';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
const QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'queryEditorViewState';
|
||||
|
||||
@@ -337,7 +338,7 @@ export class QueryEditor extends EditorPane {
|
||||
this.taskbar.setContent(content);
|
||||
}
|
||||
|
||||
public override async setInput(newInput: QueryEditorInput, options: EditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
public override async setInput(newInput: QueryEditorInput, options: IEditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
const oldInput = this.input;
|
||||
|
||||
if (newInput.matches(oldInput)) {
|
||||
@@ -513,7 +514,7 @@ export class QueryEditor extends EditorPane {
|
||||
return this.currentTextEditor.getControl();
|
||||
}
|
||||
|
||||
public override setOptions(options: EditorOptions): void {
|
||||
public override setOptions(options: IEditorOptions): void {
|
||||
this.currentTextEditor.setOptions(options);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
|
||||
import { FILE_EDITOR_INPUT_ID } from 'vs/workbench/contrib/files/common/files';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/common/fileQueryEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/browser/fileQueryEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { ILanguageAssociation } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { QueryEditorInput } from 'sql/workbench/common/editor/query/queryEditorInput';
|
||||
@@ -71,7 +71,7 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
return queryEditorInput;
|
||||
}
|
||||
|
||||
syncConvertinput(activeEditor: IEditorInput): QueryEditorInput | undefined {
|
||||
syncConvertInput(activeEditor: IEditorInput): QueryEditorInput | undefined {
|
||||
const queryResultsInput = this.instantiationService.createInstance(QueryResultsInput, activeEditor.resource.toString(true));
|
||||
let queryEditorInput: QueryEditorInput;
|
||||
if (activeEditor instanceof FileEditorInput) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
@@ -20,6 +20,7 @@ import { QueryResultsView } from 'sql/workbench/contrib/query/browser/queryResul
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { RESULTS_GRID_DEFAULTS } from 'sql/workbench/common/constants';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
export const TextCompareEditorVisible = new RawContextKey<boolean>('textCompareEditorVisible', false);
|
||||
|
||||
@@ -130,7 +131,7 @@ export class QueryResultsEditor extends EditorPane {
|
||||
this.resultsView.layout(dimension);
|
||||
}
|
||||
|
||||
override setInput(input: QueryResultsInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
override setInput(input: QueryResultsInput, options: IEditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
super.setInput(input, options, context, CancellationToken.None);
|
||||
this.resultsView.input = input;
|
||||
return Promise.resolve<void>(null);
|
||||
|
||||
@@ -24,6 +24,7 @@ export class TimeElapsedStatusBarContributions extends Disposable implements IWo
|
||||
private intervalTimer = new IntervalTimer();
|
||||
|
||||
private disposable = this._register(new DisposableStore());
|
||||
private readonly name = localize('status.query.timeElapsed', "Time Elapsed");
|
||||
|
||||
constructor(
|
||||
@IStatusbarService private readonly statusbarService: IStatusbarService,
|
||||
@@ -33,11 +34,11 @@ export class TimeElapsedStatusBarContributions extends Disposable implements IWo
|
||||
super();
|
||||
this.statusItem = this._register(
|
||||
this.statusbarService.addEntry({
|
||||
name: this.name,
|
||||
text: '',
|
||||
ariaLabel: ''
|
||||
},
|
||||
TimeElapsedStatusBarContributions.ID,
|
||||
localize('status.query.timeElapsed', "Time Elapsed"),
|
||||
StatusbarAlignment.RIGHT, 100)
|
||||
);
|
||||
|
||||
@@ -93,6 +94,7 @@ export class TimeElapsedStatusBarContributions extends Disposable implements IWo
|
||||
const value = runner.queryStartTime ? Date.now() - runner.queryStartTime.getTime() : 0;
|
||||
const timeString = parseNumAsTimeString(value, false);
|
||||
this.statusItem.update({
|
||||
name: this.name,
|
||||
text: timeString,
|
||||
ariaLabel: timeString
|
||||
});
|
||||
@@ -101,6 +103,7 @@ export class TimeElapsedStatusBarContributions extends Disposable implements IWo
|
||||
const value = runner.queryStartTime ? Date.now() - runner.queryStartTime.getTime() : 0;
|
||||
const timeString = parseNumAsTimeString(value, false);
|
||||
this.statusItem.update({
|
||||
name: this.name,
|
||||
text: timeString,
|
||||
ariaLabel: timeString
|
||||
});
|
||||
@@ -109,6 +112,7 @@ export class TimeElapsedStatusBarContributions extends Disposable implements IWo
|
||||
? runner.queryEndTime.getTime() - runner.queryStartTime.getTime() : 0;
|
||||
const timeString = parseNumAsTimeString(value, false);
|
||||
this.statusItem.update({
|
||||
name: this.name,
|
||||
text: timeString,
|
||||
ariaLabel: timeString
|
||||
});
|
||||
@@ -124,6 +128,7 @@ export class RowCountStatusBarContributions extends Disposable implements IWorkb
|
||||
private statusItem: IStatusbarEntryAccessor;
|
||||
|
||||
private disposable = this._register(new DisposableStore());
|
||||
private readonly name = localize('status.query.rowCount', "Row Count");
|
||||
|
||||
constructor(
|
||||
@IStatusbarService private readonly statusbarService: IStatusbarService,
|
||||
@@ -133,11 +138,11 @@ export class RowCountStatusBarContributions extends Disposable implements IWorkb
|
||||
super();
|
||||
this.statusItem = this._register(
|
||||
this.statusbarService.addEntry({
|
||||
name: this.name,
|
||||
text: '',
|
||||
ariaLabel: ''
|
||||
},
|
||||
RowCountStatusBarContributions.ID,
|
||||
localize('status.query.rowCount', "Row Count"),
|
||||
StatusbarAlignment.RIGHT, 100)
|
||||
);
|
||||
|
||||
@@ -201,7 +206,7 @@ export class RowCountStatusBarContributions extends Disposable implements IWorkb
|
||||
return p + cnt;
|
||||
}, 0);
|
||||
const text = localize('rowCount', "{0} rows", rowCount.toLocaleString());
|
||||
this.statusItem.update({ text, ariaLabel: text });
|
||||
this.statusItem.update({ name: this.name, text: text, ariaLabel: text });
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
@@ -220,11 +225,11 @@ export class QueryStatusStatusBarContributions extends Disposable implements IWo
|
||||
super();
|
||||
this._register(
|
||||
this.statusbarService.addEntry({
|
||||
name: localize('status.query.status', "Execution Status"),
|
||||
text: localize('query.status.executing', "Executing query..."),
|
||||
ariaLabel: localize('query.status.executing', "Executing query...")
|
||||
},
|
||||
QueryStatusStatusBarContributions.ID,
|
||||
localize('status.query.status', "Execution Status"),
|
||||
StatusbarAlignment.RIGHT, 100)
|
||||
);
|
||||
|
||||
@@ -259,6 +264,7 @@ export class QueryStatusStatusBarContributions extends Disposable implements IWo
|
||||
export class QueryResultSelectionSummaryStatusBarContribution extends Disposable implements IWorkbenchContribution {
|
||||
private static readonly ID = 'status.query.selection-summary';
|
||||
private statusItem: IStatusbarEntryAccessor;
|
||||
private readonly name = localize('status.query.selection-summary', "Selection Summary");
|
||||
|
||||
constructor(
|
||||
@IStatusbarService private readonly statusbarService: IStatusbarService,
|
||||
@@ -269,11 +275,11 @@ export class QueryResultSelectionSummaryStatusBarContribution extends Disposable
|
||||
super();
|
||||
this.statusItem = this._register(
|
||||
this.statusbarService.addEntry({
|
||||
name: this.name,
|
||||
text: '',
|
||||
ariaLabel: ''
|
||||
},
|
||||
QueryResultSelectionSummaryStatusBarContribution.ID,
|
||||
localize('status.query.selection-summary', "Selection Summary"),
|
||||
StatusbarAlignment.RIGHT, 100)
|
||||
);
|
||||
this._register(editorService.onDidActiveEditorChange(() => { this.hide(); }, this));
|
||||
@@ -302,6 +308,7 @@ export class QueryResultSelectionSummaryStatusBarContribution extends Disposable
|
||||
const sum = numericValues.reduce((previous, current, idx, array) => previous + current);
|
||||
const summaryText = localize('status.query.summaryText', "Average: {0} Count: {1} Sum: {2}", Number((sum / numericValues.length).toFixed(3)), selectedCells.length, sum);
|
||||
this.statusItem.update({
|
||||
name: this.name,
|
||||
text: summaryText,
|
||||
ariaLabel: summaryText
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user