mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
Add Notebook Views dropdown (#16228)
This adds the entry point to NVs. It is currently hidden behind a feature flag, which can be enabled in the settings.
This commit is contained in:
@@ -20,6 +20,7 @@ import { Range } from 'vs/editor/common/core/range';
|
||||
import { IEditorPane } from 'vs/workbench/common/editor';
|
||||
import { INotebookInput } from 'sql/workbench/services/notebook/browser/interface';
|
||||
import { INotebookShowOptions } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { NotebookViewsExtension } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViewsExtension';
|
||||
|
||||
export const SERVICE_ID = 'sqlNotebookService';
|
||||
export const INotebookService = createDecorator<INotebookService>(SERVICE_ID);
|
||||
@@ -210,6 +211,7 @@ export interface INotebookEditor {
|
||||
readonly cellEditors: ICellEditorProvider[];
|
||||
readonly modelReady: Promise<INotebookModel>;
|
||||
readonly model: INotebookModel | null;
|
||||
readonly views: NotebookViewsExtension | null;
|
||||
isDirty(): boolean;
|
||||
isActive(): boolean;
|
||||
isVisible(): boolean;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ICellModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { ICellModel, INotebookModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
export type CellChangeEventType = 'hide' | 'insert' | 'active';
|
||||
@@ -62,3 +62,16 @@ export interface INotebookViewMetadata {
|
||||
export interface INotebookViewCellMetadata {
|
||||
views: INotebookViewCell[];
|
||||
}
|
||||
|
||||
export interface INotebookViews {
|
||||
onViewDeleted: Event<void>;
|
||||
notebook: INotebookModel;
|
||||
|
||||
createNewView(name?: string): INotebookView;
|
||||
removeView(guid: string): void;
|
||||
generateDefaultViewName(): string;
|
||||
getViews(): INotebookView[];
|
||||
getActiveView(): INotebookView;
|
||||
setActiveView(view: INotebookView): void;
|
||||
viewNameIsTaken(name: string): boolean;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { localize } from 'vs/nls';
|
||||
import { NotebookViewModel } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViewModel';
|
||||
import { NotebookExtension } from 'sql/workbench/services/notebook/browser/models/notebookExtension';
|
||||
import { INotebookView, INotebookViewCell, INotebookViewCellMetadata, INotebookViewMetadata } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViews';
|
||||
import { INotebookView, INotebookViewCell, INotebookViewCellMetadata, INotebookViewMetadata, INotebookViews } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViews';
|
||||
|
||||
export class NotebookViewsExtension extends NotebookExtension<INotebookViewMetadata, INotebookViewCellMetadata> {
|
||||
export class NotebookViewsExtension extends NotebookExtension<INotebookViewMetadata, INotebookViewCellMetadata> implements INotebookViews {
|
||||
static readonly defaultViewName = localize('notebookView.untitledView', "Untitled View");
|
||||
|
||||
readonly maxNameIterationAttempts = 100;
|
||||
|
||||
Reference in New Issue
Block a user