mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 09:35:38 -05:00
Remove API compatibility layer for VS Code notebook extensions (#21225)
This commit is contained in:
@@ -38,7 +38,6 @@ import { LocalContentManager } from 'sql/workbench/services/notebook/common/loca
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions as LanguageAssociationExtensions, ILanguageAssociationRegistry } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { NotebookLanguage } from 'sql/workbench/common/constants';
|
||||
import { convertToInternalInteractiveKernelMetadata } from 'sql/workbench/api/common/notebooks/notebookUtils';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfiguration';
|
||||
import { IEditorResolverService } from 'vs/workbench/services/editor/common/editorResolverService';
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
@@ -592,9 +591,6 @@ export class NotebookEditorContentLoader implements IContentLoader {
|
||||
notebookContents = await this.contentManager.deserializeNotebook(notebookEditorModel.contentString);
|
||||
}
|
||||
|
||||
// Special case .NET Interactive kernel spec to handle inconsistencies between notebook providers and jupyter kernel specs
|
||||
convertToInternalInteractiveKernelMetadata(notebookContents.metadata);
|
||||
|
||||
return notebookContents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,9 +438,7 @@ registerComponentType({
|
||||
mimeTypes: [
|
||||
'text/plain',
|
||||
'application/vnd.jupyter.stdout',
|
||||
'application/vnd.jupyter.stderr',
|
||||
'application/vnd.code.notebook.stdout',
|
||||
'application/vnd.code.notebook.stderr'
|
||||
'application/vnd.jupyter.stderr'
|
||||
],
|
||||
rank: 120,
|
||||
safe: true,
|
||||
@@ -448,19 +446,6 @@ registerComponentType({
|
||||
selector: MimeRendererComponent.SELECTOR
|
||||
});
|
||||
|
||||
/**
|
||||
* A mime renderer component for VS Code Notebook error data.
|
||||
*/
|
||||
registerComponentType({
|
||||
mimeTypes: [
|
||||
'application/vnd.code.notebook.error'
|
||||
],
|
||||
rank: 121,
|
||||
safe: true,
|
||||
ctor: MimeRendererComponent,
|
||||
selector: MimeRendererComponent.SELECTOR
|
||||
});
|
||||
|
||||
/**
|
||||
* A placeholder component for deprecated rendered JavaScript.
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,6 @@ import { TestNotificationService } from 'vs/platform/notification/test/common/te
|
||||
import { ICommandService, NullCommandService } from 'vs/platform/commands/common/commands';
|
||||
import { ControlType, IChartOption } from 'sql/workbench/contrib/charts/browser/chartOptions';
|
||||
import { CellModel } from 'sql/workbench/services/notebook/browser/models/cell';
|
||||
import { ICellMetadata } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IModelContentChangedEvent } from 'vs/editor/common/textModelEvents';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
@@ -1533,46 +1532,4 @@ suite('Cell Model', function (): void {
|
||||
assert.strictEqual(cellModel.currentMode, CellEditModes.MARKDOWN, 'Should persist lastEditMode and be in markdown only');
|
||||
|
||||
});
|
||||
|
||||
test('should set .NET Interactive cell metadata when converting to JSON', async function () {
|
||||
let notebookModel = new NotebookModelStub({
|
||||
name: '',
|
||||
version: '',
|
||||
mimetype: ''
|
||||
});
|
||||
let contents: nb.ICellContents = {
|
||||
cell_type: CellTypes.Code,
|
||||
source: '',
|
||||
metadata: {
|
||||
language: 'dotnet-interactive.csharp'
|
||||
}
|
||||
};
|
||||
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
|
||||
assert((model.metadata as ICellMetadata).dotnet_interactive === undefined, 'dotnet_interactive field should not be set in cell metadata before converting to JSON');
|
||||
let cellJson = model.toJSON();
|
||||
assert((cellJson.metadata as ICellMetadata).dotnet_interactive !== undefined, 'dotnet_interactive field should be set in JSON cell metadata');
|
||||
assert.strictEqual((cellJson.metadata as ICellMetadata).dotnet_interactive.language, 'csharp', 'Expected dotnet_interactive language field to be csharp');
|
||||
});
|
||||
|
||||
test('should overwrite pre-existing .NET Interactive cell metadata when converting to JSON', async function () {
|
||||
let notebookModel = new NotebookModelStub({
|
||||
name: '',
|
||||
version: '',
|
||||
mimetype: ''
|
||||
});
|
||||
let contents: nb.ICellContents = {
|
||||
cell_type: CellTypes.Code,
|
||||
source: '',
|
||||
metadata: {
|
||||
language: 'dotnet-interactive.csharp'
|
||||
}
|
||||
};
|
||||
(contents.metadata as ICellMetadata).dotnet_interactive = { language: 'fsharp' };
|
||||
|
||||
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
|
||||
assert((model.metadata as ICellMetadata).dotnet_interactive !== undefined, 'dotnet_interactive field should exist in cell metadata');
|
||||
let cellJson = model.toJSON();
|
||||
assert((cellJson.metadata as ICellMetadata).dotnet_interactive !== undefined, 'dotnet_interactive field should be set in JSON cell metadata');
|
||||
assert.strictEqual((cellJson.metadata as ICellMetadata).dotnet_interactive.language, 'csharp', 'Expected dotnet_interactive language field to be csharp');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,7 +24,6 @@ import { INotebookView, INotebookViewCard, INotebookViewMetadata, INotebookViews
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { INotebookEditOperation } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
|
||||
export class NotebookModelStub implements INotebookModel {
|
||||
constructor(private _languageInfo?: nb.ILanguageInfo, private _cells?: ICellModel[], private _testContents?: nb.INotebookContents) {
|
||||
@@ -236,15 +235,9 @@ export class NotebookServiceStub implements INotebookService {
|
||||
get onNotebookKernelsAdded(): vsEvent.Event<IStandardKernelWithProvider[]> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getNotebookURIForCell(cellUri: URI): URI {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getSupportedLanguagesForProvider(provider: string, kernelDisplayName?: string): Promise<string[]> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
createNotebookInputFromContents(providerId: string, contents?: nb.INotebookContents, resource?: UriComponents): Promise<EditorInput> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
_serviceBrand: undefined;
|
||||
get onNotebookEditorAdd(): vsEvent.Event<INotebookEditor> {
|
||||
throw new Error('Method not implemented.');
|
||||
|
||||
Reference in New Issue
Block a user