parent
0760c6f3d0
commit
9b6a9dba52
6 changed files with 11 additions and 4 deletions
|
@ -85,6 +85,7 @@ class SearchEditorContribution implements IWorkbenchContribution {
|
|||
},
|
||||
{
|
||||
singlePerResource: true,
|
||||
canHandleDiff: false,
|
||||
canSupportResource: resource => (extname(resource) === SEARCH_EDITOR_EXT)
|
||||
},
|
||||
({ resource }) => {
|
||||
|
|
|
@ -169,6 +169,7 @@ export class TerminalService implements ITerminalService {
|
|||
priority: RegisteredEditorPriority.exclusive
|
||||
},
|
||||
{
|
||||
canHandleDiff: false,
|
||||
canSupportResource: uri => uri.scheme === Schemas.vscodeTerminal,
|
||||
singlePerResource: true
|
||||
},
|
||||
|
|
|
@ -130,7 +130,8 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
return OverrideStatus.NONE;
|
||||
}
|
||||
|
||||
if (selectedEditor.createDiffEditorInput === undefined && isResourceDiffEditorInput(editor)) {
|
||||
const handlesDiff = typeof selectedEditor.options?.canHandleDiff === 'function' ? selectedEditor.options.canHandleDiff() : selectedEditor.options?.canHandleDiff;
|
||||
if (handlesDiff === false && isResourceDiffEditorInput(editor)) {
|
||||
return OverrideStatus.NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,10 @@ export type RegisteredEditorOptions = {
|
|||
* If your editor cannot be opened in multiple groups for the same resource
|
||||
*/
|
||||
singlePerResource?: boolean | (() => boolean);
|
||||
/**
|
||||
* If your editor supports diffs
|
||||
*/
|
||||
canHandleDiff?: boolean | (() => boolean);
|
||||
|
||||
/**
|
||||
* Whether or not you can support opening the given resource.
|
||||
|
|
|
@ -39,7 +39,7 @@ suite('EditorOverrideService', () => {
|
|||
detail: 'Test Editor Details',
|
||||
priority: RegisteredEditorPriority.default
|
||||
},
|
||||
{},
|
||||
{ canHandleDiff: false },
|
||||
({ resource, options }, group) => ({ editor: new TestFileEditorInput(URI.parse(resource.toString()), TEST_EDITOR_INPUT_ID) }),
|
||||
);
|
||||
|
||||
|
@ -63,7 +63,7 @@ suite('EditorOverrideService', () => {
|
|||
detail: 'Test Editor Details',
|
||||
priority: RegisteredEditorPriority.default
|
||||
},
|
||||
{},
|
||||
{ canHandleDiff: false },
|
||||
({ resource, options }, group) => ({ editor: new TestFileEditorInput(URI.parse(resource.toString()), TEST_EDITOR_INPUT_ID) }),
|
||||
({ resource, options }, group) => ({ editor: new TestFileEditorInput((resource ? resource : URI.from({ scheme: Schemas.untitled })), UNTITLED_TEST_EDITOR_INPUT_ID) }),
|
||||
);
|
||||
|
|
|
@ -204,7 +204,7 @@ suite('EditorService', () => {
|
|||
disposables.add(accessor.editorOverrideService.registerEditor(
|
||||
'*.editor-service-override-tests',
|
||||
{ id: TEST_EDITOR_INPUT_ID, label: 'Label', priority: RegisteredEditorPriority.exclusive },
|
||||
{},
|
||||
{ canHandleDiff: true },
|
||||
editor => {
|
||||
editorFactoryCalled++;
|
||||
lastEditorFactoryEditor = editor;
|
||||
|
|
Loading…
Reference in a new issue