Skip to content

Commit

Permalink
make sure default editor position is set, fixes #25801
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed May 3, 2017
1 parent 5f2907b commit c9963a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 20 additions & 1 deletion extensions/vscode-api-tests/src/window.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as assert from 'assert';
import { workspace, window, commands, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind } from 'vscode';
import { join } from 'path';
import { cleanUp, pathEquals } from './utils';
import { cleanUp, pathEquals, createRandomFile } from './utils';

suite('window namespace tests', () => {

Expand Down Expand Up @@ -110,6 +110,25 @@ suite('window namespace tests', () => {
});
});

test('issue #25801 - default column when opening a file', async () => {
const [docA, docB, docC] = await Promise.all([
workspace.openTextDocument(await createRandomFile()),
workspace.openTextDocument(await createRandomFile()),
workspace.openTextDocument(await createRandomFile())
]);

await window.showTextDocument(docA, ViewColumn.One);
await window.showTextDocument(docB, ViewColumn.Two);

assert.ok(window.activeTextEditor);
assert.ok(window.activeTextEditor!.document === docB);
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.Two);

await window.showTextDocument(docC);
assert.ok(window.activeTextEditor!.document === docC);
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.One);
});

test('issue #5362 - Incorrect TextEditor passed by onDidChangeTextEditorSelection', (done) => {
const file10Path = join(workspace.rootPath || '', './10linefile.ts');
const file30Path = join(workspace.rootPath || '', './30linefile.ts');
Expand Down
2 changes: 2 additions & 0 deletions src/vs/workbench/api/node/extHostTextEditors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { IResolvedTextEditorConfiguration, ISelectionChangeEvent } from 'vs/work
import * as TypeConverters from './extHostTypeConverters';
import { TextEditorDecorationType, ExtHostTextEditor } from './extHostTextEditor';
import { ExtHostDocumentsAndEditors } from './extHostDocumentsAndEditors';
import { Position as EditorPosition } from 'vs/platform/editor/common/editor';
import { MainContext, MainThreadEditorsShape, ExtHostEditorsShape, ITextDocumentShowOptions, ITextEditorPositionData } from './extHost.protocol';
import * as vscode from 'vscode';

Expand Down Expand Up @@ -74,6 +75,7 @@ export class ExtHostEditors extends ExtHostEditorsShape {
};
} else {
options = {
position: EditorPosition.ONE,
preserveFocus: false,
pinned: true
};
Expand Down

0 comments on commit c9963a4

Please sign in to comment.