Merge from vscode merge-base (#22780)

* Revert "Revert "Merge from vscode merge-base (#22769)" (#22779)"

This reverts commit 47a1745180.

* Fix notebook download task

* Remove done call from extensions-ci
This commit is contained in:
Karl Burtram
2023-04-19 21:48:46 -07:00
committed by GitHub
parent decbe8dded
commit e7d3d047ec
2389 changed files with 92155 additions and 42602 deletions

View File

@@ -15,8 +15,7 @@ import * as vsTreeExt from 'vs/workbench/api/common/extHostTreeViews';
import { Emitter } from 'vs/base/common/event';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { ILogService } from 'vs/platform/log/common/log';
import { DataTransferDTO } from 'vs/workbench/api/common/shared/dataTransfer';
import { SqlMainContext } from 'vs/workbench/api/common/extHost.protocol';
import { SqlMainContext, DataTransferDTO } from 'vs/workbench/api/common/extHost.protocol';
export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape {
private _proxy: MainThreadModelViewShape;
@@ -86,7 +85,7 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape
return Promise.resolve(undefined);
}
$handleDrop(destinationViewId: string, treeDataTransfer: DataTransferDTO, targetHandle: string | undefined, token: vscode.CancellationToken, operationUuid?: string, sourceViewId?: string, sourceTreeItemHandles?: string[]): Promise<void> {
$handleDrop(destinationViewId: string, requestId: number, treeDataTransfer: DataTransferDTO, targetHandle: string | undefined, token: vscode.CancellationToken, operationUuid?: string, sourceViewId?: string, sourceTreeItemHandles?: string[]): Promise<void> {
return Promise.resolve(undefined);
}

View File

@@ -26,7 +26,7 @@ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'
import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
import { ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
import { IQueryEvent } from 'sql/workbench/services/query/common/queryModel';
import { DataTransferDTO } from 'vs/workbench/api/common/shared/dataTransfer';
import { DataTransferDTO } from 'vs/workbench/api/common/extHost.protocol';
export abstract class ExtHostAzureBlobShape {
public $createSas(connectionUri: string, blobContainerUri: string, blobStorageKey: string, storageAccountName: string, expirationDate: string): Thenable<mssql.CreateSasResponse> { throw ni(); }
@@ -794,7 +794,7 @@ export interface ExtHostModelViewShape {
export interface ExtHostModelViewTreeViewsShape {
$getChildren(treeViewId: string, treeItemHandle?: string): Promise<ITreeComponentItem[]>;
$handleDrop(destinationViewId: string, treeDataTransfer: DataTransferDTO, targetHandle: string | undefined, token: vscode.CancellationToken, operationUuid?: string, sourceViewId?: string, sourceTreeItemHandles?: string[]): Promise<void>;
$handleDrop(destinationViewId: string, requestId: number, treeDataTransfer: DataTransferDTO, targetHandle: string | undefined, token: vscode.CancellationToken, operationUuid?: string, sourceViewId?: string, sourceTreeItemHandles?: string[]): Promise<void>;
$handleDrag(sourceViewId: string, sourceTreeItemHandles: string[], operationUuid: string, token: vscode.CancellationToken): Promise<DataTransferDTO | undefined>;
$createTreeView(handle: number, componentId: string, options: { treeDataProvider: vscode.TreeDataProvider<any> }, extension: IExtensionDescription): azdata.TreeComponentView<any>;

View File

@@ -16,7 +16,7 @@ import * as nls from 'vs/nls';
import * as DOM from 'vs/base/browser/dom';
import { TextResourceEditorModel } from 'vs/workbench/common/editor/textResourceEditorModel';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { AbstractTextCodeEditor } from 'vs/workbench/browser/parts/editor/textCodeEditor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IStorageService } from 'vs/platform/storage/common/storage';
@@ -30,13 +30,14 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IModelService } from 'vs/editor/common/services/model';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfiguration';
import { IFileService } from 'vs/platform/files/common/files';
class DesignerCodeEditor extends CodeEditorWidget {
}
let DesignerScriptEditorInstanceId = 0;
export class DesignerScriptEditor extends BaseTextEditor<editorCommon.ICodeEditorViewState> implements DesignerTextEditor {
export class DesignerScriptEditor extends AbstractTextCodeEditor<editorCommon.ICodeEditorViewState> implements DesignerTextEditor {
private _content: string;
private _contentChangeEventEmitter: Emitter<string> = new Emitter<string>();
readonly onDidContentChange: Event<string> = this._contentChangeEventEmitter.event;
@@ -55,9 +56,10 @@ export class DesignerScriptEditor extends BaseTextEditor<editorCommon.ICodeEdito
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@IThemeService themeService: IThemeService,
@IEditorService editorService: IEditorService,
@IEditorGroupsService editorGroupService: IEditorGroupsService
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IFileService fileService: IFileService
) {
super(DesignerScriptEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, editorService, editorGroupService);
super(DesignerScriptEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, editorService, editorGroupService, fileService);
this.create(this._container);
this.setVisible(true);
this._untitledTextEditorModel = this.instantiationService.createInstance(UntitledTextEditorModel, URI.from({ scheme: Schemas.untitled, path: `DesignerScriptEditor-${DesignerScriptEditorInstanceId++}` }), false, undefined, 'sql', undefined);
@@ -70,7 +72,9 @@ export class DesignerScriptEditor extends BaseTextEditor<editorCommon.ICodeEdito
}
public override createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
return this.instantiationService.createInstance(DesignerCodeEditor, parent, configuration, {});
this.editorControl = this.instantiationService.createInstance(DesignerCodeEditor, parent, configuration, {});
return this.editorControl;
}
protected override getConfigurationOverrides(): IEditorOptions {

View File

@@ -405,7 +405,7 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
private createMenuItem(commandId: string): MenuItemAction {
const command = MenuRegistry.getCommand(commandId);
return this.instantiationService.createInstance(MenuItemAction, command, undefined, { shouldForwardArgs: true });
return this.instantiationService.createInstance(MenuItemAction, command, undefined, { shouldForwardArgs: true }, undefined);
}
public onKey(e: KeyboardEvent, row: number) {

View File

@@ -9,7 +9,7 @@ import * as DOM from 'vs/base/browser/dom';
import { TextResourceEditorModel } from 'vs/workbench/common/editor/textResourceEditorModel';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { BaseTextEditor, IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor';
import { IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -24,11 +24,13 @@ import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfiguration';
import { AbstractTextCodeEditor } from 'vs/workbench/browser/parts/editor/textCodeEditor';
import { IFileService } from 'vs/platform/files/common/files';
/**
* Extension of TextResourceEditor that is always readonly rather than only with non UntitledInputs
*/
export class QueryTextEditor extends BaseTextEditor<editorCommon.ICodeEditorViewState> {
export class QueryTextEditor extends AbstractTextCodeEditor<editorCommon.ICodeEditorViewState> {
public static ID = 'modelview.editors.textEditor';
private _dimension: DOM.Dimension;
@@ -47,15 +49,18 @@ export class QueryTextEditor extends BaseTextEditor<editorCommon.ICodeEditorView
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@IThemeService themeService: IThemeService,
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IEditorService editorService: IEditorService
@IEditorService editorService: IEditorService,
@IFileService fileService: IFileService
) {
super(
QueryTextEditor.ID, telemetryService, instantiationService, storageService,
configurationService, themeService, editorService, editorGroupService);
configurationService, themeService, editorService, editorGroupService, fileService);
}
public override createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
return this.instantiationService.createInstance(CodeEditorWidget, parent, configuration, {});
this.editorControl = this.instantiationService.createInstance(CodeEditorWidget, parent, configuration, {});
return this.editorControl;
}
protected override getConfigurationOverrides(): IEditorOptions {

View File

@@ -584,7 +584,7 @@ export default class TableComponent extends ComponentBase<azdata.TableComponentP
private createMenuItem(commandId: string): MenuItemAction {
const command = MenuRegistry.getCommand(commandId);
return this.instantiationService.createInstance(MenuItemAction, command, undefined, { shouldForwardArgs: true });
return this.instantiationService.createInstance(MenuItemAction, command, undefined, { shouldForwardArgs: true }, undefined);
}

View File

@@ -21,14 +21,14 @@ export function getChartMaxRowCount(configurationService: IConfigurationService)
*/
export function notifyMaxRowCountExceeded(storageService: IStorageService, notificationService: INotificationService, configurationService: IConfigurationService): void {
const storageKey = 'charts/ignoreMaxRowCountExceededNotification';
if (!storageService.getBoolean(storageKey, StorageScope.GLOBAL, false)) {
if (!storageService.getBoolean(storageKey, StorageScope.APPLICATION, false)) {
notificationService.prompt(Severity.Info,
nls.localize('charts.maxAllowedRowsExceeded', "Maximum row count for built-in charts has been exceeded, only the first {0} rows are used. To configure the value, you can open user settings and search for: 'builtinCharts.maxRowCount'.", getChartMaxRowCount(configurationService)),
[{
label: nls.localize('charts.neverShowAgain', "Don't Show Again"),
isSecondary: true,
run: () => {
storageService.store(storageKey, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
storageService.store(storageKey, true, StorageScope.APPLICATION, StorageTarget.MACHINE);
}
}]);
}

View File

@@ -31,7 +31,7 @@ const settingsToMove: { [key: string]: string } = deepFreeze({
export class ConfigurationUpgraderContribution implements IWorkbenchContribution {
private static readonly STORAGE_KEY = 'configurationUpgrader';
private readonly globalStorage: { [key: string]: boolean } = JSON.parse(this.storageService.get(ConfigurationUpgraderContribution.STORAGE_KEY, StorageScope.GLOBAL, '{}'));
private readonly globalStorage: { [key: string]: boolean } = JSON.parse(this.storageService.get(ConfigurationUpgraderContribution.STORAGE_KEY, StorageScope.APPLICATION, '{}'));
private readonly workspaceStorage: { [key: string]: boolean } = JSON.parse(this.storageService.get(ConfigurationUpgraderContribution.STORAGE_KEY, StorageScope.WORKSPACE, '{}'));
public readonly processingPromise: Promise<void>;
@@ -43,7 +43,7 @@ export class ConfigurationUpgraderContribution implements IWorkbenchContribution
) {
this.processingPromise = (async () => {
await this.processSettings();
this.storageService.store(ConfigurationUpgraderContribution.STORAGE_KEY, JSON.stringify(this.globalStorage), StorageScope.GLOBAL, StorageTarget.MACHINE);
this.storageService.store(ConfigurationUpgraderContribution.STORAGE_KEY, JSON.stringify(this.globalStorage), StorageScope.APPLICATION, StorageTarget.MACHINE);
this.storageService.store(ConfigurationUpgraderContribution.STORAGE_KEY, JSON.stringify(this.workspaceStorage), StorageScope.WORKSPACE, StorageTarget.MACHINE);
})();
}

View File

@@ -98,11 +98,14 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
this._onMessageDisposable.dispose();
}
this._webview = this.webviewService.createWebviewElement(this.id,
{},
{
allowScripts: true
}, undefined);
this._webview = this.webviewService.createWebviewElement({
id: this.id,
contentOptions: {
allowScripts: true,
},
options: {},
extension: undefined
});
this._webview.mountTo(this._el.nativeElement);

View File

@@ -190,14 +190,14 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
};
this.lastUpdated = nls.localize('insights.lastUpdated', "Last Updated: {0} {1}", currentTime.toLocaleTimeString(), currentTime.toLocaleDateString());
this._changeRef.detectChanges();
this.storageService.store(this._getStorageKey(), JSON.stringify(store), StorageScope.GLOBAL, StorageTarget.MACHINE);
this.storageService.store(this._getStorageKey(), JSON.stringify(store), StorageScope.APPLICATION, StorageTarget.MACHINE);
}
return result;
}
private _checkStorage(): boolean {
if (this.insightConfig.cacheId) {
const storage = this.storageService.get(this._getStorageKey(), StorageScope.GLOBAL);
const storage = this.storageService.get(this._getStorageKey(), StorageScope.APPLICATION);
if (storage) {
const storedResult: IStorageResult = JSON.parse(storage);
const date = new Date(storedResult.date);

View File

@@ -99,11 +99,14 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
this._onMessageDisposable.dispose();
}
this._webview = this.webviewService.createWebviewElement(this.id,
{},
{
this._webview = this.webviewService.createWebviewElement({
id: this.id,
contentOptions: {
allowScripts: true,
}, undefined);
},
options: {},
extension: undefined
});
this._webview.mountTo(this._el.nativeElement);
this._onMessageDisposable = this._webview.onMessage(e => {

View File

@@ -41,6 +41,7 @@ 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';
import { ICodeEditorViewState } from 'vs/editor/common/editorCommon';
/**
* Editor that hosts an action bar and a resultSetInput for an edit data session
@@ -583,7 +584,7 @@ export class EditDataEditor extends EditorPane {
newInput.results.onRestoreViewStateEmitter.fire();
}
if (newInput.savedViewState) {
this._sqlEditor.getControl().restoreViewState(newInput.savedViewState);
this._sqlEditor.getControl().restoreViewState(<ICodeEditorViewState>newInput.savedViewState);
}
});
}

View File

@@ -798,11 +798,10 @@ class SearchNodeAction extends Action {
public static LABEL_FOR_ADDED_PLAN = localize('epCompare.searchNodeActionAddedPlan', 'Find Node - Added Plan');
constructor(private readonly _planIdentifier: PlanIdentifier, @IInstantiationService private readonly _instantiationService: IInstantiationService, @IAdsTelemetryService private readonly _telemetryService: IAdsTelemetryService) {
const getLabelForAction = () => {
super(SearchNodeAction.ID, undefined, searchIconClassNames, true, () => {
return _planIdentifier === PlanIdentifier.Added ? SearchNodeAction.LABEL_FOR_ADDED_PLAN : SearchNodeAction.LABEL;
};
});
super(SearchNodeAction.ID, getLabelForAction(), searchIconClassNames);
this.enabled = false;
}

View File

@@ -70,14 +70,16 @@ export class ExecutionPlanEditorOverrideContribution extends Disposable implemen
priority: RegisteredEditorPriority.builtin
},
{},
(editorInput, group) => {
const executionPlanGraphInfo = {
graphFileContent: undefined,
graphFileType: undefined
};
const executionPlanInput = this._register(this._instantiationService.createInstance(ExecutionPlanInput, editorInput.resource, executionPlanGraphInfo));
{
createEditorInput: (editorInput, group) => {
const executionPlanGraphInfo = {
graphFileContent: undefined,
graphFileType: undefined
};
const executionPlanInput = this._register(this._instantiationService.createInstance(ExecutionPlanInput, editorInput.resource, executionPlanGraphInfo));
return { editor: executionPlanInput, options: editorInput.options, group: group };
return { editor: executionPlanInput, options: editorInput.options, group: group };
}
}
));
}

View File

@@ -449,7 +449,7 @@ export class SavePlanFile extends Action {
const fileExtension = 'sqlplan'; //TODO: Get this extension from provider
let defaultUri: URI;
const lastUsedSavePath = this.storageService.get(SavePlanFile.LAST_USED_EXECUTION_PLAN_SAVE_PATH_STORAGE_KEY, StorageScope.GLOBAL);
const lastUsedSavePath = this.storageService.get(SavePlanFile.LAST_USED_EXECUTION_PLAN_SAVE_PATH_STORAGE_KEY, StorageScope.APPLICATION);
if (lastUsedSavePath) {
defaultUri = joinPath(URI.file(lastUsedSavePath), `${defaultFileName}.${fileExtension}`);
@@ -479,7 +479,7 @@ export class SavePlanFile extends Action {
if (destination) {
// Remember as last used save folder
this.storageService.store(SavePlanFile.LAST_USED_EXECUTION_PLAN_SAVE_PATH_STORAGE_KEY, dirname(destination).fsPath, StorageScope.GLOBAL, StorageTarget.MACHINE);
this.storageService.store(SavePlanFile.LAST_USED_EXECUTION_PLAN_SAVE_PATH_STORAGE_KEY, dirname(destination).fsPath, StorageScope.APPLICATION, StorageTarget.MACHINE);
// Perform save
await context.fileService.writeFile(destination, VSBuffer.fromString(context.model.graphFile.graphFileContent));

View File

@@ -181,7 +181,7 @@ export class HighlightExpensiveOperationWidget extends ExecutionPlanWidgetBase {
public showStoreDefaultMetricPrompt(): void {
const currentDefaultExpensiveOperationMetric = this.getDefaultExpensiveOperationMetric();
if (this._selectedExpensiveOperationType === currentDefaultExpensiveOperationMetric || !this._storageService.getBoolean('qp.expensiveOperationMetric.showChangeDefaultExpensiveMetricPrompt', StorageScope.GLOBAL, true)) {
if (this._selectedExpensiveOperationType === currentDefaultExpensiveOperationMetric || !this._storageService.getBoolean('qp.expensiveOperationMetric.showChangeDefaultExpensiveMetricPrompt', StorageScope.APPLICATION, true)) {
return;
}
@@ -197,7 +197,7 @@ export class HighlightExpensiveOperationWidget extends ExecutionPlanWidgetBase {
},
{
label: localize('qp.expensiveOperationMetric.dontShowAgain', "Don't Show Again"),
run: () => this._storageService.store('qp.expensiveOperationMetric.showChangeDefaultExpensiveMetricPrompt', false, StorageScope.GLOBAL, StorageTarget.USER)
run: () => this._storageService.store('qp.expensiveOperationMetric.showChangeDefaultExpensiveMetricPrompt', false, StorageScope.APPLICATION, StorageTarget.USER)
}
];

View File

@@ -52,7 +52,7 @@ export class ScenarioRecommendations extends ExtensionRecommendations {
promptRecommendedExtensionsByScenario(scenarioType: string): void {
const storageKey = 'extensionAssistant/RecommendationsIgnore/' + scenarioType;
if (this.storageService.getBoolean(storageKey, StorageScope.GLOBAL, false) || this.ignoreRecommendations()) {
if (this.storageService.getBoolean(storageKey, StorageScope.APPLICATION, false) || this.ignoreRecommendations()) {
return;
}
@@ -104,7 +104,7 @@ export class ScenarioRecommendations extends ExtensionRecommendations {
'NeverShowAgainButton',
visualizerExtensionNotificationService
);
this.storageService.store(storageKey, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
this.storageService.store(storageKey, true, StorageScope.APPLICATION, StorageTarget.MACHINE);
}
}],
{

View File

@@ -73,11 +73,14 @@ export default class WebViewComponent extends ComponentBase<WebViewProperties> i
}
private _createWebview(): void {
this._webview = this.webviewService.createWebviewElement(this.id,
{},
{
allowScripts: true
}, undefined);
this._webview = this.webviewService.createWebviewElement({
id: this.id,
contentOptions: {
allowScripts: true,
},
options: {},
extension: undefined
});
this._webview.mountTo(this._el.nativeElement);

View File

@@ -10,7 +10,7 @@ import { AngularDisposable } from 'sql/base/browser/lifecycle';
import { ICellEditorProvider, INotebookService, NotebookRange } from 'sql/workbench/services/notebook/browser/notebookService';
import { MarkdownRenderOptions } from 'vs/base/browser/markdownRenderer';
import { IMarkdownString } from 'vs/base/common/htmlContent';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { AbstractTextCodeEditor } from 'vs/workbench/browser/parts/editor/textCodeEditor';
import { nb } from 'azdata';
import { NotebookModel } from 'sql/workbench/services/notebook/browser/models/notebookModel';
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
@@ -34,7 +34,7 @@ export abstract class CellView extends AngularDisposable implements OnDestroy, I
public abstract layout(): void;
public getEditor(): BaseTextEditor<ICodeEditorViewState> | undefined {
public getEditor(): AbstractTextCodeEditor<ICodeEditorViewState> | undefined {
return undefined;
}

View File

@@ -803,18 +803,19 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
priority: RegisteredEditorPriority.builtin
},
{},
async (editorInput, group) => {
const fileInput = await 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.convertInput(fileInput);
return { editor: newInput, options: editorInput.options, group: group };
},
undefined,
async (diffEditorInput, group) => {
const diffEditorInputImpl = await 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.convertInput(diffEditorInputImpl);
return { editor: newInput, options: diffEditorInput.options, group: group };
{
createEditorInput: async (editorInput, group) => {
const fileInput = await 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.convertInput(fileInput);
return { editor: newInput, options: editorInput.options, group: group };
},
createDiffEditorInput: async (diffEditorInput, group) => {
const diffEditorInputImpl = await 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.convertInput(diffEditorInputImpl);
return { editor: newInput, options: diffEditorInput.options, group: group };
}
}
));
}

View File

@@ -32,7 +32,7 @@ import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IModelDecorationsChangeAccessor, IModelDeltaDecoration } from 'vs/editor/common/model';
import { NotebookFindDecorations } from 'sql/workbench/contrib/notebook/browser/find/notebookFindDecorations';
import { TimeoutTimer } from 'vs/base/common/async';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { AbstractTextCodeEditor } from 'vs/workbench/browser/parts/editor/textCodeEditor';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import { FindReplaceState, FindReplaceStateChangedEvent } from 'vs/editor/contrib/find/browser/findState';
@@ -94,7 +94,7 @@ export class NotebookEditor extends EditorPane implements IFindNotebookControlle
public getLastPosition(): NotebookRange {
return this._previousMatch;
}
public getCellEditor(cellGuid: string): BaseTextEditor<ICodeEditorViewState> | undefined {
public getCellEditor(cellGuid: string): AbstractTextCodeEditor<ICodeEditorViewState> | undefined {
let editorImpl = this._notebookService.findNotebookEditor(this.notebookInput.notebookUri);
if (editorImpl) {
let cellEditorProvider = editorImpl.cellEditors.filter(c => c.cellGuid() === cellGuid)[0];

View File

@@ -33,7 +33,7 @@ import { NotebookEditorStub } from 'sql/workbench/contrib/notebook/test/testComm
import { Range } from 'vs/editor/common/core/range';
import { IProductService } from 'vs/platform/product/common/productService';
import { TestAccessibilityService } from 'vs/platform/accessibility/test/common/testAccessibilityService';
import { LanguageId } from 'vs/editor/common/languages';
import { LanguageId } from 'vs/editor/common/encodedTokenAttributes';
suite.skip('MarkdownTextTransformer', () => {
let markdownTextTransformer: MarkdownTextTransformer;

View File

@@ -730,7 +730,8 @@ function setupServices(arg: { workbenchThemeService?: WorkbenchThemeService, ins
instantiationService.get(ITextResourceConfigurationService),
instantiationService.get(IThemeService),
instantiationService.get(IEditorGroupsService),
instantiationService.get(IEditorService)
instantiationService.get(IEditorService),
instantiationService.get(IFileService)
);
const notebookEditorStub = new NotebookEditorStub({ cellGuid: cellTextEditorGuid, editor: queryTextEditor, model: new NotebookModelStub(), notebookParams: <INotebookParams>{ notebookUri: untitledNotebookInput.notebookUri } });
notebookService.addNotebookEditor(notebookEditorStub);

View File

@@ -11,7 +11,7 @@ import * as dom from 'vs/base/browser/dom';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
import { TestEditorGroupsService, TestEditorService, TestTextResourceConfigurationService } from 'vs/workbench/test/browser/workbenchTestServices';
import { TestEditorGroupsService, TestEditorService, TestFileService, TestTextResourceConfigurationService } from 'vs/workbench/test/browser/workbenchTestServices';
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
import { NotebookViewsExtension } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViewsExtension';
@@ -48,7 +48,8 @@ class CellEditorProviderStub extends stubs.CellEditorProviderStub {
new TestTextResourceConfigurationService(),
new TestThemeService(),
new TestEditorGroupsService(),
new TestEditorService()
new TestEditorService(),
new TestFileService()
);
}
if (this._editor) {

View File

@@ -44,6 +44,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { workbenchTreeDataPreamble } from 'vs/platform/list/browser/listService';
suite('SQL Connection Tree Action tests', () => {
let errorMessageService: TypeMoq.Mock<TestErrorMessageService>;
@@ -706,7 +707,16 @@ suite('SQL Connection Tree Action tests', () => {
});
});
test('RefreshConnectionAction - AsyncServerTree - refresh should not be called if connection status is not connect', () => {
/*
TypeError: instantiationService.invokeFunction is not a function
at new WorkbenchAsyncDataTree (file:///C:/Users/lewissanchez/GitProjects/azuredatastudio-merge/out/vs/platform/list/browser/listService.js:643:102)
at new AsyncServerTree (file:///C:/Users/lewissanchez/GitProjects/azuredatastudio-merge/out/sql/workbench/services/objectExplorer/browser/asyncServerTree.js:9:5)
at Utils.conthunktor (C:\Users\lewissanchez\GitProjects\azuredatastudio-merge\node_modules\typemoq\typemoq.js:227:23)
at Mock.ofType2 (C:\Users\lewissanchez\GitProjects\azuredatastudio-merge\node_modules\typemoq\typemoq.js:1248:48)
at Mock.ofType (C:\Users\lewissanchez\GitProjects\azuredatastudio-merge\node_modules\typemoq\typemoq.js:1243:29)
at Context.<anonymous> (file:///C:/Users/lewissanchez/GitProjects/azuredatastudio-merge/out/sql/workbench/contrib/objectExplorer/test/browser/connectionTreeActions.test.js:612:
*/
test.skip('RefreshConnectionAction - AsyncServerTree - refresh should not be called if connection status is not connect', (done) => { // {{SQL CARBON TODO}} 3/17/23 Not sure why this is failing after mokcing the instantiation service's invoke function.
let isConnectedReturnValue: boolean = false;
let sqlProvider = {
providerId: mssqlProviderName,
@@ -770,6 +780,24 @@ suite('SQL Connection Tree Action tests', () => {
objectExplorerService.callBase = true;
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
let testDisposable = {
dispose() {
//
}
};
let testInstantiationService = TypeMoq.Mock.ofType(InstantiationService, TypeMoq.MockBehavior.Loose);
testInstantiationService.setup(x => x.invokeFunction(workbenchTreeDataPreamble, TypeMoq.It.isAny())).returns((): any => {
return {
getTypeNavigationMode: undefined,
disposable: testDisposable,
treeOptions: {}
};
});
let mockContextKeyService = new MockContextKeyService();
let testListService = new TestListService();
let testConfigurationService = new TestConfigurationService();
let tree = TypeMoq.Mock.ofType<AsyncServerTree>(AsyncServerTree, TypeMoq.MockBehavior.Loose,
'ConnectionTreeActionsTest', // user
$('div'), // container
@@ -777,12 +805,11 @@ suite('SQL Connection Tree Action tests', () => {
[], // renderers
{}, // data source
{}, // options
new MockContextKeyService(), // IContextKeyService
new TestListService(), // IListService,
testInstantiationService.object,
mockContextKeyService, // IContextKeyService
testListService, // IListService,
undefined, // IThemeService,
new TestConfigurationService(), // IConfigurationService,
undefined, // IKeybindingService,
new TestAccessibilityService()); // IAccessibilityService
testConfigurationService); // IConfigurationService,
tree.callBase = true;
tree.setup(x => x.updateChildren(TypeMoq.It.isAny())).returns(() => Promise.resolve());
@@ -802,6 +829,7 @@ suite('SQL Connection Tree Action tests', () => {
objectExplorerService.verify(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny()), TypeMoq.Times.exactly(0));
tree.verify(x => x.updateChildren(TypeMoq.It.isAny()), TypeMoq.Times.exactly(0));
tree.verify(x => x.expand(TypeMoq.It.isAny()), TypeMoq.Times.exactly(0));
done();
});
});

View File

@@ -9,7 +9,7 @@ import * as DOM from 'vs/base/browser/dom';
import { TextResourceEditorModel } from 'vs/workbench/common/editor/textResourceEditorModel';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { AbstractTextCodeEditor } from 'vs/workbench/browser/parts/editor/textCodeEditor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -23,6 +23,7 @@ import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfiguration';
import { IFileService } from 'vs/platform/files/common/files';
class ProfilerResourceCodeEditor extends CodeEditorWidget {
@@ -38,7 +39,7 @@ class ProfilerResourceCodeEditor extends CodeEditorWidget {
/**
* Extension of TextResourceEditor that is always readonly rather than only with non UntitledInputs
*/
export class ProfilerResourceEditor extends BaseTextEditor<editorCommon.ICodeEditorViewState> {
export class ProfilerResourceEditor extends AbstractTextCodeEditor<editorCommon.ICodeEditorViewState> {
public static ID = 'profiler.editors.textEditor';
constructor(
@@ -48,14 +49,16 @@ export class ProfilerResourceEditor extends BaseTextEditor<editorCommon.ICodeEdi
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@IThemeService themeService: IThemeService,
@IEditorService editorService: IEditorService,
@IEditorGroupsService editorGroupService: IEditorGroupsService
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IFileService fileService: IFileService
) {
super(ProfilerResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, editorService, editorGroupService);
super(ProfilerResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, editorService, editorGroupService, fileService);
}
public override createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
return this.instantiationService.createInstance(ProfilerResourceCodeEditor, parent, configuration, {});
this.editorControl = this.instantiationService.createInstance(ProfilerResourceCodeEditor, parent, configuration, {});
return this.editorControl;
}
protected override getConfigurationOverrides(): IEditorOptions {

View File

@@ -83,7 +83,7 @@ export class SaveResultAction extends Action {
this.notificationService.notify({
severity: Severity.Info,
message: localize('jsonEncoding', "Results encoding will not be saved when exporting to JSON, remember to save with desired encoding once file is created."),
neverShowAgain: { id: 'ignoreJsonEncoding', scope: NeverShowAgainScope.GLOBAL }
neverShowAgain: { id: 'ignoreJsonEncoding', scope: NeverShowAgainScope.APPLICATION }
});
}

View File

@@ -578,17 +578,19 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
},
{
// Fall back to using the normal text based diff editor - we don't want the query bar and related items showing up in the diff editor
canHandleDiff: () => false
// canHandleDiff: () => false
},
async (editorInput, group) => {
const fileInput = await 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 resolving editor ', editorInput.resource);
return undefined;
{
createEditorInput: async (editorInput, group) => {
const fileInput = await 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 resolving editor ', editorInput.resource);
return undefined;
}
return { editor: queryEditorInput, options: editorInput.options, group: group };
}
return { editor: queryEditorInput, options: editorInput.options, group: group };
}
));
});

View File

@@ -27,7 +27,7 @@ import { Event } from 'vs/base/common/event';
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 { AbstractTextCodeEditor } from 'vs/workbench/browser/parts/editor/textCodeEditor';
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';
@@ -71,7 +71,7 @@ export class QueryEditor extends EditorPane {
private textResourceEditor: TextResourceEditor;
private textFileEditor: TextFileEditor;
private currentTextEditor: BaseTextEditor<ICodeEditorViewState>;
private currentTextEditor: AbstractTextCodeEditor<ICodeEditorViewState>;
private textResourceEditorContainer: HTMLElement;
private textFileEditorContainer: HTMLElement;

View File

@@ -87,11 +87,14 @@ export class WebViewDialog extends Modal {
protected renderBody(container: HTMLElement) {
this._body = DOM.append(container, DOM.$('div.webview-dialog'));
this._webview = this.webviewService.createWebviewElement(this.id,
{},
{
allowScripts: true
}, undefined);
this._webview = this.webviewService.createWebviewElement({
id: this.id,
contentOptions: {
allowScripts: true,
},
options: {},
extension: undefined
});
this._webview.mountTo(this._body);

View File

@@ -25,7 +25,7 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
protected handlePreviewFeatures(): void {
let previewFeaturesEnabled = this.configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
if (previewFeaturesEnabled || this.storageService.get(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, StorageScope.GLOBAL)) {
if (previewFeaturesEnabled || this.storageService.get(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, StorageScope.APPLICATION)) {
return;
}
Promise.all([
@@ -45,7 +45,7 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
label: localize('enablePreviewFeatures.yes', "Yes (recommended)"),
run: () => {
this.configurationService.updateValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, true).catch(e => onUnexpectedError(e));
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.APPLICATION, StorageTarget.MACHINE);
}
}, {
label: localize('enablePreviewFeatures.no', "No"),
@@ -56,7 +56,7 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
label: localize('enablePreviewFeatures.never', "No, don't show again"),
run: () => {
this.configurationService.updateValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, false).catch(e => onUnexpectedError(e));
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.APPLICATION, StorageTarget.MACHINE);
},
isSecondary: true
}]

View File

@@ -43,11 +43,11 @@ export class NotifyEncryptionDialog extends ErrorMessageDialog {
}
public override open(): void {
if (this._storageService.get(NotifyEncryptionDialog.NOTIFY_ENCRYPT_SHOWN, StorageScope.GLOBAL)) {
if (this._storageService.get(NotifyEncryptionDialog.NOTIFY_ENCRYPT_SHOWN, StorageScope.APPLICATION)) {
return;
}
this._storageService.store(NotifyEncryptionDialog.NOTIFY_ENCRYPT_SHOWN, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
this._storageService.store(NotifyEncryptionDialog.NOTIFY_ENCRYPT_SHOWN, true, StorageScope.APPLICATION, StorageTarget.MACHINE);
if (!this._connectionManagementService.getConnections()?.some(conn => conn.providerName === mssqlProviderName)) {
return;

View File

@@ -382,7 +382,7 @@ class WelcomePage extends Disposable {
newButton.onDidClick(() => {
this.contextMenuService.showContextMenu({
getAnchor: () => newButtonHtmlElement,
getActions: () => NewActionItems.map(command => new MenuItemAction(command, undefined, {}, this.contextKeyService, this.commandService))
getActions: () => NewActionItems.map(command => new MenuItemAction(command, undefined, {}, undefined, this.contextKeyService, this.commandService))
});
});

View File

@@ -67,7 +67,7 @@ export class AccountManagementService implements IAccountManagementService {
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService
) {
this._mementoContext = new Memento(AccountManagementService.ACCOUNT_MEMENTO, this._storageService);
const mementoObj = this._mementoContext.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
const mementoObj = this._mementoContext.getMemento(StorageScope.APPLICATION, StorageTarget.MACHINE);
this._accountStore = this._instantiationService.createInstance(AccountStore, mementoObj);
// Setup the event emitters

View File

@@ -123,7 +123,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
this._connectionStatusManager = _instantiationService.createInstance(ConnectionStatusManager);
if (this._storageService) {
this._mementoContext = new Memento(ConnectionManagementService.CONNECTION_MEMENTO, this._storageService);
this._mementoObj = this._mementoContext.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
this._mementoObj = this._mementoContext.getMemento(StorageScope.APPLICATION, StorageTarget.MACHINE);
}
this.initializeConnectionProvidersMap();

View File

@@ -12,6 +12,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
/* eslint-disable */
/**
* Resolves the given file path using the VS ConfigurationResolver service, replacing macros such as
* ${workspaceRoot} with their expected values and then testing each path to see if it exists. It will
@@ -58,3 +59,4 @@ export async function resolveQueryFilePath(services: ServicesAccessor, filePath?
throw Error(localize('insightsDidNotFindResolvedFile', "Could not find query file at any of the following paths :\n {0}", resolvedFileUris.map(uri => uri.fsPath).join('\n')));
}
/* eslint-enable */

View File

@@ -15,7 +15,7 @@ import { INotebookEditOperation } from 'sql/workbench/api/common/sqlExtHostTypes
import { ICellModel, INotebookModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
import { NotebookChangeType, CellType } from 'sql/workbench/services/notebook/common/contracts';
import { IBootstrapParams } from 'sql/workbench/services/bootstrap/common/bootstrapParams';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { AbstractTextCodeEditor } from 'vs/workbench/browser/parts/editor/textCodeEditor';
import { Range } from 'vs/editor/common/core/range';
import { IEditorPane } from 'vs/workbench/common/editor';
import { INotebookInput } from 'sql/workbench/services/notebook/browser/interface';
@@ -196,7 +196,7 @@ export interface INotebookSection {
export interface ICellEditorProvider {
isCellOutput: boolean;
cellGuid(): string;
getEditor(): BaseTextEditor<ICodeEditorViewState> | undefined;
getEditor(): AbstractTextCodeEditor<ICodeEditorViewState> | undefined;
deltaDecorations(newDecorationsRange: NotebookRange | NotebookRange[], oldDecorationsRange: NotebookRange | NotebookRange[]): void;
}

View File

@@ -866,11 +866,11 @@ export class NotebookService extends Disposable implements INotebookService {
}
private get providersMemento(): NotebookProvidersMemento {
return this._providersMemento.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE) as NotebookProvidersMemento;
return this._providersMemento.getMemento(StorageScope.APPLICATION, StorageTarget.MACHINE) as NotebookProvidersMemento;
}
private get trustedNotebooksMemento(): TrustedNotebooksMemento {
let cache = this._trustedNotebooksMemento.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE) as TrustedNotebooksMemento;
let cache = this._trustedNotebooksMemento.getMemento(StorageScope.APPLICATION, StorageTarget.MACHINE) as TrustedNotebooksMemento;
if (!cache.trustedNotebooksCache) {
cache.trustedNotebooksCache = {};
}

View File

@@ -12,12 +12,11 @@ import { IAsyncDataTreeNode, IAsyncDataTreeUpdateChildrenOptions } from 'vs/base
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { IAsyncDataSource, ITreeRenderer } from 'vs/base/browser/ui/tree/tree';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGroup, ServerTreeElement, FuzzyScore> {
@@ -32,14 +31,13 @@ export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGro
@IListService listService: IListService,
@IThemeService themeService: IThemeService,
@IConfigurationService configurationService: IConfigurationService,
@IKeybindingService keybindingService: IKeybindingService,
@IAccessibilityService accessibilityService: IAccessibilityService,
@IInstantiationService instantiationService: IInstantiationService
) {
super(
user, container, delegate,
renderers, dataSource, options,
contextKeyService, listService,
themeService, configurationService, keybindingService, accessibilityService);
instantiationService, contextKeyService, listService,
themeService, configurationService);
// Adding support for expand/collapse on enter/space
this.onKeyDown(e => {

View File

@@ -72,7 +72,7 @@ export class ProfilerService implements IProfilerService {
@IStorageService private _storageService: IStorageService
) {
this._context = new Memento('ProfilerEditor', this._storageService);
this._memento = this._context.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
this._memento = this._context.getMemento(StorageScope.APPLICATION, StorageTarget.MACHINE);
}
public registerProvider(providerId: string, provider: azdata.ProfilerProvider): void {