diff --git a/extensions/vscode-api-tests/src/window.test.ts b/extensions/vscode-api-tests/src/window.test.ts index 13a18b0eecede..c52ed3333eb77 100644 --- a/extensions/vscode-api-tests/src/window.test.ts +++ b/extensions/vscode-api-tests/src/window.test.ts @@ -6,11 +6,11 @@ 'use strict'; import * as assert from 'assert'; -import {workspace, window, commands, ViewColumn, TextEditor, TextEditorViewColumnChangeEvent, Uri} from 'vscode'; +import {workspace, window, ViewColumn, TextEditorViewColumnChangeEvent, Uri} from 'vscode'; import {join} from 'path'; import {cleanUp, pathEquals} from './utils'; -suite("window namespace tests", () => { +suite('window namespace tests', () => { teardown(cleanUp); @@ -24,6 +24,11 @@ suite("window namespace tests", () => { }); }); + test('editor, UN-active text editor', () => { + assert.equal(window.visibleTextEditors.length, 0); + assert.ok(window.activeTextEditor === undefined); + }); + test('editor, assign and check view columns', () => { return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => { @@ -48,7 +53,7 @@ suite("window namespace tests", () => { provideTextDocumentContent() { return 'mountainbiking,roadcycling'; } - }) + }); return Promise.all([ workspace.openTextDocument(Uri.parse('bikes://testing/one')).then(doc => window.showTextDocument(doc, ViewColumn.One)), @@ -74,7 +79,7 @@ suite("window namespace tests", () => { assert.ok(actualEvent.viewColumn === two.viewColumn); registration1.dispose(); - }) + }); }); }); }); \ No newline at end of file diff --git a/src/vs/workbench/api/node/extHostEditors.ts b/src/vs/workbench/api/node/extHostEditors.ts index ac5b598606d3f..19a4ede1dc7bb 100644 --- a/src/vs/workbench/api/node/extHostEditors.ts +++ b/src/vs/workbench/api/node/extHostEditors.ts @@ -77,7 +77,7 @@ export class ExtHostEditors { } getActiveTextEditor(): vscode.TextEditor { - return this._activeEditorId && this._editors[this._activeEditorId]; + return this._editors[this._activeEditorId]; } getVisibleTextEditors(): vscode.TextEditor[] {