mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)
* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 * Fix breaks * Extension management fixes * Fix breaks in windows bundling * Fix/skip failing tests * Update distro * Add clear to nuget.config * Add hygiene task * Bump distro * Fix hygiene issue * Add build to hygiene exclusion * Update distro * Update hygiene * Hygiene exclusions * Update tsconfig * Bump distro for server breaks * Update build config * Update darwin path * Add done calls to notebook tests * Skip failing tests * Disable smoke tests
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { getZoomLevel } from 'vs/base/browser/browser';
|
||||
import { flatten } from 'vs/base/common/arrays';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
@@ -11,23 +12,27 @@ import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/
|
||||
import { ResourceMap } from 'vs/base/common/map';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as UUID from 'vs/base/common/uuid';
|
||||
import { RedoCommand, UndoCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
import { CopyAction, CutAction, PasteAction } from 'vs/editor/contrib/clipboard/clipboard';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { NotebookExtensionDescription } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { Memento } from 'vs/workbench/common/memento';
|
||||
import { INotebookEditorContribution, notebookProviderExtensionPoint, notebookRendererExtensionPoint } from 'vs/workbench/contrib/notebook/browser/extensionPoint';
|
||||
import { getActiveNotebookEditor, INotebookEditor, NotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { CellEditState, getActiveNotebookEditor, INotebookEditor, NotebookEditorOptions, updateEditorTopPadding } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { NotebookKernelProviderAssociationRegistry, NotebookViewTypesExtensionRegistry, updateNotebookKernelProvideAssociationSchema } from 'vs/workbench/contrib/notebook/browser/notebookKernelAssociation';
|
||||
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel';
|
||||
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
|
||||
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
|
||||
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellEditType, CellKind, CellOutputKind, DisplayOrderKey, ICellEditOperation, IDisplayOutput, INotebookKernelInfo2, INotebookKernelProvider, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, ITransformedDisplayOutputDto, mimeTypeSupportedByCore, NotebookCellOutputsSplice, notebookDocumentFilterMatch, NotebookEditorPriority, NOTEBOOK_DISPLAY_ORDER, sortMimeTypes } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellKind, CellOutputKind, DisplayOrderKey, IDisplayOutput, INotebookDecorationRenderOptions, INotebookKernelInfo2, INotebookKernelProvider, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, ITransformedDisplayOutputDto, mimeTypeIsAlwaysSecure, mimeTypeSupportedByCore, notebookDocumentFilterMatch, NotebookEditorPriority, NOTEBOOK_DISPLAY_ORDER, RENDERER_NOT_AVAILABLE, sortMimeTypes } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { NotebookOutputRendererInfo } from 'vs/workbench/contrib/notebook/common/notebookOutputRenderer';
|
||||
import { NotebookEditorDescriptor, NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider';
|
||||
import { IMainNotebookController, INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
|
||||
@@ -87,7 +92,7 @@ export class NotebookProviderInfoStore extends Disposable {
|
||||
super();
|
||||
this._memento = new Memento(NotebookProviderInfoStore.CUSTOM_EDITORS_STORAGE_ID, storageService);
|
||||
|
||||
const mementoObject = this._memento.getMemento(StorageScope.GLOBAL);
|
||||
const mementoObject = this._memento.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
for (const info of (mementoObject[NotebookProviderInfoStore.CUSTOM_EDITORS_ENTRY_ID] || []) as NotebookEditorDescriptor[]) {
|
||||
this.add(new NotebookProviderInfo(info));
|
||||
}
|
||||
@@ -116,17 +121,19 @@ export class NotebookProviderInfoStore extends Disposable {
|
||||
this.add(new NotebookProviderInfo({
|
||||
id: notebookContribution.viewType,
|
||||
displayName: notebookContribution.displayName,
|
||||
selector: notebookContribution.selector || [],
|
||||
selectors: notebookContribution.selector || [],
|
||||
priority: this._convertPriority(notebookContribution.priority),
|
||||
providerExtensionId: extension.description.identifier.value,
|
||||
providerDescription: extension.description.description,
|
||||
providerDisplayName: extension.description.isBuiltin ? nls.localize('builtinProviderDisplayName', "Built-in") : extension.description.displayName || extension.description.identifier.value,
|
||||
providerExtensionLocation: extension.description.extensionLocation
|
||||
providerExtensionLocation: extension.description.extensionLocation,
|
||||
dynamicContribution: false,
|
||||
exclusive: false
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
const mementoObject = this._memento.getMemento(StorageScope.GLOBAL);
|
||||
const mementoObject = this._memento.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
mementoObject[NotebookProviderInfoStore.CUSTOM_EDITORS_ENTRY_ID] = Array.from(this._contributedEditors.values());
|
||||
this._memento.saveMemento();
|
||||
|
||||
@@ -175,6 +182,10 @@ export class NotebookProviderInfoStore extends Disposable {
|
||||
return;
|
||||
}
|
||||
this._contributedEditors.set(info.id, info);
|
||||
|
||||
const mementoObject = this._memento.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
mementoObject[NotebookProviderInfoStore.CUSTOM_EDITORS_ENTRY_ID] = Array.from(this._contributedEditors.values());
|
||||
this._memento.saveMemento();
|
||||
}
|
||||
|
||||
getContributedNotebook(resource: URI): readonly NotebookProviderInfo[] {
|
||||
@@ -261,6 +272,7 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
private _lastClipboardIsCopy: boolean = true;
|
||||
|
||||
private _displayOrder: { userOrder: string[], defaultOrder: string[] } = Object.create(null);
|
||||
private readonly _decorationOptionProviders = new Map<string, INotebookDecorationRenderOptions>();
|
||||
|
||||
constructor(
|
||||
@IExtensionService private readonly _extensionService: IExtensionService,
|
||||
@@ -268,7 +280,9 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,
|
||||
@IStorageService private readonly _storageService: IStorageService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@ICodeEditorService private readonly _codeEditorService: ICodeEditorService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -328,6 +342,41 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
updateOrder();
|
||||
}));
|
||||
|
||||
let decorationTriggeredAdjustment = false;
|
||||
let decorationCheckSet = new Set<string>();
|
||||
this._register(this._codeEditorService.onDecorationTypeRegistered(e => {
|
||||
if (decorationTriggeredAdjustment) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (decorationCheckSet.has(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const options = this._codeEditorService.resolveDecorationOptions(e, true);
|
||||
if (options.afterContentClassName || options.beforeContentClassName) {
|
||||
const cssRules = this._codeEditorService.resolveDecorationCSSRules(e);
|
||||
if (cssRules !== null) {
|
||||
for (let i = 0; i < cssRules.length; i++) {
|
||||
// The following ways to index into the list are equivalent
|
||||
if (
|
||||
((cssRules[i] as CSSStyleRule).selectorText.endsWith('::after') || (cssRules[i] as CSSStyleRule).selectorText.endsWith('::after'))
|
||||
&& (cssRules[i] as CSSStyleRule).cssText.indexOf('top:') > -1
|
||||
) {
|
||||
// there is a `::before` or `::after` text decoration whose position is above or below current line
|
||||
// we at least make sure that the editor top padding is at least one line
|
||||
const editorOptions = this.configurationService.getValue<IEditorOptions>('editor');
|
||||
updateEditorTopPadding(BareFontInfo.createFromRawSettings(editorOptions, getZoomLevel()).lineHeight + 2);
|
||||
decorationTriggeredAdjustment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decorationCheckSet.add(e);
|
||||
}));
|
||||
|
||||
const getContext = () => {
|
||||
const editor = getActiveNotebookEditor(this._editorService);
|
||||
const activeCell = editor?.getActiveCell();
|
||||
@@ -342,12 +391,17 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
this._register(UndoCommand.addImplementation(PRIORITY, () => {
|
||||
const { editor } = getContext();
|
||||
if (editor?.viewModel) {
|
||||
editor?.viewModel.undo().then(cellResources => {
|
||||
return editor.viewModel.undo().then(cellResources => {
|
||||
if (cellResources?.length) {
|
||||
editor?.setOptions(new NotebookEditorOptions({ cellOptions: { resource: cellResources[0] } }));
|
||||
editor?.viewModel?.viewCells.forEach(cell => {
|
||||
if (cell.cellKind === CellKind.Markdown && cellResources.find(resource => resource.fragment === cell.model.uri.fragment)) {
|
||||
cell.editState = CellEditState.Editing;
|
||||
}
|
||||
});
|
||||
|
||||
editor?.setOptions(new NotebookEditorOptions({ cellOptions: { resource: cellResources[0] }, preserveFocus: true }));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -356,12 +410,17 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
this._register(RedoCommand.addImplementation(PRIORITY, () => {
|
||||
const { editor } = getContext();
|
||||
if (editor?.viewModel) {
|
||||
editor?.viewModel.redo().then(cellResources => {
|
||||
return editor.viewModel.redo().then(cellResources => {
|
||||
if (cellResources?.length) {
|
||||
editor?.setOptions(new NotebookEditorOptions({ cellOptions: { resource: cellResources[0] } }));
|
||||
editor?.viewModel?.viewCells.forEach(cell => {
|
||||
if (cell.cellKind === CellKind.Markdown && cellResources.find(resource => resource.fragment === cell.model.uri.fragment)) {
|
||||
cell.editState = CellEditState.Editing;
|
||||
}
|
||||
});
|
||||
|
||||
editor?.setOptions(new NotebookEditorOptions({ cellOptions: { resource: cellResources[0] }, preserveFocus: true }));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -430,7 +489,16 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
source: cell.getValue(),
|
||||
language: cell.language,
|
||||
cellKind: cell.cellKind,
|
||||
outputs: cell.outputs,
|
||||
outputs: cell.outputs.map(output => {
|
||||
if (output.outputKind === CellOutputKind.Rich) {
|
||||
return {
|
||||
...output,
|
||||
outputId: UUID.generateUuid()
|
||||
};
|
||||
}
|
||||
|
||||
return output;
|
||||
}),
|
||||
metadata: {
|
||||
editable: cell.metadata?.editable,
|
||||
runnable: cell.metadata?.runnable,
|
||||
@@ -460,7 +528,16 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
source: cell.getValue(),
|
||||
language: cell.language,
|
||||
cellKind: cell.cellKind,
|
||||
outputs: cell.outputs,
|
||||
outputs: cell.outputs.map(output => {
|
||||
if (output.outputKind === CellOutputKind.Rich) {
|
||||
return {
|
||||
...output,
|
||||
outputId: UUID.generateUuid()
|
||||
};
|
||||
}
|
||||
|
||||
return output;
|
||||
}),
|
||||
metadata: {
|
||||
editable: cell.metadata?.editable,
|
||||
runnable: cell.metadata?.runnable,
|
||||
@@ -519,6 +596,24 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
|
||||
}
|
||||
|
||||
registerEditorDecorationType(key: string, options: INotebookDecorationRenderOptions): void {
|
||||
if (this._decorationOptionProviders.has(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._decorationOptionProviders.set(key, options);
|
||||
}
|
||||
|
||||
removeEditorDecorationType(key: string): void {
|
||||
this._decorationOptionProviders.delete(key);
|
||||
|
||||
this.listNotebookEditors().forEach(editor => editor.removeEditorDecorations(key));
|
||||
}
|
||||
|
||||
resolveEditorDecorationOptions(key: string): INotebookDecorationRenderOptions | undefined {
|
||||
return this._decorationOptionProviders.get(key);
|
||||
}
|
||||
|
||||
getViewTypes(): ICustomEditorInfo[] {
|
||||
return [...this.notebookProviderInfoStore].map(info => ({
|
||||
id: info.id,
|
||||
@@ -530,19 +625,44 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
async canResolve(viewType: string): Promise<boolean> {
|
||||
if (!this._notebookProviders.has(viewType)) {
|
||||
await this._extensionService.whenInstalledExtensionsRegistered();
|
||||
// notebook providers/kernels/renderers might use `*` as activation event.
|
||||
await this._extensionService.activateByEvent(`*`);
|
||||
// this awaits full activation of all matching extensions
|
||||
await this._extensionService.activateByEvent(`onNotebook:${viewType}`);
|
||||
|
||||
// TODO@jrieken deprecated, remove this
|
||||
await this._extensionService.activateByEvent(`onNotebookEditor:${viewType}`);
|
||||
if (this._notebookProviders.has(viewType)) {
|
||||
return true;
|
||||
} else {
|
||||
// notebook providers/kernels/renderers might use `*` as activation event.
|
||||
// TODO, only activate by `*` if this._notebookProviders.get(viewType).dynamicContribution === true
|
||||
await this._extensionService.activateByEvent(`*`);
|
||||
}
|
||||
}
|
||||
return this._notebookProviders.has(viewType);
|
||||
}
|
||||
|
||||
registerNotebookController(viewType: string, extensionData: NotebookExtensionDescription, controller: IMainNotebookController): IDisposable {
|
||||
this._notebookProviders.set(viewType, { extensionData, controller });
|
||||
|
||||
if (controller.viewOptions && !this.notebookProviderInfoStore.get(viewType)) {
|
||||
// register this content provider to the static contribution, if it does not exist
|
||||
const info = new NotebookProviderInfo({
|
||||
displayName: controller.viewOptions.displayName,
|
||||
id: viewType,
|
||||
priority: NotebookEditorPriority.default,
|
||||
selectors: [],
|
||||
providerExtensionId: extensionData.id.value,
|
||||
providerDescription: extensionData.description,
|
||||
providerDisplayName: extensionData.id.value,
|
||||
providerExtensionLocation: URI.revive(extensionData.location),
|
||||
dynamicContribution: true,
|
||||
exclusive: controller.viewOptions.exclusive
|
||||
});
|
||||
|
||||
info.update({ selectors: controller.viewOptions.filenamePattern });
|
||||
info.update({ options: controller.options });
|
||||
this.notebookProviderInfoStore.add(info);
|
||||
}
|
||||
|
||||
this.notebookProviderInfoStore.get(viewType)?.update({ options: controller.options });
|
||||
|
||||
this._onDidChangeViewTypes.fire();
|
||||
return toDisposable(() => {
|
||||
this._notebookProviders.delete(viewType);
|
||||
@@ -563,7 +683,7 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
});
|
||||
}
|
||||
|
||||
async getContributedNotebookKernels2(viewType: string, resource: URI, token: CancellationToken): Promise<INotebookKernelInfo2[]> {
|
||||
async getContributedNotebookKernels(viewType: string, resource: URI, token: CancellationToken): Promise<INotebookKernelInfo2[]> {
|
||||
const filteredProvider = this.notebookKernelProviderInfoStore.get(viewType, resource);
|
||||
const result = new Array<INotebookKernelInfo2[]>(filteredProvider.length);
|
||||
|
||||
@@ -639,8 +759,6 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
|
||||
this._models.set(uri, modelData);
|
||||
this._onDidAddNotebookDocument.fire(notebookModel);
|
||||
// after the document is added to the store and sent to ext host, we transform the ouputs
|
||||
await this.transformTextModelOutputs(notebookModel);
|
||||
|
||||
return modelData.model;
|
||||
}
|
||||
@@ -653,68 +771,12 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
return Iterable.map(this._models.values(), data => data.model);
|
||||
}
|
||||
|
||||
private async transformTextModelOutputs(textModel: NotebookTextModel) {
|
||||
for (let i = 0; i < textModel.cells.length; i++) {
|
||||
const cell = textModel.cells[i];
|
||||
|
||||
cell.outputs.forEach((output) => {
|
||||
if (output.outputKind === CellOutputKind.Rich) {
|
||||
// TODO@rebornix no string[] casting
|
||||
const ret = this._transformMimeTypes(output, output.outputId, textModel.metadata.displayOrder as string[] || []);
|
||||
const orderedMimeTypes = ret.orderedMimeTypes!;
|
||||
const pickedMimeTypeIndex = ret.pickedMimeTypeIndex!;
|
||||
output.pickedMimeTypeIndex = pickedMimeTypeIndex;
|
||||
output.orderedMimeTypes = orderedMimeTypes;
|
||||
}
|
||||
});
|
||||
}
|
||||
getMimeTypeInfo(textModel: NotebookTextModel, output: ITransformedDisplayOutputDto): readonly IOrderedMimeType[] {
|
||||
// TODO@rebornix no string[] casting
|
||||
return this._getOrderedMimeTypes(textModel, output, textModel.metadata.displayOrder as string[] ?? []);
|
||||
}
|
||||
|
||||
transformEditsOutputs(textModel: NotebookTextModel, edits: ICellEditOperation[]) {
|
||||
edits.forEach((edit) => {
|
||||
if (edit.editType === CellEditType.Replace) {
|
||||
edit.cells.forEach((cell) => {
|
||||
const outputs = cell.outputs;
|
||||
outputs.map((output) => {
|
||||
if (output.outputKind === CellOutputKind.Rich) {
|
||||
const ret = this._transformMimeTypes(output, output.outputId, textModel.metadata.displayOrder as string[] || []);
|
||||
const orderedMimeTypes = ret.orderedMimeTypes!;
|
||||
const pickedMimeTypeIndex = ret.pickedMimeTypeIndex!;
|
||||
output.pickedMimeTypeIndex = pickedMimeTypeIndex;
|
||||
output.orderedMimeTypes = orderedMimeTypes;
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (edit.editType === CellEditType.Output) {
|
||||
edit.outputs.map((output) => {
|
||||
if (output.outputKind === CellOutputKind.Rich) {
|
||||
const ret = this._transformMimeTypes(output, output.outputId, textModel.metadata.displayOrder as string[] || []);
|
||||
const orderedMimeTypes = ret.orderedMimeTypes!;
|
||||
const pickedMimeTypeIndex = ret.pickedMimeTypeIndex!;
|
||||
output.pickedMimeTypeIndex = pickedMimeTypeIndex;
|
||||
output.orderedMimeTypes = orderedMimeTypes;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
transformSpliceOutputs(textModel: NotebookTextModel, splices: NotebookCellOutputsSplice[]) {
|
||||
splices.forEach((splice) => {
|
||||
const outputs = splice[2];
|
||||
outputs.map((output) => {
|
||||
if (output.outputKind === CellOutputKind.Rich) {
|
||||
const ret = this._transformMimeTypes(output, output.outputId, textModel.metadata.displayOrder as string[] || []);
|
||||
const orderedMimeTypes = ret.orderedMimeTypes!;
|
||||
const pickedMimeTypeIndex = ret.pickedMimeTypeIndex!;
|
||||
output.pickedMimeTypeIndex = pickedMimeTypeIndex;
|
||||
output.orderedMimeTypes = orderedMimeTypes;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private _transformMimeTypes(output: IDisplayOutput, outputId: string, documentDisplayOrder: string[]): ITransformedDisplayOutputDto {
|
||||
private _getOrderedMimeTypes(textModel: NotebookTextModel, output: IDisplayOutput, documentDisplayOrder: string[]): IOrderedMimeType[] {
|
||||
const mimeTypes = Object.keys(output.data);
|
||||
const coreDisplayOrder = this._displayOrder;
|
||||
const sorted = sortMimeTypes(mimeTypes, coreDisplayOrder?.userOrder || [], documentDisplayOrder, coreDisplayOrder?.defaultOrder || []);
|
||||
@@ -730,44 +792,54 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
orderMimeTypes.push({
|
||||
mimeType: mimeType,
|
||||
rendererId: handler.id,
|
||||
isTrusted: textModel.metadata.trusted
|
||||
});
|
||||
|
||||
for (let i = 1; i < handlers.length; i++) {
|
||||
orderMimeTypes.push({
|
||||
mimeType: mimeType,
|
||||
rendererId: handlers[i].id
|
||||
rendererId: handlers[i].id,
|
||||
isTrusted: textModel.metadata.trusted
|
||||
});
|
||||
}
|
||||
|
||||
if (mimeTypeSupportedByCore(mimeType)) {
|
||||
orderMimeTypes.push({
|
||||
mimeType: mimeType,
|
||||
rendererId: BUILTIN_RENDERER_ID
|
||||
rendererId: BUILTIN_RENDERER_ID,
|
||||
isTrusted: mimeTypeIsAlwaysSecure(mimeType) || textModel.metadata.trusted
|
||||
});
|
||||
}
|
||||
} else {
|
||||
orderMimeTypes.push({
|
||||
mimeType: mimeType,
|
||||
rendererId: BUILTIN_RENDERER_ID
|
||||
});
|
||||
if (mimeTypeSupportedByCore(mimeType)) {
|
||||
orderMimeTypes.push({
|
||||
mimeType: mimeType,
|
||||
rendererId: BUILTIN_RENDERER_ID,
|
||||
isTrusted: mimeTypeIsAlwaysSecure(mimeType) || textModel.metadata.trusted
|
||||
});
|
||||
} else {
|
||||
orderMimeTypes.push({
|
||||
mimeType: mimeType,
|
||||
rendererId: RENDERER_NOT_AVAILABLE,
|
||||
isTrusted: textModel.metadata.trusted
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
outputKind: output.outputKind,
|
||||
outputId,
|
||||
data: output.data,
|
||||
orderedMimeTypes: orderMimeTypes,
|
||||
pickedMimeTypeIndex: 0
|
||||
};
|
||||
return orderMimeTypes;
|
||||
}
|
||||
|
||||
private _findBestMatchedRenderer(mimeType: string): readonly NotebookOutputRendererInfo[] {
|
||||
return this.notebookRenderersInfoStore.getContributedRenderer(mimeType);
|
||||
}
|
||||
|
||||
getContributedNotebookProviders(resource: URI): readonly NotebookProviderInfo[] {
|
||||
return this.notebookProviderInfoStore.getContributedNotebook(resource);
|
||||
getContributedNotebookProviders(resource?: URI): readonly NotebookProviderInfo[] {
|
||||
if (resource) {
|
||||
return this.notebookProviderInfoStore.getContributedNotebook(resource);
|
||||
}
|
||||
|
||||
return [...this.notebookProviderInfoStore];
|
||||
}
|
||||
|
||||
getContributedNotebookProvider(viewType: string): NotebookProviderInfo | undefined {
|
||||
@@ -921,11 +993,11 @@ export class NotebookService extends Disposable implements INotebookService, ICu
|
||||
if (modelData) {
|
||||
// delete editors and documents
|
||||
const willRemovedEditors: INotebookEditor[] = [];
|
||||
this._notebookEditors.forEach(editor => {
|
||||
if (editor.textModel === modelData!.model) {
|
||||
for (const editor of this._notebookEditors.values()) {
|
||||
if (editor.textModel === modelData.model) {
|
||||
willRemovedEditors.push(editor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
modelData.model.dispose();
|
||||
modelData.dispose();
|
||||
|
||||
Reference in New Issue
Block a user