Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)

* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2

* update distro

* fix layering

* update distro

* fix tests
This commit is contained in:
Anthony Dresser
2020-01-22 13:42:37 -08:00
committed by GitHub
parent 977111eb21
commit bd7aac8ee0
895 changed files with 24651 additions and 14520 deletions

View File

@@ -458,7 +458,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
};
let isUntitled: boolean = uri.scheme === Schemas.untitled;
const fileInput = isUntitled ? this._untitledEditorService.createOrGet(uri, 'notebook', options.initialContent) :
const fileInput = isUntitled ? this._untitledEditorService.create({ associatedResource: uri, mode: 'notebook', initialValue: options.initialContent }) :
this._editorService.createInput({ resource: uri, mode: 'notebook' });
let input: NotebookInput;
if (isUntitled) {

View File

@@ -44,9 +44,10 @@ export class CategoryView extends ViewPane {
@IKeybindingService keybindingService: IKeybindingService,
@IContextMenuService contextMenuService: IContextMenuService,
@IConfigurationService configurationService: IConfigurationService,
@IContextKeyService contextKeyService: IContextKeyService
@IContextKeyService contextKeyService: IContextKeyService,
@IInstantiationService instantiationService: IInstantiationService
) {
super(options, keybindingService, contextMenuService, configurationService, contextKeyService);
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService);
}
// we want a fixed size, so when we render to will measure our content and set that to be our

View File

