提交 a8a920e2 编写于 作者: J Johannes Rieken

don't push code without tests... #8093

上级 ed26ad52
......@@ -6,7 +6,7 @@
'use strict';
import * as assert from 'assert';
import {workspace, window, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource} from 'vscode';
import {workspace, window, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind} from 'vscode';
import {join} from 'path';
import {cleanUp, pathEquals} from './utils';
......@@ -189,4 +189,24 @@ suite('window namespace tests', () => {
assert.equal(value, undefined);
});
});
test('editor, selection change kind', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => window.showTextDocument(doc)).then(editor => {
return new Promise((resolve, reject) => {
let subscription = window.onDidChangeTextEditorSelection(e => {
assert.ok(e.textEditor === editor);
assert.equal(e.kind, TextEditorSelectionChangeKind.Command);
subscription.dispose();
resolve();
});
editor.selection = new Selection(editor.selection.anchor, editor.selection.active.translate(2));
});
});
});
});
......@@ -80,6 +80,7 @@ export class ExtHostAPIImplementation {
TextEditorRevealType: typeof vscode.TextEditorRevealType;
EndOfLine: typeof vscode.EndOfLine;
TextEditorCursorStyle: typeof vscode.TextEditorCursorStyle;
TextEditorSelectionChangeKind: typeof vscode.TextEditorSelectionChangeKind;
commands: typeof vscode.commands;
window: typeof vscode.window;
workspace: typeof vscode.workspace;
......@@ -159,6 +160,7 @@ export class ExtHostAPIImplementation {
this.TextEditorRevealType = extHostTypes.TextEditorRevealType;
this.EndOfLine = extHostTypes.EndOfLine;
this.TextEditorCursorStyle = EditorCommon.TextEditorCursorStyle;
this.TextEditorSelectionChangeKind = extHostTypes.TextEditorSelectionChangeKind;
// env namespace
let telemetryInfo: ITelemetryInfo;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册