mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 02:26:04 +00:00
Allow a custom editor to opt out of supporting multiple instances for a single resource
#77131
This commit is contained in:
parent
a565d7e2e8
commit
5913061e1b
|
@ -23,7 +23,9 @@ export function activate(context: vscode.ExtensionContext) {
|
||||||
|
|
||||||
const previewManager = new PreviewManager(extensionRoot, sizeStatusBarEntry, binarySizeStatusBarEntry, zoomStatusBarEntry);
|
const previewManager = new PreviewManager(extensionRoot, sizeStatusBarEntry, binarySizeStatusBarEntry, zoomStatusBarEntry);
|
||||||
|
|
||||||
context.subscriptions.push(vscode.window.registerCustomEditorProvider2(PreviewManager.viewType, previewManager));
|
context.subscriptions.push(vscode.window.registerCustomEditorProvider2(PreviewManager.viewType, previewManager, {
|
||||||
|
supportsMultipleEditorsPerResource: true,
|
||||||
|
}));
|
||||||
|
|
||||||
context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomIn', () => {
|
context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomIn', () => {
|
||||||
previewManager.activePreview?.zoomIn();
|
previewManager.activePreview?.zoomIn();
|
||||||
|
|
13
src/vs/vscode.proposed.d.ts
vendored
13
src/vs/vscode.proposed.d.ts
vendored
|
@ -1401,6 +1401,19 @@ declare module 'vscode' {
|
||||||
provider: CustomEditorProvider,
|
provider: CustomEditorProvider,
|
||||||
options?: {
|
options?: {
|
||||||
readonly webviewOptions?: WebviewPanelOptions;
|
readonly webviewOptions?: WebviewPanelOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the provider allows multiple editor instances to be open at the same time for
|
||||||
|
* the same resource.
|
||||||
|
*
|
||||||
|
* If not set, VS Code only allows one editor instance to be open at a time for each resource. If the
|
||||||
|
* user tries to open a second editor instance for the resource, the first one is instead moved to where
|
||||||
|
* the second one was to be opened.
|
||||||
|
*
|
||||||
|
* When set, users can split and create copies of the custom editor. The custom editor must make sure it
|
||||||
|
* can properly synchronize the states of all editor instances for a resource so that they are consistent.
|
||||||
|
*/
|
||||||
|
readonly supportsMultipleEditorsPerResource?: boolean;
|
||||||
}
|
}
|
||||||
): Disposable;
|
): Disposable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
|
||||||
this.updateWebviewViewStates(this._editorService.activeEditor);
|
this.updateWebviewViewStates(this._editorService.activeEditor);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// This reviver's only job is to activate webview panel extensions
|
// This reviver's only job is to activate extensions.
|
||||||
// This should trigger the real reviver to be registered from the extension host side.
|
// This should trigger the real reviver to be registered from the extension host side.
|
||||||
this._register(_webviewWorkbenchService.registerResolver({
|
this._register(_webviewWorkbenchService.registerResolver({
|
||||||
canResolve: (webview: WebviewInput) => {
|
canResolve: (webview: WebviewInput) => {
|
||||||
|
@ -306,11 +306,11 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
|
||||||
}
|
}
|
||||||
|
|
||||||
public $registerTextEditorProvider(extensionData: extHostProtocol.WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions, capabilities: extHostProtocol.CustomTextEditorCapabilities): void {
|
public $registerTextEditorProvider(extensionData: extHostProtocol.WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions, capabilities: extHostProtocol.CustomTextEditorCapabilities): void {
|
||||||
this.registerEditorProvider(ModelType.Text, extensionData, viewType, options, capabilities);
|
this.registerEditorProvider(ModelType.Text, extensionData, viewType, options, capabilities, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public $registerCustomEditorProvider(extensionData: extHostProtocol.WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions): void {
|
public $registerCustomEditorProvider(extensionData: extHostProtocol.WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions, supportsMultipleEditorsPerResource: boolean): void {
|
||||||
this.registerEditorProvider(ModelType.Custom, extensionData, viewType, options, {});
|
this.registerEditorProvider(ModelType.Custom, extensionData, viewType, options, {}, supportsMultipleEditorsPerResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
private registerEditorProvider(
|
private registerEditorProvider(
|
||||||
|
@ -319,11 +319,16 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
|
||||||
viewType: string,
|
viewType: string,
|
||||||
options: modes.IWebviewPanelOptions,
|
options: modes.IWebviewPanelOptions,
|
||||||
capabilities: extHostProtocol.CustomTextEditorCapabilities,
|
capabilities: extHostProtocol.CustomTextEditorCapabilities,
|
||||||
|
supportsMultipleEditorsPerResource: boolean,
|
||||||
): DisposableStore {
|
): DisposableStore {
|
||||||
if (this._editorProviders.has(viewType)) {
|
if (this._editorProviders.has(viewType)) {
|
||||||
throw new Error(`Provider for ${viewType} already registered`);
|
throw new Error(`Provider for ${viewType} already registered`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._customEditorService.registerCustomEditorCapabilities(viewType, {
|
||||||
|
supportsMultipleEditorsPerResource
|
||||||
|
});
|
||||||
|
|
||||||
const extension = reviveWebviewExtension(extensionData);
|
const extension = reviveWebviewExtension(extensionData);
|
||||||
|
|
||||||
const disposables = new DisposableStore();
|
const disposables = new DisposableStore();
|
||||||
|
|
|
@ -581,12 +581,12 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||||
registerWebviewPanelSerializer: (viewType: string, serializer: vscode.WebviewPanelSerializer) => {
|
registerWebviewPanelSerializer: (viewType: string, serializer: vscode.WebviewPanelSerializer) => {
|
||||||
return extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializer);
|
return extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializer);
|
||||||
},
|
},
|
||||||
registerCustomEditorProvider: (viewType: string, provider: vscode.CustomTextEditorProvider, options?: { webviewOptions?: vscode.WebviewPanelOptions }) => {
|
registerCustomEditorProvider: (viewType: string, provider: vscode.CustomTextEditorProvider, options: { webviewOptions?: vscode.WebviewPanelOptions } = {}) => {
|
||||||
return extHostWebviews.registerCustomEditorProvider(extension, viewType, provider, options?.webviewOptions);
|
return extHostWebviews.registerCustomEditorProvider(extension, viewType, provider, options);
|
||||||
},
|
},
|
||||||
registerCustomEditorProvider2: (viewType: string, provider: vscode.CustomEditorProvider, options?: { webviewOptions?: vscode.WebviewPanelOptions }) => {
|
registerCustomEditorProvider2: (viewType: string, provider: vscode.CustomEditorProvider, options: { webviewOptions?: vscode.WebviewPanelOptions, supportsMultipleEditorsPerResource?: boolean } = {}) => {
|
||||||
checkProposedApiEnabled(extension);
|
checkProposedApiEnabled(extension);
|
||||||
return extHostWebviews.registerCustomEditorProvider(extension, viewType, provider, options?.webviewOptions);
|
return extHostWebviews.registerCustomEditorProvider(extension, viewType, provider, options);
|
||||||
},
|
},
|
||||||
registerDecorationProvider(provider: vscode.DecorationProvider) {
|
registerDecorationProvider(provider: vscode.DecorationProvider) {
|
||||||
checkProposedApiEnabled(extension);
|
checkProposedApiEnabled(extension);
|
||||||
|
|
|
@ -611,7 +611,7 @@ export interface MainThreadWebviewsShape extends IDisposable {
|
||||||
$unregisterSerializer(viewType: string): void;
|
$unregisterSerializer(viewType: string): void;
|
||||||
|
|
||||||
$registerTextEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions, capabilities: CustomTextEditorCapabilities): void;
|
$registerTextEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions, capabilities: CustomTextEditorCapabilities): void;
|
||||||
$registerCustomEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions): void;
|
$registerCustomEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions, supportsMultipleEditorsPerResource: boolean): void;
|
||||||
$unregisterEditorProvider(viewType: string): void;
|
$unregisterEditorProvider(viewType: string): void;
|
||||||
|
|
||||||
$onDidEdit(resource: UriComponents, viewType: string, editId: number, label: string | undefined): void;
|
$onDidEdit(resource: UriComponents, viewType: string, editId: number, label: string | undefined): void;
|
||||||
|
|
|
@ -457,17 +457,17 @@ export class ExtHostWebviews implements extHostProtocol.ExtHostWebviewsShape {
|
||||||
extension: IExtensionDescription,
|
extension: IExtensionDescription,
|
||||||
viewType: string,
|
viewType: string,
|
||||||
provider: vscode.CustomEditorProvider | vscode.CustomTextEditorProvider,
|
provider: vscode.CustomEditorProvider | vscode.CustomTextEditorProvider,
|
||||||
options: vscode.WebviewPanelOptions | undefined = {}
|
options: { webviewOptions?: vscode.WebviewPanelOptions, supportsMultipleEditorsPerResource?: boolean },
|
||||||
): vscode.Disposable {
|
): vscode.Disposable {
|
||||||
const disposables = new DisposableStore();
|
const disposables = new DisposableStore();
|
||||||
if ('resolveCustomTextEditor' in provider) {
|
if ('resolveCustomTextEditor' in provider) {
|
||||||
disposables.add(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.webviewOptions || {}, {
|
||||||
supportsMove: !!provider.moveCustomTextEditor,
|
supportsMove: !!provider.moveCustomTextEditor,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
disposables.add(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.webviewOptions || {}, !!options.supportsMultipleEditorsPerResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
return extHostTypes.Disposable.from(
|
return extHostTypes.Disposable.from(
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { coalesce } from 'vs/base/common/arrays';
|
import { coalesce, distinct } from 'vs/base/common/arrays';
|
||||||
import { Event, Emitter } from 'vs/base/common/event';
|
import { Emitter, Event } from 'vs/base/common/event';
|
||||||
import { Lazy } from 'vs/base/common/lazy';
|
import { Lazy } from 'vs/base/common/lazy';
|
||||||
import { Disposable } from 'vs/base/common/lifecycle';
|
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||||
import { basename, extname, isEqual } from 'vs/base/common/resources';
|
import { basename, extname, isEqual } from 'vs/base/common/resources';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { generateUuid } from 'vs/base/common/uuid';
|
import { generateUuid } from 'vs/base/common/uuid';
|
||||||
|
@ -23,20 +23,21 @@ import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||||
import { EditorInput, EditorOptions, GroupIdentifier, IEditorInput, IEditorPane } from 'vs/workbench/common/editor';
|
import { EditorInput, EditorOptions, GroupIdentifier, IEditorInput, IEditorPane } from 'vs/workbench/common/editor';
|
||||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||||
import { CONTEXT_CUSTOM_EDITORS, CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CustomEditorInfo, CustomEditorInfoCollection, CustomEditorPriority, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
import { CONTEXT_CUSTOM_EDITORS, CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CustomEditorCapabilities, CustomEditorInfo, CustomEditorInfoCollection, CustomEditorPriority, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||||
import { CustomEditorModelManager } from 'vs/workbench/contrib/customEditor/common/customEditorModelManager';
|
import { CustomEditorModelManager } from 'vs/workbench/contrib/customEditor/common/customEditorModelManager';
|
||||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||||
import { IWebviewService, webviewHasOwnEditFunctionsContext } from 'vs/workbench/contrib/webview/browser/webview';
|
import { IWebviewService, webviewHasOwnEditFunctionsContext } from 'vs/workbench/contrib/webview/browser/webview';
|
||||||
|
import { CustomEditorAssociation, CustomEditorsAssociations, customEditorsAssociationsSettingId } from 'vs/workbench/services/editor/browser/editorAssociationsSetting';
|
||||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||||
import { IEditorService, IOpenEditorOverride, ICustomEditorViewTypesHandler, ICustomEditorInfo, IOpenEditorOverrideEntry } from 'vs/workbench/services/editor/common/editorService';
|
import { ICustomEditorInfo, ICustomEditorViewTypesHandler, IEditorService, IOpenEditorOverride, IOpenEditorOverrideEntry } from 'vs/workbench/services/editor/common/editorService';
|
||||||
import { ContributedCustomEditors, defaultCustomEditor } from '../common/contributedCustomEditors';
|
import { ContributedCustomEditors, defaultCustomEditor } from '../common/contributedCustomEditors';
|
||||||
import { CustomEditorInput } from './customEditorInput';
|
import { CustomEditorInput } from './customEditorInput';
|
||||||
import { CustomEditorAssociation, CustomEditorsAssociations, customEditorsAssociationsSettingId } from 'vs/workbench/services/editor/browser/editorAssociationsSetting';
|
|
||||||
|
|
||||||
export class CustomEditorService extends Disposable implements ICustomEditorService, ICustomEditorViewTypesHandler {
|
export class CustomEditorService extends Disposable implements ICustomEditorService, ICustomEditorViewTypesHandler {
|
||||||
_serviceBrand: any;
|
_serviceBrand: any;
|
||||||
|
|
||||||
private readonly _contributedEditors = this._register(new ContributedCustomEditors());
|
private readonly _contributedEditors = this._register(new ContributedCustomEditors());
|
||||||
|
private readonly _editorCapabilities = new Map<string, CustomEditorCapabilities>();
|
||||||
|
|
||||||
private readonly _models = new CustomEditorModelManager();
|
private readonly _models = new CustomEditorModelManager();
|
||||||
|
|
||||||
|
@ -190,7 +191,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public openWith(
|
public async openWith(
|
||||||
resource: URI,
|
resource: URI,
|
||||||
viewType: string,
|
viewType: string,
|
||||||
options?: ITextEditorOptions,
|
options?: ITextEditorOptions,
|
||||||
|
@ -205,6 +206,14 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||||
return this.promptOpenWith(resource, options, group);
|
return this.promptOpenWith(resource, options, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const capabilities = this.getCustomEditorCapabilities(viewType) || {};
|
||||||
|
if (!capabilities.supportsMultipleEditorsPerResource) {
|
||||||
|
const movedEditor = await this.tryRevealExistingEditorForResourceInGroup(resource, viewType, options, group);
|
||||||
|
if (movedEditor) {
|
||||||
|
return movedEditor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const input = this.createInput(resource, viewType, group?.id);
|
const input = this.createInput(resource, viewType, group?.id);
|
||||||
return this.openEditorForResource(resource, input, options, group);
|
return this.openEditorForResource(resource, input, options, group);
|
||||||
}
|
}
|
||||||
|
@ -262,6 +271,20 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||||
return this.editorService.openEditor(input, options, group);
|
return this.editorService.openEditor(input, options, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public registerCustomEditorCapabilities(viewType: string, options: CustomEditorCapabilities): IDisposable {
|
||||||
|
if (this._editorCapabilities.has(viewType)) {
|
||||||
|
throw new Error(`Capabilities for ${viewType} already set`);
|
||||||
|
}
|
||||||
|
this._editorCapabilities.set(viewType, options);
|
||||||
|
return toDisposable(() => {
|
||||||
|
this._editorCapabilities.delete(viewType);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private getCustomEditorCapabilities(viewType: string): CustomEditorCapabilities | undefined {
|
||||||
|
return this._editorCapabilities.get(viewType);
|
||||||
|
}
|
||||||
|
|
||||||
private updateContexts() {
|
private updateContexts() {
|
||||||
const activeEditorPane = this.editorService.activeEditorPane;
|
const activeEditorPane = this.editorService.activeEditorPane;
|
||||||
const resource = activeEditorPane?.input?.resource;
|
const resource = activeEditorPane?.input?.resource;
|
||||||
|
@ -319,7 +342,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||||
} else {
|
} else {
|
||||||
// If there is, show a single prompt for all editors to see if the user wants to re-open them
|
// If there is, show a single prompt for all editors to see if the user wants to re-open them
|
||||||
//
|
//
|
||||||
// TODO: instead of prompting eagerly, it'd likly be better to replace all the editors with
|
// TODO: instead of prompting eagerly, it'd likely be better to replace all the editors with
|
||||||
// ones that would prompt when they first become visible
|
// ones that would prompt when they first become visible
|
||||||
await new Promise(resolve => setTimeout(resolve, 50));
|
await new Promise(resolve => setTimeout(resolve, 50));
|
||||||
viewType = await this.showOpenWithPrompt(newResource);
|
viewType = await this.showOpenWithPrompt(newResource);
|
||||||
|
@ -342,6 +365,54 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
||||||
}), group);
|
}), group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async tryRevealExistingEditorForResourceInGroup(
|
||||||
|
resource: URI,
|
||||||
|
viewType: string,
|
||||||
|
options?: ITextEditorOptions,
|
||||||
|
group?: IEditorGroup,
|
||||||
|
): Promise<IEditorPane | undefined> {
|
||||||
|
const editorInfoForResource = this.findExistingEditorsForResource(resource, viewType);
|
||||||
|
if (!editorInfoForResource.length) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
const editorToUse = editorInfoForResource[0];
|
||||||
|
|
||||||
|
// Replace all other editors
|
||||||
|
for (const { editor, group } of editorInfoForResource) {
|
||||||
|
if (editor !== editorToUse.editor) {
|
||||||
|
group.closeEditor(editor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const targetGroup = group || this.editorGroupService.activeGroup;
|
||||||
|
const newEditor = await this.openEditorForResource(resource, editorToUse.editor, { ...options, ignoreOverrides: true }, targetGroup);
|
||||||
|
if (targetGroup.id !== editorToUse.group.id) {
|
||||||
|
editorToUse.group.closeEditor(editorToUse.editor);
|
||||||
|
}
|
||||||
|
return newEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private findExistingEditorsForResource(
|
||||||
|
resource: URI,
|
||||||
|
viewType: string,
|
||||||
|
): Array<{ editor: IEditorInput, group: IEditorGroup }> {
|
||||||
|
const out: Array<{ editor: IEditorInput, group: IEditorGroup }> = [];
|
||||||
|
const orderedGroups = distinct([
|
||||||
|
this.editorGroupService.activeGroup,
|
||||||
|
...this.editorGroupService.groups,
|
||||||
|
]);
|
||||||
|
|
||||||
|
for (const group of orderedGroups) {
|
||||||
|
for (const editor of group.editors) {
|
||||||
|
if (isMatchingCustomEditor(editor, viewType, resource)) {
|
||||||
|
out.push({ editor, group });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CustomEditorContribution extends Disposable implements IWorkbenchContribution {
|
export class CustomEditorContribution extends Disposable implements IWorkbenchContribution {
|
||||||
|
@ -549,6 +620,11 @@ export class CustomEditorContribution extends Disposable implements IWorkbenchCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isMatchingCustomEditor(editor: IEditorInput, viewType: string, resource: URI): boolean {
|
||||||
|
return editor instanceof CustomEditorInput
|
||||||
|
&& editor.viewType === viewType
|
||||||
|
&& isEqual(editor.resource, resource);
|
||||||
|
}
|
||||||
|
|
||||||
registerThemingParticipant((theme, collector) => {
|
registerThemingParticipant((theme, collector) => {
|
||||||
const shadow = theme.getColor(colorRegistry.scrollbarShadow);
|
const shadow = theme.getColor(colorRegistry.scrollbarShadow);
|
||||||
|
|
|
@ -21,6 +21,10 @@ export const ICustomEditorService = createDecorator<ICustomEditorService>('custo
|
||||||
export const CONTEXT_CUSTOM_EDITORS = new RawContextKey<string>('customEditors', '');
|
export const CONTEXT_CUSTOM_EDITORS = new RawContextKey<string>('customEditors', '');
|
||||||
export const CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE = new RawContextKey<boolean>('focusedCustomEditorIsEditable', false);
|
export const CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE = new RawContextKey<boolean>('focusedCustomEditorIsEditable', false);
|
||||||
|
|
||||||
|
export interface CustomEditorCapabilities {
|
||||||
|
readonly supportsMultipleEditorsPerResource?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ICustomEditorService {
|
export interface ICustomEditorService {
|
||||||
_serviceBrand: any;
|
_serviceBrand: any;
|
||||||
|
|
||||||
|
@ -35,6 +39,8 @@ export interface ICustomEditorService {
|
||||||
|
|
||||||
openWith(resource: URI, customEditorViewType: string, options?: ITextEditorOptions, group?: IEditorGroup): Promise<IEditorPane | undefined>;
|
openWith(resource: URI, customEditorViewType: string, options?: ITextEditorOptions, group?: IEditorGroup): Promise<IEditorPane | undefined>;
|
||||||
promptOpenWith(resource: URI, options?: ITextEditorOptions, group?: IEditorGroup): Promise<IEditorPane | undefined>;
|
promptOpenWith(resource: URI, options?: ITextEditorOptions, group?: IEditorGroup): Promise<IEditorPane | undefined>;
|
||||||
|
|
||||||
|
registerCustomEditorCapabilities(viewType: string, options: CustomEditorCapabilities): IDisposable;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICustomEditorModelManager {
|
export interface ICustomEditorModelManager {
|
||||||
|
|
Loading…
Reference in a new issue