Add notebook extension support for .NET Interactive. (#18334)

* Also updated kernel dropdown to only include SQL aliased kernels when using SQL notebook provider.
This commit is contained in:
Cory Rivera
2022-02-25 11:58:59 -08:00
committed by GitHub
parent 02341088eb
commit ffdefd3b52
41 changed files with 649 additions and 278 deletions

View File

@@ -102,8 +102,12 @@ export class MainThreadNotebook extends Disposable implements MainThreadNotebook
}
}
public $updateProviderDescriptionLanguages(providerId: string, languages: string[]): void {
notebookRegistry.updateProviderDescriptionLanguages(providerId, languages);
public $updateProviderKernels(providerId: string, languages: azdata.nb.IStandardKernel[]): void {
notebookRegistry.updateProviderKernels(providerId, languages);
}
public $updateKernelLanguages(providerId: string, kernelName: string, languages: string[]): void {
notebookRegistry.updateKernelLanguages(providerId, kernelName, languages);
}
//#endregion
}

View File

@@ -27,8 +27,6 @@ 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>();
@@ -322,8 +320,7 @@ 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,
@ICommandService private readonly _commandService: ICommandService
@ITextFileService private readonly _textFileService: ITextFileService
) {
super();
if (extHostContext) {
@@ -345,6 +342,11 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
}
}
async $tryCreateNotebookDocument(options: INotebookShowOptions): Promise<UriComponents> {
let input = await this._notebookService.createNotebookInput(options);
return input.resource;
}
$tryShowNotebookDocument(resource: UriComponents, options: INotebookShowOptions): Promise<string> {
return Promise.resolve(this.doOpenEditor(resource, options));
}
@@ -712,12 +714,4 @@ 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
});
}
}