mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
no unverified commit
This commit is contained in:
@@ -9,7 +9,7 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { INotebookService, IMainNotebookController } from 'vs/workbench/contrib/notebook/browser/notebookService';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { ICell, IOutput, INotebook, INotebookMimeTypeSelector, NOTEBOOK_DISPLAY_ORDER, NotebookCellsSplice, NotebookCellOutputsSplice, generateCellPath } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { ICell, IOutput, INotebook, INotebookMimeTypeSelector, NOTEBOOK_DISPLAY_ORDER, NotebookCellsSplice, NotebookCellOutputsSplice, generateCellPath, CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { PieceTreeTextBufferFactory, PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
|
||||
|
||||
@@ -46,14 +46,14 @@ export class MainThreadCell implements ICell {
|
||||
public handle: number,
|
||||
public source: string[],
|
||||
public language: string,
|
||||
public cell_type: 'markdown' | 'code',
|
||||
public cellKind: CellKind,
|
||||
outputs: IOutput[]
|
||||
) {
|
||||
this._outputs = outputs;
|
||||
this.uri = URI.from({
|
||||
scheme: 'vscode-notebook',
|
||||
authority: parent.viewType,
|
||||
path: generateCellPath(cell_type, handle),
|
||||
path: generateCellPath(cellKind, handle),
|
||||
query: parent.uri.toString()
|
||||
});
|
||||
}
|
||||
@@ -131,10 +131,10 @@ export class MainThreadNotebookDocument extends Disposable implements INotebook
|
||||
this.activeCell = this._mapping.get(handle);
|
||||
}
|
||||
|
||||
async createRawCell(viewType: string, uri: URI, index: number, language: string, type: 'markdown' | 'code'): Promise<MainThreadCell | undefined> {
|
||||
async createRawCell(viewType: string, uri: URI, index: number, language: string, type: CellKind): Promise<MainThreadCell | undefined> {
|
||||
let cell = await this._proxy.$createEmptyCell(viewType, uri, index, language, type);
|
||||
if (cell) {
|
||||
let mainCell = new MainThreadCell(this, cell.handle, cell.source, cell.language, cell.cell_type, cell.outputs);
|
||||
let mainCell = new MainThreadCell(this, cell.handle, cell.source, cell.language, cell.cellKind, cell.outputs);
|
||||
this._mapping.set(cell.handle, mainCell);
|
||||
this.cells.splice(index, 0, mainCell);
|
||||
|
||||
@@ -178,7 +178,7 @@ export class MainThreadNotebookDocument extends Disposable implements INotebook
|
||||
splices.reverse().forEach(splice => {
|
||||
let cellDtos = splice[2];
|
||||
let newCells = cellDtos.map(cell => {
|
||||
let mainCell = new MainThreadCell(this, cell.handle, cell.source, cell.language, cell.cell_type, cell.outputs || []);
|
||||
let mainCell = new MainThreadCell(this, cell.handle, cell.source, cell.language, cell.cellKind, cell.outputs || []);
|
||||
this._mapping.set(cell.handle, mainCell);
|
||||
let dirtyStateListener = mainCell.onDidChangeDirtyState((cellState) => {
|
||||
this.isDirty = this.isDirty || cellState;
|
||||
@@ -365,7 +365,7 @@ export class MainThreadNotebookController implements IMainNotebookController {
|
||||
mainthreadNotebook?.updateActiveCell(cellHandle);
|
||||
}
|
||||
|
||||
async createRawCell(uri: URI, index: number, language: string, type: 'markdown' | 'code'): Promise<ICell | undefined> {
|
||||
async createRawCell(uri: URI, index: number, language: string, type: CellKind): Promise<ICell | undefined> {
|
||||
let mainthreadNotebook = this._mapping.get(URI.from(uri).toString());
|
||||
return mainthreadNotebook?.createRawCell(this._viewType, uri, index, language, type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user