diff --git a/packages/core/src/browser/widget-open-handler.ts b/packages/core/src/browser/widget-open-handler.ts index 02440e74ef988..83b15755c362c 100644 --- a/packages/core/src/browser/widget-open-handler.ts +++ b/packages/core/src/browser/widget-open-handler.ts @@ -36,6 +36,12 @@ export interface WidgetOpenerOptions extends OpenerOptions { * By default to the main area. */ widgetOptions?: ApplicationShell.WidgetOptions; + /** + * Specify what the widget is opened for + * 'preview': image/pdf/etc. preview + * 'edit': source file + */ + openFor?: 'preview' | 'edit'; } @injectable() diff --git a/packages/editor/src/browser/editor-manager.ts b/packages/editor/src/browser/editor-manager.ts index 29b549d8f8dba..0cc3e89e1ab2b 100644 --- a/packages/editor/src/browser/editor-manager.ts +++ b/packages/editor/src/browser/editor-manager.ts @@ -98,6 +98,10 @@ export class EditorManager extends NavigatableWidgetOpenHandler { } canHandle(uri: URI, options?: WidgetOpenerOptions): number { + // Set the priority higher than image/pdf/etc. preview handlers if the editor is used to 'open source' + if (options && options.openFor === 'edit') { + return 110; + } return 100; } diff --git a/packages/mini-browser/src/browser/mini-browser-open-handler.ts b/packages/mini-browser/src/browser/mini-browser-open-handler.ts index 9eea089d06bc2..12424b26e80e6 100644 --- a/packages/mini-browser/src/browser/mini-browser-open-handler.ts +++ b/packages/mini-browser/src/browser/mini-browser-open-handler.ts @@ -237,7 +237,8 @@ export class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler