mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Switch webview api back to use delegate model
For #77131 Going back the the delegate based model for a few reasons: - It gives us a better approach to add additional API hooks in the future (such as for rename) - In practive, the capabilities were almost always the same as the `userData` on the document. It is rather confusing to have both `userData` and the capabilities 'on' the document
This commit is contained in:
@@ -27,8 +27,8 @@ export class PreviewManager implements vscode.CustomEditorProvider {
|
|||||||
private readonly zoomStatusBarEntry: ZoomStatusBarEntry,
|
private readonly zoomStatusBarEntry: ZoomStatusBarEntry,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
public async resolveCustomDocument(_document: vscode.CustomDocument): Promise<vscode.CustomEditorCapabilities> {
|
public async resolveCustomDocument(_document: vscode.CustomDocument): Promise<void> {
|
||||||
return {};
|
// noop
|
||||||
}
|
}
|
||||||
|
|
||||||
public async resolveCustomEditor(
|
public async resolveCustomEditor(
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview
|
|||||||
this.registerDynamicPreview(preview);
|
this.registerDynamicPreview(preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async resolveCustomDocument(_document: vscode.CustomDocument): Promise<vscode.CustomEditorCapabilities> {
|
public async resolveCustomDocument(_document: vscode.CustomDocument): Promise<void> {
|
||||||
return {};
|
// noop
|
||||||
}
|
}
|
||||||
|
|
||||||
public async resolveCustomTextEditor(
|
public async resolveCustomTextEditor(
|
||||||
|
|||||||
Vendored
+39
-21
@@ -1222,78 +1222,88 @@ declare module 'vscode' {
|
|||||||
// - Should we expose edits?
|
// - Should we expose edits?
|
||||||
// - More properties from `TextDocument`?
|
// - More properties from `TextDocument`?
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the capabilities of a custom webview editor.
|
|
||||||
*/
|
|
||||||
interface CustomEditorCapabilities {
|
|
||||||
/**
|
|
||||||
* Defines the editing capability of a custom webview document.
|
|
||||||
*
|
|
||||||
* When not provided, the document is considered readonly.
|
|
||||||
*/
|
|
||||||
readonly editing?: CustomEditorEditingCapability;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the editing capability of a custom webview editor. This allows the webview editor to hook into standard
|
* Defines the editing capability of a custom webview editor. This allows the webview editor to hook into standard
|
||||||
* editor events such as `undo` or `save`.
|
* editor events such as `undo` or `save`.
|
||||||
*
|
*
|
||||||
* @param EditType Type of edits.
|
* @param EditType Type of edits.
|
||||||
*/
|
*/
|
||||||
interface CustomEditorEditingCapability<EditType = unknown> {
|
interface CustomEditorEditingDelegate<EditType = unknown> {
|
||||||
/**
|
/**
|
||||||
* Save the resource.
|
* Save the resource.
|
||||||
*
|
*
|
||||||
|
* @param document Document to save.
|
||||||
* @param cancellation Token that signals the save is no longer required (for example, if another save was triggered).
|
* @param cancellation Token that signals the save is no longer required (for example, if another save was triggered).
|
||||||
*
|
*
|
||||||
* @return Thenable signaling that the save has completed.
|
* @return Thenable signaling that the save has completed.
|
||||||
*/
|
*/
|
||||||
save(cancellation: CancellationToken): Thenable<void>;
|
save(document: CustomDocument, cancellation: CancellationToken): Thenable<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the existing resource at a new path.
|
* Save the existing resource at a new path.
|
||||||
*
|
*
|
||||||
|
* @param document Document to save.
|
||||||
* @param targetResource Location to save to.
|
* @param targetResource Location to save to.
|
||||||
*
|
*
|
||||||
* @return Thenable signaling that the save has completed.
|
* @return Thenable signaling that the save has completed.
|
||||||
*/
|
*/
|
||||||
saveAs(targetResource: Uri): Thenable<void>;
|
saveAs(document: CustomDocument, targetResource: Uri): Thenable<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event triggered by extensions to signal to VS Code that an edit has occurred.
|
* Event triggered by extensions to signal to VS Code that an edit has occurred.
|
||||||
*/
|
*/
|
||||||
readonly onDidEdit: Event<EditType>;
|
readonly onDidEdit: Event<{
|
||||||
|
/**
|
||||||
|
* Document the edit is for.
|
||||||
|
*/
|
||||||
|
readonly document: CustomDocument;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object that describes the edit.
|
||||||
|
*
|
||||||
|
* Edit objects are passed back to your extension in `undoEdits`, `applyEdits`, and `revert`.
|
||||||
|
*/
|
||||||
|
readonly edit: EditType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display name describing the edit.
|
||||||
|
*/
|
||||||
|
readonly label?: string;
|
||||||
|
}>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply a set of edits.
|
* Apply a set of edits.
|
||||||
*
|
*
|
||||||
* Note that is not invoked when `onDidEdit` is called because `onDidEdit` implies also updating the view to reflect the edit.
|
* Note that is not invoked when `onDidEdit` is called because `onDidEdit` implies also updating the view to reflect the edit.
|
||||||
*
|
*
|
||||||
|
* @param document Document to apply edits to.
|
||||||
* @param edit Array of edits. Sorted from oldest to most recent.
|
* @param edit Array of edits. Sorted from oldest to most recent.
|
||||||
*
|
*
|
||||||
* @return Thenable signaling that the change has completed.
|
* @return Thenable signaling that the change has completed.
|
||||||
*/
|
*/
|
||||||
applyEdits(edits: readonly EditType[]): Thenable<void>;
|
applyEdits(document: CustomDocument, edits: readonly EditType[]): Thenable<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undo a set of edits.
|
* Undo a set of edits.
|
||||||
*
|
*
|
||||||
* This is triggered when a user undoes an edit.
|
* This is triggered when a user undoes an edit.
|
||||||
*
|
*
|
||||||
|
* @param document Document to undo edits from.
|
||||||
* @param edit Array of edits. Sorted from most recent to oldest.
|
* @param edit Array of edits. Sorted from most recent to oldest.
|
||||||
*
|
*
|
||||||
* @return Thenable signaling that the change has completed.
|
* @return Thenable signaling that the change has completed.
|
||||||
*/
|
*/
|
||||||
undoEdits(edits: readonly EditType[]): Thenable<void>;
|
undoEdits(document: CustomDocument, edits: readonly EditType[]): Thenable<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Revert the file to its last saved state.
|
* Revert the file to its last saved state.
|
||||||
*
|
*
|
||||||
|
* @param document Document to revert.
|
||||||
* @param change Added or applied edits.
|
* @param change Added or applied edits.
|
||||||
*
|
*
|
||||||
* @return Thenable signaling that the change has completed.
|
* @return Thenable signaling that the change has completed.
|
||||||
*/
|
*/
|
||||||
revert(change: {
|
revert(document: CustomDocument, change: {
|
||||||
readonly undoneEdits: readonly EditType[];
|
readonly undoneEdits: readonly EditType[];
|
||||||
readonly appliedEdits: readonly EditType[];
|
readonly appliedEdits: readonly EditType[];
|
||||||
}): Thenable<void>;
|
}): Thenable<void>;
|
||||||
@@ -1311,12 +1321,13 @@ declare module 'vscode' {
|
|||||||
* made in quick succession, `backup` is only triggered after the last one. `backup` is not invoked when
|
* made in quick succession, `backup` is only triggered after the last one. `backup` is not invoked when
|
||||||
* `auto save` is enabled (since auto save already persists resource ).
|
* `auto save` is enabled (since auto save already persists resource ).
|
||||||
*
|
*
|
||||||
|
* @param document Document to revert.
|
||||||
* @param cancellation Token that signals the current backup since a new backup is coming in. It is up to your
|
* @param cancellation Token that signals the current backup since a new backup is coming in. It is up to your
|
||||||
* extension to decided how to respond to cancellation. If for example your extension is backing up a large file
|
* extension to decided how to respond to cancellation. If for example your extension is backing up a large file
|
||||||
* in an operation that takes time to complete, your extension may decide to finish the ongoing backup rather
|
* in an operation that takes time to complete, your extension may decide to finish the ongoing backup rather
|
||||||
* than cancelling it to ensure that VS Code has some valid backup.
|
* than cancelling it to ensure that VS Code has some valid backup.
|
||||||
*/
|
*/
|
||||||
backup(cancellation: CancellationToken): Thenable<void>;
|
backup(document: CustomDocument, cancellation: CancellationToken): Thenable<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1375,7 +1386,7 @@ declare module 'vscode' {
|
|||||||
*
|
*
|
||||||
* @return The capabilities of the resolved document.
|
* @return The capabilities of the resolved document.
|
||||||
*/
|
*/
|
||||||
resolveCustomDocument(document: CustomDocument): Thenable<CustomEditorCapabilities>;
|
resolveCustomDocument(document: CustomDocument): Thenable<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve a webview editor for a given resource.
|
* Resolve a webview editor for a given resource.
|
||||||
@@ -1393,6 +1404,13 @@ declare module 'vscode' {
|
|||||||
* @return Thenable indicating that the webview editor has been resolved.
|
* @return Thenable indicating that the webview editor has been resolved.
|
||||||
*/
|
*/
|
||||||
resolveCustomEditor(document: CustomDocument, webviewPanel: WebviewPanel): Thenable<void>;
|
resolveCustomEditor(document: CustomDocument, webviewPanel: WebviewPanel): Thenable<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the editing capability of a custom webview document.
|
||||||
|
*
|
||||||
|
* When not provided, the document is considered readonly.
|
||||||
|
*/
|
||||||
|
readonly editingDelegate?: CustomEditorEditingDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -366,14 +366,14 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
|
|||||||
return this._customEditorService.models.add(resource, viewType, model);
|
return this._customEditorService.models.add(resource, viewType, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async $onDidEdit(resourceComponents: UriComponents, viewType: string, editId: number): Promise<void> {
|
public async $onDidEdit(resourceComponents: UriComponents, viewType: string, editId: number, label: string | undefined): Promise<void> {
|
||||||
const resource = URI.revive(resourceComponents);
|
const resource = URI.revive(resourceComponents);
|
||||||
const model = await this._customEditorService.models.get(resource, viewType);
|
const model = await this._customEditorService.models.get(resource, viewType);
|
||||||
if (!model || !(model instanceof MainThreadCustomEditorModel)) {
|
if (!model || !(model instanceof MainThreadCustomEditorModel)) {
|
||||||
throw new Error('Could not find model for webview editor');
|
throw new Error('Could not find model for webview editor');
|
||||||
}
|
}
|
||||||
|
|
||||||
model.pushEdit(editId);
|
model.pushEdit(editId, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
private hookupWebviewEventDelegate(handle: extHostProtocol.WebviewPanelHandle, input: WebviewInput) {
|
private hookupWebviewEventDelegate(handle: extHostProtocol.WebviewPanelHandle, input: WebviewInput) {
|
||||||
@@ -604,7 +604,7 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
|
|||||||
return this._viewType;
|
return this._viewType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public pushEdit(editId: number) {
|
public pushEdit(editId: number, label: string | undefined) {
|
||||||
if (!this._editable) {
|
if (!this._editable) {
|
||||||
throw new Error('Document is not editable');
|
throw new Error('Document is not editable');
|
||||||
}
|
}
|
||||||
@@ -617,7 +617,7 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
|
|||||||
this._undoService.pushElement({
|
this._undoService.pushElement({
|
||||||
type: UndoRedoElementType.Resource,
|
type: UndoRedoElementType.Resource,
|
||||||
resource: this.resource,
|
resource: this.resource,
|
||||||
label: 'Edit', // TODO: get this from extensions?
|
label: label ?? 'Edit',
|
||||||
undo: async () => {
|
undo: async () => {
|
||||||
if (!this._editable) {
|
if (!this._editable) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -592,7 +592,7 @@ export interface MainThreadWebviewsShape extends IDisposable {
|
|||||||
$registerCustomEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions): void;
|
$registerCustomEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions): void;
|
||||||
$unregisterEditorProvider(viewType: string): void;
|
$unregisterEditorProvider(viewType: string): void;
|
||||||
|
|
||||||
$onDidEdit(resource: UriComponents, viewType: string, editId: number): void;
|
$onDidEdit(resource: UriComponents, viewType: string, editId: number, label: string | undefined): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WebviewPanelViewStateData {
|
export interface WebviewPanelViewStateData {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||||
import { Emitter, Event } from 'vs/base/common/event';
|
import { Emitter, Event } from 'vs/base/common/event';
|
||||||
import { Disposable } from 'vs/base/common/lifecycle';
|
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||||
import { generateUuid } from 'vs/base/common/uuid';
|
import { generateUuid } from 'vs/base/common/uuid';
|
||||||
import * as modes from 'vs/editor/common/modes';
|
import * as modes from 'vs/editor/common/modes';
|
||||||
@@ -248,25 +248,31 @@ export class ExtHostWebviewEditor extends Disposable implements vscode.WebviewPa
|
|||||||
|
|
||||||
class CustomDocument extends Disposable implements vscode.CustomDocument {
|
class CustomDocument extends Disposable implements vscode.CustomDocument {
|
||||||
|
|
||||||
public static create(proxy: MainThreadWebviewsShape, viewType: string, uri: vscode.Uri) {
|
public static create(
|
||||||
return Object.seal(new CustomDocument(proxy, viewType, uri));
|
viewType: string,
|
||||||
|
uri: vscode.Uri,
|
||||||
|
editingDelegate: vscode.CustomEditorEditingDelegate | undefined
|
||||||
|
) {
|
||||||
|
return Object.seal(new CustomDocument(viewType, uri, editingDelegate));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicitly initialize all properties as we seal the object after creation!
|
// Explicitly initialize all properties as we seal the object after creation!
|
||||||
|
|
||||||
readonly #_edits = new Cache<unknown>('edits');
|
readonly #_edits = new Cache<unknown>('edits');
|
||||||
|
|
||||||
readonly #proxy: MainThreadWebviewsShape;
|
|
||||||
readonly #viewType: string;
|
readonly #viewType: string;
|
||||||
readonly #uri: vscode.Uri;
|
readonly #uri: vscode.Uri;
|
||||||
|
readonly #editingDelegate: vscode.CustomEditorEditingDelegate | undefined;
|
||||||
|
|
||||||
#capabilities: vscode.CustomEditorCapabilities | undefined = undefined;
|
private constructor(
|
||||||
|
viewType: string,
|
||||||
private constructor(proxy: MainThreadWebviewsShape, viewType: string, uri: vscode.Uri) {
|
uri: vscode.Uri,
|
||||||
|
editingDelegate: vscode.CustomEditorEditingDelegate | undefined,
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
this.#proxy = proxy;
|
|
||||||
this.#viewType = viewType;
|
this.#viewType = viewType;
|
||||||
this.#uri = uri;
|
this.#uri = uri;
|
||||||
|
this.#editingDelegate = editingDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
@@ -289,47 +295,35 @@ class CustomDocument extends Disposable implements vscode.CustomDocument {
|
|||||||
|
|
||||||
//#region Internal
|
//#region Internal
|
||||||
|
|
||||||
/** @internal*/ _setCapabilities(capabilities: vscode.CustomEditorCapabilities) {
|
|
||||||
if (this.#capabilities) {
|
|
||||||
throw new Error('Capabilities already provided');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#capabilities = capabilities;
|
|
||||||
capabilities.editing?.onDidEdit(edit => {
|
|
||||||
const id = this.#_edits.add([edit]);
|
|
||||||
this.#proxy.$onDidEdit(this.uri, this.viewType, id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal*/ async _revert(changes: { undoneEdits: number[], redoneEdits: number[] }) {
|
/** @internal*/ async _revert(changes: { undoneEdits: number[], redoneEdits: number[] }) {
|
||||||
const editing = this.getEditingCapability();
|
const editing = this.getEditingDelegate();
|
||||||
const undoneEdits = changes.undoneEdits.map(id => this.#_edits.get(id, 0));
|
const undoneEdits = changes.undoneEdits.map(id => this.#_edits.get(id, 0));
|
||||||
const appliedEdits = changes.redoneEdits.map(id => this.#_edits.get(id, 0));
|
const appliedEdits = changes.redoneEdits.map(id => this.#_edits.get(id, 0));
|
||||||
return editing.revert({ undoneEdits, appliedEdits });
|
return editing.revert(this, { undoneEdits, appliedEdits });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal*/ _undo(editId: number) {
|
/** @internal*/ _undo(editId: number) {
|
||||||
const editing = this.getEditingCapability();
|
const editing = this.getEditingDelegate();
|
||||||
const edit = this.#_edits.get(editId, 0);
|
const edit = this.#_edits.get(editId, 0);
|
||||||
return editing.undoEdits([edit]);
|
return editing.undoEdits(this, [edit]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal*/ _redo(editId: number) {
|
/** @internal*/ _redo(editId: number) {
|
||||||
const editing = this.getEditingCapability();
|
const editing = this.getEditingDelegate();
|
||||||
const edit = this.#_edits.get(editId, 0);
|
const edit = this.#_edits.get(editId, 0);
|
||||||
return editing.applyEdits([edit]);
|
return editing.applyEdits(this, [edit]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal*/ _save(cancellation: CancellationToken) {
|
/** @internal*/ _save(cancellation: CancellationToken) {
|
||||||
return this.getEditingCapability().save(cancellation);
|
return this.getEditingDelegate().save(this, cancellation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal*/ _saveAs(target: vscode.Uri) {
|
/** @internal*/ _saveAs(target: vscode.Uri) {
|
||||||
return this.getEditingCapability().saveAs(target);
|
return this.getEditingDelegate().saveAs(this, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal*/ _backup(cancellation: CancellationToken) {
|
/** @internal*/ _backup(cancellation: CancellationToken) {
|
||||||
return this.getEditingCapability().backup(cancellation);
|
return this.getEditingDelegate().backup(this, cancellation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal*/ _disposeEdits(editIds: number[]) {
|
/** @internal*/ _disposeEdits(editIds: number[]) {
|
||||||
@@ -338,13 +332,17 @@ class CustomDocument extends Disposable implements vscode.CustomDocument {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal*/ _pushEdit(edit: unknown): number {
|
||||||
|
return this.#_edits.add([edit]);
|
||||||
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
private getEditingCapability(): vscode.CustomEditorEditingCapability {
|
private getEditingDelegate(): vscode.CustomEditorEditingDelegate {
|
||||||
if (!this.#capabilities?.editing) {
|
if (!this.#editingDelegate) {
|
||||||
throw new Error('Document is not editable');
|
throw new Error('Document is not editable');
|
||||||
}
|
}
|
||||||
return this.#capabilities.editing;
|
return this.#editingDelegate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,17 +485,24 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
|||||||
provider: vscode.CustomEditorProvider | vscode.CustomTextEditorProvider,
|
provider: vscode.CustomEditorProvider | vscode.CustomTextEditorProvider,
|
||||||
options: vscode.WebviewPanelOptions | undefined = {}
|
options: vscode.WebviewPanelOptions | undefined = {}
|
||||||
): vscode.Disposable {
|
): vscode.Disposable {
|
||||||
let disposable: vscode.Disposable;
|
const disposables = new DisposableStore();
|
||||||
if ('resolveCustomTextEditor' in provider) {
|
if ('resolveCustomTextEditor' in provider) {
|
||||||
disposable = this._editorProviders.addTextProvider(viewType, extension, provider);
|
disposables.add(this._editorProviders.addTextProvider(viewType, extension, provider));
|
||||||
this._proxy.$registerTextEditorProvider(toExtensionData(extension), viewType, options);
|
this._proxy.$registerTextEditorProvider(toExtensionData(extension), viewType, options);
|
||||||
} else {
|
} else {
|
||||||
disposable = this._editorProviders.addCustomProvider(viewType, extension, provider);
|
disposables.add(this._editorProviders.addCustomProvider(viewType, extension, provider));
|
||||||
this._proxy.$registerCustomEditorProvider(toExtensionData(extension), viewType, options);
|
this._proxy.$registerCustomEditorProvider(toExtensionData(extension), viewType, options);
|
||||||
|
if (provider.editingDelegate) {
|
||||||
|
disposables.add(provider.editingDelegate.onDidEdit(e => {
|
||||||
|
const document = e.document;
|
||||||
|
const editId = (document as CustomDocument)._pushEdit(e.edit);
|
||||||
|
this._proxy.$onDidEdit(document.uri, document.viewType, editId, e.label);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return VSCodeDisposable.from(
|
return VSCodeDisposable.from(
|
||||||
disposable,
|
disposables,
|
||||||
new VSCodeDisposable(() => {
|
new VSCodeDisposable(() => {
|
||||||
this._proxy.$unregisterEditorProvider(viewType);
|
this._proxy.$unregisterEditorProvider(viewType);
|
||||||
}));
|
}));
|
||||||
@@ -592,12 +597,11 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const revivedResource = URI.revive(resource);
|
const revivedResource = URI.revive(resource);
|
||||||
const document = CustomDocument.create(this._proxy, viewType, revivedResource);
|
const document = CustomDocument.create(viewType, revivedResource, entry.provider.editingDelegate);
|
||||||
const capabilities = await entry.provider.resolveCustomDocument(document);
|
await entry.provider.resolveCustomDocument(document);
|
||||||
document._setCapabilities(capabilities);
|
|
||||||
this._documents.add(document);
|
this._documents.add(document);
|
||||||
return {
|
return {
|
||||||
editable: !!capabilities.editing
|
editable: !!entry.provider.editingDelegate,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user