mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
Fix #122360
This commit is contained in:
parent
2f5e355bea
commit
bf7d8da5f0
|
@ -13,6 +13,7 @@ import { BINARY_FILE_EDITOR_ID } from 'vs/workbench/contrib/files/common/files';
|
|||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { EditorOverride } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
|
||||
/**
|
||||
* An implementation of editor for binary files that cannot be displayed.
|
||||
|
@ -25,6 +26,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
|
|||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IEditorService private readonly editorService: IEditorService,
|
||||
@IEditorOverrideService private readonly editorOverrideService: IEditorOverrideService,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
super(
|
||||
|
@ -44,8 +46,11 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
|
|||
// Enforce to open the input as text to enable our text based viewer
|
||||
input.setForceOpenAsText();
|
||||
|
||||
// If more editors are installed that can handle this input, show a picker
|
||||
await this.editorService.openEditor(input, { ...options, override: EditorOverride.PICK, }, this.group);
|
||||
// Try to let the user pick an override if there is one availabe
|
||||
const overridenInput = await this.editorOverrideService.resolveEditorOverride(input, { ...options, override: EditorOverride.PICK, }, this.group);
|
||||
|
||||
// Open the overrriden input, else open the text based input
|
||||
await this.editorService.openEditor(overridenInput?.editor ?? input, overridenInput?.options ?? { ...options, override: EditorOverride.DISABLED, }, overridenInput?.group ?? this.group);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
|||
id: DEFAULT_EDITOR_ASSOCIATION.id,
|
||||
label: DEFAULT_EDITOR_ASSOCIATION.displayName,
|
||||
detail: DEFAULT_EDITOR_ASSOCIATION.providerDisplayName,
|
||||
describes: (currentEditor) => this.fileEditorInputFactory.isFileEditorInput(currentEditor) && isEqual(currentEditor.resource, this.activeEditor?.resource),
|
||||
describes: (currentEditor) => currentEditor.matches(this.activeEditor),
|
||||
priority: ContributedEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
|
|
Loading…
Reference in a new issue