mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 09:35:37 -05:00
Final layering (#9164)
* move handling generated files to the serilization classes * remove unneeded methods * add more folders to strictire compile, add more strict compile options * update ci * wip * add more layering and fix issues * add more strictness * remove unnecessary assertion * add missing checks * fix indentation * wip * remove jsdoc * fix layering * fix compile * fix compile errors * wip * wip * finish layering * fix css * more layering * rip * reworking results serializer * move some files around * move capabilities to platform wip * implement capabilities register provider * fix capabilities service * fix usage of the regist4ry * add contribution * wip * wip * wip * remove no longer good parts * fix strict-nulls * fix issues with startup * another try * fix startup * fix imports * fix tests * fix tests * fix more tests * fix tests * fix more tests * fix broken test * fix tabbing * fix naming * wip * finished layering * fix imports * fix valid layers * fix layers * wip * finish layering * final layering * finish layering * fix spacing
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
|
||||
export class FileNotebookInput extends NotebookInput {
|
||||
public static ID: string = 'workbench.editorinputs.fileNotebookInput';
|
||||
|
||||
constructor(
|
||||
title: string,
|
||||
resource: URI,
|
||||
textInput: FileEditorInput,
|
||||
@ITextModelService textModelService: ITextModelService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@INotebookService notebookService: INotebookService,
|
||||
@IExtensionService extensionService: IExtensionService
|
||||
) {
|
||||
super(title, resource, textInput, textModelService, instantiationService, notebookService, extensionService);
|
||||
}
|
||||
|
||||
public get textInput(): FileEditorInput {
|
||||
return super.textInput as FileEditorInput;
|
||||
}
|
||||
|
||||
public getPreferredMode(): string {
|
||||
return this.textInput.getPreferredMode();
|
||||
}
|
||||
|
||||
public setMode(mode: string): void {
|
||||
this.textInput.setMode(mode);
|
||||
}
|
||||
|
||||
public setPreferredMode(mode: string): void {
|
||||
this.textInput.setPreferredMode(mode);
|
||||
}
|
||||
|
||||
public getTypeId(): string {
|
||||
return FileNotebookInput.ID;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEditorInputFactory, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FILE_EDITOR_INPUT_ID } from 'vs/workbench/contrib/files/common/files';
|
||||
import { FileNotebookInput } from 'sql/workbench/contrib/notebook/common/models/fileNotebookInput';
|
||||
import { UntitledNotebookInput } from 'sql/workbench/contrib/notebook/common/models/untitledNotebookInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { ILanguageAssociation } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
|
||||
const editorInputFactoryRegistry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
|
||||
|
||||
export class NotebookEditorInputAssociation implements ILanguageAssociation {
|
||||
static readonly languages = ['notebook'];
|
||||
|
||||
constructor(@IInstantiationService private readonly instantiationService: IInstantiationService) { }
|
||||
|
||||
convertInput(activeEditor: IEditorInput): NotebookInput {
|
||||
if (activeEditor instanceof FileEditorInput) {
|
||||
return this.instantiationService.createInstance(FileNotebookInput, activeEditor.getName(), activeEditor.resource, activeEditor);
|
||||
} else if (activeEditor instanceof UntitledTextEditorInput) {
|
||||
return this.instantiationService.createInstance(UntitledNotebookInput, activeEditor.getName(), activeEditor.resource, activeEditor);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
createBase(activeEditor: NotebookInput): IEditorInput {
|
||||
return activeEditor.textInput;
|
||||
}
|
||||
}
|
||||
|
||||
export class FileNoteBookEditorInputFactory implements IEditorInputFactory {
|
||||
serialize(editorInput: FileNotebookInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(FILE_EDITOR_INPUT_ID);
|
||||
if (factory) {
|
||||
return factory.serialize(editorInput.textInput); // serialize based on the underlying input
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileNotebookInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(FILE_EDITOR_INPUT_ID);
|
||||
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
|
||||
return instantiationService.createInstance(FileNotebookInput, fileEditorInput.getName(), fileEditorInput.resource, fileEditorInput);
|
||||
}
|
||||
|
||||
canSerialize(): boolean { // we can always serialize notebooks
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class UntitledNoteBookEditorInputFactory implements IEditorInputFactory {
|
||||
serialize(editorInput: UntitledNotebookInput): string {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(UntitledTextEditorInput.ID);
|
||||
if (factory) {
|
||||
return factory.serialize(editorInput.textInput); // serialize based on the underlying input
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledNotebookInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(UntitledTextEditorInput.ID);
|
||||
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
|
||||
return instantiationService.createInstance(UntitledNotebookInput, untitledEditorInput.getName(), untitledEditorInput.resource, untitledEditorInput);
|
||||
}
|
||||
|
||||
canSerialize(): boolean { // we can always serialize notebooks
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
|
||||
export class UntitledNotebookInput extends NotebookInput {
|
||||
public static ID: string = 'workbench.editorinputs.untitledNotebookInput';
|
||||
|
||||
constructor(
|
||||
title: string,
|
||||
resource: URI,
|
||||
textInput: UntitledTextEditorInput,
|
||||
@ITextModelService textModelService: ITextModelService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@INotebookService notebookService: INotebookService,
|
||||
@IExtensionService extensionService: IExtensionService
|
||||
) {
|
||||
super(title, resource, textInput, textModelService, instantiationService, notebookService, extensionService);
|
||||
}
|
||||
|
||||
public get textInput(): UntitledTextEditorInput {
|
||||
return super.textInput as UntitledTextEditorInput;
|
||||
}
|
||||
|
||||
public setMode(mode: string): void {
|
||||
this.textInput.setMode(mode);
|
||||
}
|
||||
|
||||
isUntitled(): boolean {
|
||||
// Subclasses need to explicitly opt-in to being untitled.
|
||||
return true;
|
||||
}
|
||||
|
||||
public getTypeId(): string {
|
||||
return UntitledNotebookInput.ID;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user