make sure default editor position is set, fixes #25801

This commit is contained in:
Johannes Rieken
2017-05-03 14:34:45 +02:00
parent d9311bd396
commit 358eb92d72
2 changed files with 22 additions and 1 deletions

View File

@@ -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', () => {
@@ -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');