Add API to open a file or diff editor on a specific selection range (fixes #30241)

This commit is contained in:
Benjamin Pasero
2017-07-07 12:20:34 +02:00
parent 6af048189e
commit f381ce961d
7 changed files with 37 additions and 10 deletions

View File

@@ -15,7 +15,7 @@ import * as modes from 'vs/editor/common/modes';
import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
import { IWorkspaceSymbolProvider } from 'vs/workbench/parts/search/common/search';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
export class ExtHostApiCommands {
@@ -205,11 +205,12 @@ export class ExtHostApiCommands {
});
this._register('vscode.diff', (left: URI, right: URI, label: string, options?: vscode.TextDocumentShowOptions) => {
let editorOptions: IEditorOptions;
let editorOptions: ITextEditorOptions;
if (options) {
editorOptions = {
pinned: typeof options.preview === 'boolean' ? !options.preview : undefined,
preserveFocus: options.preserveFocus
preserveFocus: options.preserveFocus,
selection: typeof options.selection === 'object' ? typeConverters.fromRange(options.selection) : undefined
};
}