diff --git a/src/vs/workbench/api/common/apiCommands.ts b/src/vs/workbench/api/common/apiCommands.ts index ea4e3428172..5e55c18f426 100644 --- a/src/vs/workbench/api/common/apiCommands.ts +++ b/src/vs/workbench/api/common/apiCommands.ts @@ -97,12 +97,12 @@ CommandsRegistry.registerCommand({ export class DiffAPICommand { public static readonly ID = 'vscode.diff'; - public static execute(executor: ICommandsExecutor, left: URI, right: URI, label: string, options?: vscode.TextDocumentShowOptions): Promise { + public static execute(executor: ICommandsExecutor, left: URI, right: URI, label: string, options?: typeConverters.TextEditorOpenOptions): Promise { return executor.executeCommand('_workbench.diff', [ left, right, label, undefined, - typeConverters.TextEditorOptions.from(options), + typeConverters.TextEditorOpenOptions.from(options), options ? typeConverters.ViewColumn.from(options.viewColumn) : undefined ]); } @@ -111,7 +111,7 @@ CommandsRegistry.registerCommand(DiffAPICommand.ID, adjustHandler(DiffAPICommand export class OpenAPICommand { public static readonly ID = 'vscode.open'; - public static execute(executor: ICommandsExecutor, resource: URI, columnOrOptions?: vscode.ViewColumn | vscode.TextDocumentShowOptions, label?: string): Promise { + public static execute(executor: ICommandsExecutor, resource: URI, columnOrOptions?: vscode.ViewColumn | typeConverters.TextEditorOpenOptions, label?: string): Promise { let options: ITextEditorOptions | undefined; let position: EditorViewColumn | undefined; @@ -119,7 +119,7 @@ export class OpenAPICommand { if (typeof columnOrOptions === 'number') { position = typeConverters.ViewColumn.from(columnOrOptions); } else { - options = typeConverters.TextEditorOptions.from(columnOrOptions); + options = typeConverters.TextEditorOpenOptions.from(columnOrOptions); position = typeConverters.ViewColumn.from(columnOrOptions.viewColumn); } } @@ -136,14 +136,14 @@ CommandsRegistry.registerCommand(OpenAPICommand.ID, adjustHandler(OpenAPICommand export class OpenWithAPICommand { public static readonly ID = 'vscode.openWith'; - public static execute(executor: ICommandsExecutor, resource: URI, viewType: string, columnOrOptions?: vscode.ViewColumn | vscode.TextDocumentShowOptions): Promise { + public static execute(executor: ICommandsExecutor, resource: URI, viewType: string, columnOrOptions?: vscode.ViewColumn | typeConverters.TextEditorOpenOptions): Promise { let options: ITextEditorOptions | undefined; let position: EditorViewColumn | undefined; if (typeof columnOrOptions === 'number') { position = typeConverters.ViewColumn.from(columnOrOptions); } else if (typeof columnOrOptions !== 'undefined') { - options = typeConverters.TextEditorOptions.from(columnOrOptions); + options = typeConverters.TextEditorOpenOptions.from(columnOrOptions); } return executor.executeCommand('_workbench.openWith', [ diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index df4c3725115..6679b7bdd2a 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -1164,15 +1164,20 @@ export namespace FoldingRangeKind { } } -export namespace TextEditorOptions { +export interface TextEditorOpenOptions extends vscode.TextDocumentShowOptions { + background?: boolean; +} - export function from(options?: vscode.TextDocumentShowOptions): ITextEditorOptions | undefined { +export namespace TextEditorOpenOptions { + + export function from(options?: TextEditorOpenOptions): ITextEditorOptions | undefined { if (options) { return { pinned: typeof options.preview === 'boolean' ? !options.preview : undefined, + inactive: options.background, preserveFocus: options.preserveFocus, - selection: typeof options.selection === 'object' ? Range.from(options.selection) : undefined - } as ITextEditorOptions; + selection: typeof options.selection === 'object' ? Range.from(options.selection) : undefined, + }; } return undefined;