Change:
For
Verify: write an extension that exercises the following APIs by passing in a selection as option and verify the selection is revealed and showing up in the opened editor: command API Provide a property of type to get it. !

Discussion:
import * as assert from 'assert'; import { join } from 'path'; <del> import { commands, workspace, window, Uri, ViewColumn } from 'vscode'; </del> <ins> import { commands, workspace, window, Uri, ViewColumn, Range, Position } from 'vscode'; </ins> suite('commands namespace tests', () => {

registration.dispose(); }); <del> let c = commands.executeCommand('vscode.diff').then(() => assert.ok(false), () => assert.ok(true)); let d = commands.executeCommand('vscode.diff', 1, 2, 3).then(() => assert.ok(false), () => assert.ok(true)); </del> <ins> let c = commands.executeCommand('vscode.diff', Uri.parse('sc:a'), Uri.parse('sc:b'), 'Title', { selection: new Range(new Position(1, 1), new Position(1, 2)) }).then(value => { assert.ok(value === void 0); registration.dispose(); }); </ins> <del> return Promise.all([a, b, c, d]); </del> <ins> let d = commands.executeCommand('vscode.diff').then(() => assert.ok(false), () => assert.ok(true)); let e = commands.executeCommand('vscode.diff', 1, 2, 3).then(() => assert.ok(false), () => assert.ok(true)); return Promise.all([a, b, c, d, e]); </ins> }); test('api-command: vscode.open', function () {

}); }); <ins> test('openTextDocument, with selection', function () { return createRandomFile('foonbarnbar').then(file => { return vscode.workspace.openTextDocument(file).then(doc => { return vscode.window.showTextDocument(doc, { selection: new vscode.Range(new vscode.Position(1, 1), new vscode.Position(1, 2)) }).then(editor => { assert.equal(editor.selection.start.line, 1); assert.equal(editor.selection.start.character, 1); assert.equal(editor.selection.end.line, 1); assert.equal(editor.selection.end.character, 2); }); }); }); }); </ins> test('registerTextDocumentContentProvider, simple', function () { let registration = vscode.workspace.registerTextDocumentContentProvider('foo', {

* with the next editor or if it will be kept. */ preview?: boolean; <ins> /** * An optional selection to apply for the document in the [editor](#TextEditor). */ selection?: Range; </ins> } /**

import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; <del> import { IEditorOptions, Position as EditorPosition } from 'vs/platform/editor/common/editor'; </del> <ins> import { Position as EditorPosition, ITextEditorOptions } from 'vs/platform/editor/common/editor'; </ins> import { MainThreadTextEditor } from './mainThreadEditor'; import { ITextEditorConfigurationUpdate, TextEditorRevealType, IApplyEditsOptions, IUndoStopOptions } from 'vs/workbench/api/node/extHost.protocol';

// --- from extension host process $tryShowTextDocument(resource: URI, options: ITextDocumentShowOptions): TPromise<string> { <del> const editorOptions: IEditorOptions = { </del> <ins> const editorOptions: ITextEditorOptions = { </ins> preserveFocus: options.preserveFocus, <del> pinned: options.pinned </del> <ins> pinned: options.pinned, selection: options.selection </ins> }; const input = {

position?: EditorPosition; preserveFocus?: boolean; pinned?: boolean; <ins> selection?: IRange; </ins> } export abstract class MainThreadEditorsShape {

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'; <del> import { IEditorOptions } from 'vs/platform/editor/common/editor'; </del> <ins> import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; </ins> export class ExtHostApiCommands {

}); this._register('vscode.diff', (left: URI, right: URI, label: string, options?: vscode.TextDocumentShowOptions) => { <del> let editorOptions: IEditorOptions; </del> <ins> let editorOptions: ITextEditorOptions; </ins> if (options) { editorOptions = { pinned: typeof options.preview === 'boolean' ? !options.preview : undefined, <del> preserveFocus: options.preserveFocus </del> <ins> preserveFocus: options.preserveFocus, selection: typeof options.selection === 'object' ? typeConverters.fromRange(options.selection) : undefined </ins> }; }

options = { position: TypeConverters.fromViewColumn(columnOrOptions.viewColumn), preserveFocus: columnOrOptions.preserveFocus, <ins> selection: typeof columnOrOptions.selection === 'object' ? TypeConverters.fromRange(columnOrOptions.selection) : undefined, </ins> pinned: typeof columnOrOptions.preview === 'boolean' ? !columnOrOptions.preview : undefined }; } else {