@@ -17,15 +17,15 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import { ComponentBase } from 'sql/workbench/browser/modelComponents/componentBase';
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/workbench/browser/modelComponents/interfaces';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SimpleEditorProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { TextDiffEditor } from 'vs/workbench/browser/parts/editor/textDiffEditor';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { TextDiffEditorModel } from 'vs/workbench/common/editor/textDiffEditorModel';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { ITextModel } from 'vs/editor/common/model';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SimpleProgressIndicator } from 'sql/workbench/services/progress/browser/simpleProgressIndicator';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
@Component({
template: `
@@ -69,8 +69,8 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
}
private _createEditor(): void {
this._instantiationService = this._instantiationService.createChild(new ServiceCollection([IEditorProgressService, new SimpleEditorProgressService()]));
this._editor = this._instantiationService.createInstance(TextDiffEditor);
const customInstan = this._instantiationService.createChild(new ServiceCollection([IEditorProgressService, new SimpleProgressIndicator()]));
this._editor = customInstan.createInstance(TextDiffEditor);
this._editor.reverseColoring();
this._editor.create(this._el.nativeElement);
this._editor.setVisible(true);

View File

@@ -19,11 +19,11 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import { ComponentBase } from 'sql/workbench/browser/modelComponents/componentBase';
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/workbench/browser/modelComponents/interfaces';
import { QueryTextEditor } from 'sql/workbench/browser/modelComponents/queryTextEditor';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SimpleEditorProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { ILogService } from 'vs/platform/log/common/log';
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { SimpleProgressIndicator } from 'sql/workbench/services/progress/browser/simpleProgressIndicator';
@Component({
template: '',
@@ -61,12 +61,12 @@ export default class EditorComponent extends ComponentBase implements IComponent
}
private async _createEditor(): Promise<void> {
let instantiationService = this._instantiationService.createChild(new ServiceCollection([IProgressService, new SimpleEditorProgressService()]));
this._editor = instantiationService.createInstance(QueryTextEditor);
const customInstan = this._instantiationService.createChild(new ServiceCollection([IEditorProgressService, new SimpleProgressIndicator()]));
this._editor = customInstan.createInstance(QueryTextEditor);
this._editor.create(this._el.nativeElement);
this._editor.setVisible(true);
let uri = this.createUri();
this._editorInput = instantiationService.createInstance(UntitledTextEditorInput, uri, false, 'plaintext', '', '');
this._editorInput = this._instantiationService.createInstance(UntitledTextEditorInput, uri, false, 'plaintext', '', '');
await this._editor.setInput(this._editorInput, undefined);
const model = await this._editorInput.resolve();
this._editorModel = model.textEditorModel;

View File

@@ -16,13 +16,13 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { EditorOptions } from 'vs/workbench/common/editor';
import { StandaloneCodeEditor } from 'vs/editor/standalone/browser/standaloneCodeEditor';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
/**
* Extension of TextResourceEditor that is always readonly rather than only with non UntitledInputs
@@ -56,7 +56,7 @@ export class QueryTextEditor extends BaseTextEditor {
}
public createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
return this.instantiationService.createInstance(StandaloneCodeEditor, parent, configuration);
return this.instantiationService.createInstance(CodeEditorWidget, parent, configuration, {});
}
protected getConfigurationOverrides(): IEditorOptions {

View File

@@ -87,8 +87,8 @@ export default class SplitViewContainer extends ContainerBase<FlexItemLayout> im
let c = component as ComponentBase;
let basicView: SplitPane = new SplitPane();
basicView.orientation = orientation;
basicView.element = c.getHtml(),
basicView.component = c;
basicView.element = c.getHtml();
basicView.component = c;
basicView.minimumSize = 50;
basicView.maximumSize = Number.MAX_VALUE;
return basicView;

View File

@@ -62,8 +62,9 @@ export class CustomTreeViewPanel extends ViewPane {
@IContextMenuService contextMenuService: IContextMenuService,
@IConfigurationService configurationService: IConfigurationService,
@IContextKeyService contextKeyService: IContextKeyService,
@IInstantiationService instantiationService: IInstantiationService
) {
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService);
const { treeView } = (<ITreeViewDescriptor>Registry.as<IViewsRegistry>(Extensions.ViewsRegistry).getView(options.id));
this.treeView = treeView as ITreeView;
this._register(this.treeView.onDidChangeActions(() => this.updateActions(), this));

View File

@@ -5,7 +5,7 @@
import { Action } from 'vs/base/common/actions';
import { IOpenerService } from 'vs/platform/opener/common/opener';
//tslint:disable-next-line:layering
// eslint-disable-next-line code-layering
import { IElectronService } from 'vs/platform/electron/node/electron';
import { URI } from 'vs/base/common/uri';

View File

@@ -46,11 +46,11 @@ class AccountPanel extends ViewPane {
@IKeybindingService keybindingService: IKeybindingService,
@IContextMenuService contextMenuService: IContextMenuService,
@IConfigurationService configurationService: IConfigurationService,
@IInstantiationService private instantiationService: IInstantiationService,
@IThemeService private themeService: IThemeService,
@IContextKeyService contextKeyService: IContextKeyService
@IContextKeyService contextKeyService: IContextKeyService,
@IInstantiationService instantiationService: IInstantiationService
) {
super(options, keybindingService, contextMenuService, configurationService, contextKeyService);
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService);
}
protected renderBody(container: HTMLElement): void {
@@ -294,9 +294,9 @@ export class AccountDialog extends Modal {
this._keybindingService,
this._contextMenuService,
this._configurationService,
this._instantiationService,
this._themeService,
this.contextKeyService
this.contextKeyService,
this._instantiationService
);
attachPanelStyler(providerView, this._themeService);

View File

@@ -72,7 +72,7 @@ export class CreateInsightAction extends Action {
}
};
let input = this.untitledEditorService.createOrGet(undefined, 'json', JSON.stringify(widgetConfig));
let input = this.untitledEditorService.create({ mode: 'json', initialValue: JSON.stringify(widgetConfig) });
return this.editorService.openEditor(input, { pinned: true })
.then(
@@ -155,7 +155,7 @@ export class SaveImageAction extends Action {
if (context.insight instanceof Graph) {
let fileFilters = new Array<FileFilter>({ extensions: ['png'], name: localize('resultsSerializer.saveAsFileExtensionPNGTitle', "PNG") });
const filePath = await this.fileDialogService.pickFileToSave({ filters: fileFilters });
const filePath = await this.fileDialogService.showSaveDialog({ filters: fileFilters });
const data = (<Graph>context.insight).getCanvasData();
if (!data) {
this.notificationService.error(localize('chartNotFound', "Could not find chart to save"));

View File

@@ -10,7 +10,7 @@ import { TestLayoutService } from 'vs/workbench/test/workbenchTestServices';
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { SimpleNotificationService } from 'vs/editor/standalone/browser/simpleServices';
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
suite('Chart View', () => {
test('initializes without error', () => {
@@ -29,7 +29,7 @@ function createChartView(): ChartView {
const contextViewService = new ContextViewService(layoutService);
const themeService = new TestThemeService();
const instantiationService = new TestInstantiationService();
const notificationService = new SimpleNotificationService();
const notificationService = new TestNotificationService();
instantiationService.stub(IThemeService, themeService);
return new ChartView(contextViewService, themeService, instantiationService, notificationService);
}

View File

@@ -34,7 +34,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
import { isUndefinedOrNull } from 'vs/base/common/types';
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
import { SimpleUriLabelService } from 'vs/editor/standalone/browser/simpleServices';
import { LabelService } from 'vs/workbench/services/label/common/labelService';
class TestParsedArgs implements ParsedArgs {
[arg: string]: any;
@@ -393,7 +393,7 @@ suite('commandLineService tests', () => {
querymodelService.setup(c => c.onRunQueryComplete).returns(() => Event.None);
const instantiationService = new TestInstantiationService();
let uri = URI.file(args._[0]);
const untitledEditorInput = new UntitledTextEditorInput(uri, false, '', '', '', instantiationService, undefined, new SimpleUriLabelService(), undefined, undefined, undefined);
const untitledEditorInput = new UntitledTextEditorInput(uri, false, '', '', '', instantiationService, undefined, new LabelService(undefined, undefined), undefined, undefined, undefined);
const queryInput = new UntitledQueryEditorInput(undefined, untitledEditorInput, undefined, connectionManagementService.object, querymodelService.object, configurationService.object, undefined);
queryInput.state.connected = true;
const editorService: TypeMoq.Mock<IEditorService> = TypeMoq.Mock.ofType<IEditorService>(TestEditorService, TypeMoq.MockBehavior.Strict);

View File

@@ -1,33 +0,0 @@
<!--
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-->
<div class="fullsize" style="display: flex; flex-direction: column">
<div scrollable [horizontalScroll]="ScrollbarVisibility.Auto" [verticalScroll]="ScrollbarVisibility.Auto">
<table class="grid-table">
<tr *ngFor="let row of rows" class="grid-table-row">
<ng-container *ngFor="let col of cols">
<ng-container *ngIf="getContent(row,col) !== undefined">
<td class="table-cell" [colSpan]=getColspan(row,col) [rowSpan]=getRowspan(row,col)
[width]="getWidgetWidth(row,col)" [height]="getWidgetHeight(row,col)">
<dashboard-widget-wrapper *ngIf="isWidget(row,col)" [_config]="getWidgetContent(row,col)"
style="position:absolute;" [style.width]="getWidgetWidth(row,col)"
[style.height]="getWidgetHeight(row,col)">
</dashboard-widget-wrapper>
<webview-content *ngIf="isWebview(row,col)" [webviewId]="getWebviewId(row,col)">
</webview-content>
<modelview-content *ngIf="isModelView(row,col)" [modelViewId]="getModelViewId(row,col)">
</modelview-content>
</td>
</ng-container>
</ng-container>
</tr>
</table>
</div>
</div>

View File

@@ -15,10 +15,10 @@ import { WebviewContent } from 'sql/workbench/contrib/dashboard/browser/contents
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
import { Event, Emitter } from 'vs/base/common/event';
import { ScrollbarVisibility } from 'vs/editor/common/standalone/standaloneEnums';
import { ScrollableDirective } from 'sql/base/browser/ui/scrollable/scrollable.directive';
import { values } from 'vs/base/common/collections';
import { fill } from 'vs/base/common/arrays';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
export interface GridCellConfig {
id?: string;
@@ -46,7 +46,35 @@ export interface GridModelViewConfig extends GridCellConfig {
@Component({
selector: 'dashboard-grid-container',
templateUrl: decodeURI(require.toUrl('./dashboardGridContainer.component.html')),
template: `
<div class="fullsize" style="display: flex; flex-direction: column">
<div scrollable [horizontalScroll]="${ScrollbarVisibility.Auto}" [verticalScroll]="${ScrollbarVisibility.Auto}">
<table class="grid-table">
<tr *ngFor="let row of rows" class="grid-table-row">
<ng-container *ngFor="let col of cols">
<ng-container *ngIf="getContent(row,col) !== undefined">
<td class="table-cell" [colSpan]=getColspan(row,col) [rowSpan]=getRowspan(row,col)
[width]="getWidgetWidth(row,col)" [height]="getWidgetHeight(row,col)">
<dashboard-widget-wrapper *ngIf="isWidget(row,col)" [_config]="getWidgetContent(row,col)"
style="position:absolute;" [style.width]="getWidgetWidth(row,col)"
[style.height]="getWidgetHeight(row,col)">
</dashboard-widget-wrapper>
<webview-content *ngIf="isWebview(row,col)" [webviewId]="getWebviewId(row,col)">
</webview-content>
<modelview-content *ngIf="isModelView(row,col)" [modelViewId]="getModelViewId(row,col)">
</modelview-content>
</td>
</ng-container>
</ng-container>
</tr>
</table>
</div>
</div>
`,
providers: [{ provide: TabChild, useExisting: forwardRef(() => DashboardGridContainer) }]
})
export class DashboardGridContainer extends DashboardTab implements OnDestroy {
@@ -56,7 +84,6 @@ export class DashboardGridContainer extends DashboardTab implements OnDestroy {
public readonly onResize: Event<void> = this._onResize.event;
private cellWidth: number = 270;
private cellHeight: number = 270;
public ScrollbarVisibility = ScrollbarVisibility;
protected SKELETON_WIDTH = 5;

View File

@@ -17,14 +17,14 @@ import { ScrollableDirective } from 'sql/base/browser/ui/scrollable/scrollable.d
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ScrollbarVisibility } from 'vs/editor/common/standalone/standaloneEnums';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
@Component({
selector: 'dashboard-home-container',
providers: [{ provide: TabChild, useExisting: forwardRef(() => DashboardHomeContainer) }],
template: `
<div class="fullsize" style="display: flex; flex-direction: column">
<div scrollable [horizontalScroll]="ScrollbarVisibility.Hidden" [verticalScroll]="ScrollbarVisibility.Auto">
<div scrollable [horizontalScroll]="${ScrollbarVisibility.Hidden}" [verticalScroll]="${ScrollbarVisibility.Auto}">
<dashboard-widget-wrapper #propertiesClass *ngIf="properties" [collapsable]="true" [_config]="properties"
style="padding-left: 10px; padding-right: 10px; display: block; flex: 0" [style.height.px]="_propertiesClass?.collapsed ? '30' : '90'">
</dashboard-widget-wrapper>
@@ -39,8 +39,6 @@ export class DashboardHomeContainer extends DashboardWidgetContainer {
@ViewChild('propertiesClass') private _propertiesClass: DashboardWidgetWrapper;
@ContentChild(ScrollableDirective) private _scrollable: ScrollableDirective;
public ScrollbarVisibility = ScrollbarVisibility;
constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef,
@Inject(forwardRef(() => CommonServiceInterface)) protected dashboardService: DashboardServiceInterface,

View File

@@ -35,12 +35,12 @@ export class ConnectionViewletPanel extends ViewPane {
private options: IViewletViewOptions,
@IKeybindingService keybindingService: IKeybindingService,
@IContextMenuService contextMenuService: IContextMenuService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IInstantiationService instantiationService: IInstantiationService,
@IConfigurationService configurationService: IConfigurationService,
@IObjectExplorerService private readonly objectExplorerService: IObjectExplorerService,
@IContextKeyService contextKeyService: IContextKeyService
) {
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService);
this._addServerAction = this.instantiationService.createInstance(AddServerAction,
AddServerAction.ID,
AddServerAction.LABEL);

View File

@@ -16,6 +16,7 @@ import { coalesce } from 'vs/base/common/arrays';
import { CustomTreeViewPanel, CustomTreeView } from 'sql/workbench/browser/parts/views/customView';
import { VIEWLET_ID } from 'sql/workbench/contrib/dataExplorer/browser/dataExplorerViewlet';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
interface IUserFriendlyViewDescriptor {
id: string;
@@ -105,11 +106,13 @@ export class DataExplorerContainerExtensionHandler implements IWorkbenchContribu
const viewDescriptor = <ITreeViewDescriptor>{
id: item.id,
name: item.name,
ctorDescriptor: { ctor: CustomTreeViewPanel },
ctorDescriptor: new SyncDescriptor(CustomTreeViewPanel),
when: ContextKeyExpr.deserialize(item.when),
canToggleVisibility: true,
collapsed: this.showCollapsed(container),
treeView: this.instantiationService.createInstance(CustomTreeView, item.id, item.name, container)
treeView: this.instantiationService.createInstance(CustomTreeView, item.id, item.name, container),
extensionId: extension.description.identifier,
originalContainerId: entry.key
};
viewIds.push(viewDescriptor.id);
@@ -129,15 +132,15 @@ export class DataExplorerContainerExtensionHandler implements IWorkbenchContribu
for (let descriptor of viewDescriptors) {
if (typeof descriptor.id !== 'string') {
collector.error(localize('requirestring', "property `{0}` is mandatory and must be of type `string`", "id"));
collector.error(localize('requirestring', "property `{0}` is mandatory and must be of type `string`", 'id'));
return false;
}
if (typeof descriptor.name !== 'string') {
collector.error(localize('requirestring', "property `{0}` is mandatory and must be of type `string`", "name"));
collector.error(localize('requirestring', "property `{0}` is mandatory and must be of type `string`", 'name'));
return false;
}
if (descriptor.when && typeof descriptor.when !== 'string') {
collector.error(localize('optstring', "property `{0}` can be omitted or must be of type `string`", "when"));
collector.error(localize('optstring', "property `{0}` can be omitted or must be of type `string`", 'when'));
return false;
}
}

View File

@@ -27,6 +27,7 @@ import { ShowViewletAction, Viewlet } from 'vs/workbench/browser/viewlet';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { ViewPaneContainer, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
export const VIEWLET_ID = 'workbench.view.connections';
@@ -62,7 +63,7 @@ export class DataExplorerViewletViewsContribution implements IWorkbenchContribut
return {
id: ConnectionViewletPanel.ID,
name: localize('dataExplorer.servers', "Servers"),
ctorDescriptor: { ctor: ConnectionViewletPanel },
ctorDescriptor: new SyncDescriptor(ConnectionViewletPanel),
weight: 100,
canToggleVisibility: true,
order: 0
@@ -159,6 +160,6 @@ export class DataExplorerViewPaneContainer extends ViewPaneContainer {
export const VIEW_CONTAINER = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({
id: VIEWLET_ID,
name: localize('dataexplorer.name', "Connections"),
ctorDescriptor: { ctor: DataExplorerViewPaneContainer },
ctorDescriptor: new SyncDescriptor(DataExplorerViewPaneContainer),
icon: 'dataExplorer'
}, ViewContainerLocation.Sidebar);

View File

@@ -217,7 +217,6 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
return this._connectionManagementService.getTabColorForUri(this.uri);
}
public get onDidModelChangeContent(): Event<void> { return this._sql.onDidModelChangeContent; }
public get onDidModelChangeEncoding(): Event<void> { return this._sql.onDidModelChangeEncoding; }
public resolve(refresh?: boolean): Promise<EditorModel> { return this._sql.resolve(); }
public getEncoding(): string { return this._sql.getEncoding(); }

View File

@@ -15,9 +15,6 @@ import { NotebookModel } from 'sql/workbench/contrib/notebook/browser/models/not
import { IColorTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import * as themeColors from 'vs/workbench/common/theme';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SimpleEditorProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITextModel } from 'vs/editor/common/model';
import * as DOM from 'vs/base/browser/dom';
@@ -35,6 +32,9 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { CellView } from 'sql/workbench/contrib/notebook/browser/cellViews/interfaces';
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
import { UntitledTextEditorModel } from 'vs/workbench/common/editor/untitledTextEditorModel';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { SimpleProgressIndicator } from 'sql/workbench/services/progress/browser/simpleProgressIndicator';
export const CODE_SELECTOR: string = 'code-component';
const MARKDOWN_CLASS = 'markdown';
@@ -200,8 +200,8 @@ export class CodeComponent extends CellView implements OnInit, OnChanges {
}
private async createEditor(): Promise<void> {
let instantiationService = this._instantiationService.createChild(new ServiceCollection([IProgressService, new SimpleEditorProgressService()]));
this._editor = instantiationService.createInstance(QueryTextEditor);
const customInstan = this._instantiationService.createChild(new ServiceCollection([IEditorProgressService, new SimpleProgressIndicator()]));
this._editor = customInstan.createInstance(QueryTextEditor);
this._editor.create(this.codeElement.nativeElement);
this._editor.setVisible(true);
this._editor.setMinimumHeight(this._minimumHeight);
@@ -210,7 +210,7 @@ export class CodeComponent extends CellView implements OnInit, OnChanges {
let uri = this.cellModel.cellUri;
let cellModelSource: string;
cellModelSource = Array.isArray(this.cellModel.source) ? this.cellModel.source.join('') : this.cellModel.source;
this._editorInput = instantiationService.createInstance(UntitledTextEditorInput, uri, false, this.cellModel.language, cellModelSource, '');
this._editorInput = this._instantiationService.createInstance(UntitledTextEditorInput, uri, false, this.cellModel.language, cellModelSource, '');
await this._editor.setInput(this._editorInput, undefined);
this.setFocusAndScroll();

View File

@@ -16,7 +16,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { INotebookModel, IContentManager, NotebookContentChange } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
import { Schemas } from 'vs/base/common/network';
import { StateChange, ITextFileSaveOptions } from 'vs/workbench/services/textfile/common/textfiles';
import { ITextFileSaveOptions } from 'vs/workbench/services/textfile/common/textfiles';
import { LocalContentManager } from 'sql/workbench/services/notebook/common/localContentManager';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
@@ -73,12 +73,14 @@ export class NotebookEditorModel extends EditorModel {
}));
} else {
if (this.textEditorModel instanceof TextFileEditorModel) {
this._register(this.textEditorModel.onDidStateChange(change => {
this._register(this.textEditorModel.onDidSave(() => {
let dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
this.setDirty(dirty);
this.sendNotebookSerializationStateChange();
}));
this._register(this.textEditorModel.onDidChangeDirty(() => {
let dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
this.setDirty(dirty);
if (change === StateChange.SAVED) {
this.sendNotebookSerializationStateChange();
}
}));
}
}

View File

@@ -14,12 +14,11 @@ import { UntitledNotebookInput } from 'sql/workbench/contrib/notebook/common/mod
import { FileNotebookInput } from 'sql/workbench/contrib/notebook/common/models/fileNotebookInput';
import { FileNoteBookEditorInputFactory, UntitledNoteBookEditorInputFactory, NotebookEditorInputAssociation } from 'sql/workbench/contrib/notebook/common/models/nodebookInputFactory';
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionsExtensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor, registerAction, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { SyncActionDescriptor, registerAction2, MenuRegistry, MenuId, Action2 } from 'vs/platform/actions/common/actions';
import { NotebookEditor } from 'sql/workbench/contrib/notebook/browser/notebookEditor';
import { NewNotebookAction } from 'sql/workbench/contrib/notebook/browser/notebookActions';
import { KeyMod } from 'vs/editor/common/standalone/standaloneBase';
import { KeyCode } from 'vs/base/common/keyCodes';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry';
import { GridOutputComponent } from 'sql/workbench/contrib/notebook/browser/outputs/gridOutput.component';
import { PlotlyOutputComponent } from 'sql/workbench/contrib/notebook/browser/outputs/plotlyOutput.component';
@@ -131,9 +130,15 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerWidgetContext, {
order: 1
});
registerAction({
id: 'workbench.action.setWorkspaceAndOpen',
handler: async (accessor, options: { forceNewWindow: boolean, folderPath: URI }) => {
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.setWorkspaceAndOpen',
title: localize('workbench.action.setWorkspaceAndOpen', "Set Workspace And Open")
});
}
run = async (accessor, options: { forceNewWindow: boolean, folderPath: URI }) => {
const viewletService = accessor.get(IViewletService);
const workspaceEditingService = accessor.get(IWorkspaceEditingService);
const hostService = accessor.get(IHostService);
@@ -150,7 +155,7 @@ registerAction({
else {
return hostService.reload();
}
}
};
});
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration);
@@ -167,14 +172,6 @@ configurationRegistry.registerConfiguration({
}
});
registerAction({
id: 'workbench.books.action.focusBooksExplorer',
handler: async (accessor) => {
const viewletService = accessor.get(IViewletService);
viewletService.openViewlet('workbench.view.extension.books-explorer', true);
}
});
/* *************** Output components *************** */
// Note: most existing types use the same component to render. In order to
// preserve correct rank order, we register it once for each different rank of

View File

@@ -142,8 +142,8 @@ suite('Notebook Editor Model', function (): void {
});
teardown(() => {
if (accessor && accessor.textFileService && accessor.textFileService.models) {
(<TextFileEditorModelManager>accessor.textFileService.models).clear();
if (accessor && accessor.textFileService && accessor.textFileService.files) {
(<TextFileEditorModelManager>accessor.textFileService.files).clear();
}
});
@@ -870,7 +870,7 @@ suite('Notebook Editor Model', function (): void {
async function createTextEditorModel(self: Mocha.ITestCallbackContext): Promise<NotebookEditorModel> {
let textFileEditorModel = instantiationService.createInstance(TextFileEditorModel, toResource.call(self, defaultUri.toString()), 'utf8', undefined);
(<TextFileEditorModelManager>accessor.textFileService.models).add(textFileEditorModel.resource, textFileEditorModel);
(<TextFileEditorModelManager>accessor.textFileService.files).add(textFileEditorModel.resource, textFileEditorModel);
await textFileEditorModel.load();
return new NotebookEditorModel(defaultUri, textFileEditorModel, mockNotebookService.object, testResourcePropertiesService);
}

View File

@@ -16,10 +16,10 @@ import { UntitledTextEditorModel } from 'vs/workbench/common/editor/untitledText
import { NodeStub, NotebookServiceStub } from 'sql/workbench/contrib/notebook/test/stubs';
import { basenameOrAuthority } from 'vs/base/common/resources';
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
import { SimpleUriLabelService } from 'vs/editor/standalone/browser/simpleServices';
import { IExtensionService, NullExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { INotebookService, IProviderInfo } from 'sql/workbench/services/notebook/browser/notebookService';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { LabelService } from 'vs/workbench/services/label/common/labelService';
suite('Notebook Input', function (): void {
const instantiationService = workbenchInstantiationService();
@@ -48,7 +48,7 @@ suite('Notebook Input', function (): void {
let untitledNotebookInput: UntitledNotebookInput;
setup(() => {
untitledTextInput = new UntitledTextEditorInput(untitledUri, false, '', '', '', instantiationService, undefined, new SimpleUriLabelService(), undefined, undefined, undefined);
untitledTextInput = new UntitledTextEditorInput(untitledUri, false, '', '', '', instantiationService, undefined, new LabelService(undefined, undefined), undefined, undefined, undefined);
untitledNotebookInput = new UntitledNotebookInput(
testTitle, untitledUri, untitledTextInput,
undefined, instantiationService, mockNotebookService.object, mockExtensionService.object);
@@ -169,7 +169,7 @@ suite('Notebook Input', function (): void {
assert.ok(untitledNotebookInput.matches(untitledNotebookInput), 'Input should match itself.');
let otherTestUri = URI.from({ scheme: Schemas.untitled, path: 'OtherTestPath' });
let otherTextInput = new UntitledTextEditorInput(otherTestUri, false, '', '', '', instantiationService, undefined, new SimpleUriLabelService(), undefined, undefined, undefined);
let otherTextInput = new UntitledTextEditorInput(otherTestUri, false, '', '', '', instantiationService, undefined, new LabelService(undefined, undefined), undefined, undefined, undefined);
let otherInput = instantiationService.createInstance(UntitledNotebookInput, 'OtherTestInput', otherTestUri, otherTextInput);
assert.strictEqual(untitledNotebookInput.matches(otherInput), false, 'Input should not match different input.');

View File

@@ -516,7 +516,7 @@ export class NodeStub implements Node {
get parentNode(): Node & ParentNode {
throw new Error('Method not implemented.');
}
get previousSibling(): Node {
get previousSibling(): ChildNode {
throw new Error('Method not implemented.');
}
nodeValue: string;

View File

@@ -16,13 +16,13 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { EditorOptions } from 'vs/workbench/common/editor';
import { StandaloneCodeEditor } from 'vs/editor/standalone/browser/standaloneCodeEditor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
class ProfilerResourceCodeEditor extends StandaloneCodeEditor {
class ProfilerResourceCodeEditor extends CodeEditorWidget {
// protected _getContributions(): IEditorContributionCtor[] {
// let contributions = super._getContributions();
@@ -53,7 +53,7 @@ export class ProfilerResourceEditor extends BaseTextEditor {
}
public createEditorControl(parent: HTMLElement, configuration: IEditorOptions): editorCommon.IEditor {
return this.instantiationService.createInstance(ProfilerResourceCodeEditor, parent, configuration);
return this.instantiationService.createInstance(ProfilerResourceCodeEditor, parent, configuration, {});
}
protected getConfigurationOverrides(): IEditorOptions {

View File

@@ -579,7 +579,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
let value = d.resultSubset.rows[0][event.cell.cell - 1];
let content = value.displayValue;
const input = this.untitledEditorService.createOrGet(undefined, column.isXml ? 'xml' : 'json', content);
const input = this.untitledEditorService.create({ mode: column.isXml ? 'xml' : 'json', initialValue: content });
const model = await input.resolve();
await this.instantiationService.invokeFunction(formatDocumentWithSelectedProvider, model.textEditorModel, FormattingMode.Explicit, CancellationToken.None);
return this.editorService.openEditor(input);

View File

@@ -21,7 +21,6 @@ export class UntitledQueryEditorInput extends QueryEditorInput implements IEncod
public static readonly ID = 'workbench.editorInput.untitledQueryInput';
public readonly onDidModelChangeContent = this.text.onDidModelChangeContent;
public readonly onDidModelChangeEncoding = this.text.onDidModelChangeEncoding;
constructor(

View File

@@ -33,7 +33,7 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
import { TestConnectionManagementService } from 'sql/platform/connection/test/common/testConnectionManagementService';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
import { SimpleUriLabelService } from 'vs/editor/standalone/browser/simpleServices';
import { LabelService } from 'vs/workbench/services/label/common/labelService';
suite('SQL QueryAction Tests', () => {
@@ -70,7 +70,7 @@ suite('SQL QueryAction Tests', () => {
connectionManagementService = TypeMoq.Mock.ofType<TestConnectionManagementService>(TestConnectionManagementService);
connectionManagementService.setup(q => q.onDisconnect).returns(() => Event.None);
const instantiationService = new TestInstantiationService();
let fileInput = new UntitledTextEditorInput(URI.parse('file://testUri'), false, '', '', '', instantiationService, undefined, new SimpleUriLabelService(), undefined, undefined, undefined);
let fileInput = new UntitledTextEditorInput(URI.parse('file://testUri'), false, '', '', '', instantiationService, undefined, new LabelService(undefined, undefined), undefined, undefined, undefined);
// Setup a reusable mock QueryInput
testQueryInput = TypeMoq.Mock.ofType(UntitledQueryEditorInput, TypeMoq.MockBehavior.Strict, undefined, fileInput, undefined, connectionManagementService.object, queryModelService.object, configurationService.object);
testQueryInput.setup(x => x.uri).returns(() => testUri);
@@ -175,7 +175,7 @@ suite('SQL QueryAction Tests', () => {
queryModelService.setup(x => x.onRunQueryStart).returns(() => Event.None);
queryModelService.setup(x => x.onRunQueryComplete).returns(() => Event.None);
const instantiationService = new TestInstantiationService();
let fileInput = new UntitledTextEditorInput(URI.parse('file://testUri'), false, '', '', '', instantiationService, undefined, new SimpleUriLabelService(), undefined, undefined, undefined);
let fileInput = new UntitledTextEditorInput(URI.parse('file://testUri'), false, '', '', '', instantiationService, undefined, new LabelService(undefined, undefined), undefined, undefined, undefined);
// ... Mock "isSelectionEmpty" in QueryEditor
let queryInput = TypeMoq.Mock.ofType(UntitledQueryEditorInput, TypeMoq.MockBehavior.Strict, undefined, fileInput, undefined, connectionManagementService.object, queryModelService.object, configurationService.object);
@@ -224,7 +224,7 @@ suite('SQL QueryAction Tests', () => {
// ... Mock "getSelection" in QueryEditor
const instantiationService = new TestInstantiationService();
let fileInput = new UntitledTextEditorInput(URI.parse('file://testUri'), false, '', '', '', instantiationService, undefined, new SimpleUriLabelService(), undefined, undefined, undefined);
let fileInput = new UntitledTextEditorInput(URI.parse('file://testUri'), false, '', '', '', instantiationService, undefined, new LabelService(undefined, undefined), undefined, undefined, undefined);
let queryInput = TypeMoq.Mock.ofType(UntitledQueryEditorInput, TypeMoq.MockBehavior.Loose, undefined, fileInput, undefined, connectionManagementService.object, queryModelService.object, configurationService.object);
queryInput.setup(x => x.uri).returns(() => testUri);

View File

@@ -24,7 +24,7 @@ import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledText
import { UntitledQueryEditorInput } from 'sql/workbench/contrib/query/common/untitledQueryEditorInput';
import { TestQueryModelService } from 'sql/platform/query/test/common/testQueryModelService';
import { Event } from 'vs/base/common/event';
import { SimpleUriLabelService } from 'vs/editor/standalone/browser/simpleServices';
import { LabelService } from 'vs/workbench/services/label/common/labelService';
suite('SQL QueryEditor Tests', () => {
let instantiationService: TypeMoq.Mock<InstantiationService>;
@@ -285,7 +285,7 @@ suite('SQL QueryEditor Tests', () => {
return new RunQueryAction(undefined, undefined, undefined);
});
let fileInput = new UntitledTextEditorInput(URI.parse('file://testUri'), false, '', '', '', instantiationService.object, undefined, new SimpleUriLabelService(), undefined, undefined, undefined);
let fileInput = new UntitledTextEditorInput(URI.parse('file://testUri'), false, '', '', '', instantiationService.object, undefined, new LabelService(undefined, undefined), undefined, undefined, undefined);
queryModelService = TypeMoq.Mock.ofType(TestQueryModelService, TypeMoq.MockBehavior.Strict);
queryModelService.setup(x => x.disposeQuery(TypeMoq.It.isAny()));
queryModelService.setup(x => x.onRunQueryComplete).returns(() => Event.None);

View File

@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
import { Disposable } from 'vs/base/common/lifecycle';
import { Table } from 'sql/base/browser/ui/table/table';
import { PlanXmlParser } from 'sql/workbench/contrib/queryPlan/common/planXmlParser';
import { PlanXmlParser } from 'sql/workbench/contrib/queryPlan/browser/planXmlParser';
import { IPanelView, IPanelTab } from 'sql/base/browser/ui/panel/panel';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { attachTableStyler } from 'sql/platform/theme/common/styler';

View File

@@ -62,9 +62,10 @@ class InsightTableView<T> extends ViewPane {
@IKeybindingService keybindingService: IKeybindingService,
@IContextMenuService contextMenuService: IContextMenuService,
@IConfigurationService configurationService: IConfigurationService,
@IContextKeyService contextKeyService: IContextKeyService
@IContextKeyService contextKeyService: IContextKeyService,
@IInstantiationService instantiationService: IInstantiationService
) {
super(options, keybindingService, contextMenuService, configurationService, contextKeyService);
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService);
}
protected renderBody(container: HTMLElement): void {

View File

@@ -0,0 +1,33 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IProgressIndicator, IProgressRunner } from 'vs/platform/progress/common/progress';
export class SimpleProgressIndicator implements IProgressIndicator {
show(infinite: true, delay?: number): IProgressRunner;
show(total: number, delay?: number): IProgressRunner;
show(total: any, delay?: any) {
return {
total: (total: number) => {
},
worked: (worked: number) => {
},
done: () => {
}
};
}
async showWhile(promise: Promise<any>, delay?: number): Promise<void> {
try {
await promise;
} catch (e) {
}
}
_serviceBrand: undefined;
}

View File

@@ -52,7 +52,7 @@ export class QueryEditorService implements IQueryEditorService {
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
// Create a sql document pane with accoutrements
const fileInput = this._untitledEditorService.createOrGet(docUri, 'sql');
const fileInput = this._untitledEditorService.create({ associatedResource: docUri, mode: 'sql' });
let untitledEditorModel = await fileInput.resolve();
if (sqlContent) {
untitledEditorModel.textEditorModel.setValue(sqlContent);
@@ -87,7 +87,7 @@ export class QueryEditorService implements IQueryEditorService {
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
// Create a sql document pane with accoutrements
const fileInput = this._untitledEditorService.createOrGet(docUri, 'sql');
const fileInput = this._untitledEditorService.create({ associatedResource: docUri, mode: 'sql' });
const m = await fileInput.resolve();
if (sqlContent) {
m.textEditorModel.setValue(sqlContent);