mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
Enable VSCode extension APIs for opening notebooks. (#18080)
* Also moved notebook conversion classes to a common folder, and moved several conversion utility methods to a common file.
This commit is contained in:
@@ -27,6 +27,8 @@ import { localize } from 'vs/nls';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { NotebookEditor } from 'sql/workbench/contrib/notebook/browser/notebookEditor';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { NewNotebookAction } from 'sql/workbench/contrib/notebook/browser/notebookActions';
|
||||
|
||||
class MainThreadNotebookEditor extends Disposable {
|
||||
private _contentChangedEmitter = new Emitter<NotebookContentChange>();
|
||||
@@ -320,7 +322,8 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@INotebookService private readonly _notebookService: INotebookService,
|
||||
@IFileService private readonly _fileService: IFileService,
|
||||
@ITextFileService private readonly _textFileService: ITextFileService
|
||||
@ITextFileService private readonly _textFileService: ITextFileService,
|
||||
@ICommandService private readonly _commandService: ICommandService
|
||||
) {
|
||||
super();
|
||||
if (extHostContext) {
|
||||
@@ -709,4 +712,12 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$createNotebookDocument(providerId: string, contents: azdata.nb.INotebookContents): Promise<azdata.nb.NotebookDocument> {
|
||||
return this._commandService.executeCommand(NewNotebookAction.INTERNAL_NEW_NOTEBOOK_CMD_ID, {
|
||||
providerId: providerId,
|
||||
initialContent: contents,
|
||||
initialDirtyState: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user