提交 026fc297 编写于 作者: B Benjamin Pasero

grid - open editors in active group when no ViewColumn is provided

上级 db3acf9e
......@@ -133,7 +133,7 @@ suite('window namespace tests', () => {
}
});
test('issue #25801 - default column when opening a file', async () => {
test('default column when opening a file', async () => {
const [docA, docB, docC] = await Promise.all([
workspace.openTextDocument(await createRandomFile()),
workspace.openTextDocument(await createRandomFile()),
......@@ -153,7 +153,7 @@ suite('window namespace tests', () => {
`wanted fileName:${editor.document.fileName}/viewColumn:${editor.viewColumn} but got fileName:${window.activeTextEditor!.document.fileName}/viewColumn:${window.activeTextEditor!.viewColumn}. a:${docA.fileName}, b:${docB.fileName}, c:${docC.fileName}`
);
assert.ok(window.activeTextEditor!.document === docC);
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.One);
assert.equal(window.activeTextEditor!.viewColumn, ViewColumn.Two);
});
test('issue #27408 - showTextDocument & vscode.diff always default to ViewColumn.One', async () => {
......
......@@ -752,7 +752,7 @@ declare module 'vscode' {
export interface TextDocumentShowOptions {
/**
* An optional view column in which the [editor](#TextEditor) should be shown.
* The default is the [one](#ViewColumn.One), other values are adjusted to
* The default is the [one](#ViewColumn.Active), other values are adjusted to
* be `Min(column, columnCount + 1)`, the [active](#ViewColumn.Active)-column is
* not adjusted.
*/
......@@ -5479,7 +5479,7 @@ declare module 'vscode' {
* to control where the editor is being shown. Might change the [active editor](#window.activeTextEditor).
*
* @param document A text document to be shown.
* @param column A view column in which the [editor](#TextEditor) should be shown. The default is the [one](#ViewColumn.One), other values
* @param column A view column in which the [editor](#TextEditor) should be shown. The default is the [one](#ViewColumn.Active), other values
* are adjusted to be `Min(column, columnCount + 1)`, the [active](#ViewColumn.Active)-column is
* not adjusted.
* @param preserveFocus When `true` the editor will not take focus.
......
......@@ -11,7 +11,6 @@ import { TextEditorSelectionChangeKind } from './extHostTypes';
import * as TypeConverters from './extHostTypeConverters';
import { TextEditorDecorationType, ExtHostTextEditor } from './extHostTextEditor';
import { ExtHostDocumentsAndEditors } from './extHostDocumentsAndEditors';
import { EditorViewColumn } from 'vs/workbench/api/shared/editor';
import { MainContext, MainThreadTextEditorsShape, ExtHostEditorsShape, ITextDocumentShowOptions, ITextEditorPositionData, IMainContext, WorkspaceEditDto, IEditorPropertiesChangeData } from './extHost.protocol';
import * as vscode from 'vscode';
......@@ -73,7 +72,6 @@ export class ExtHostEditors implements ExtHostEditorsShape {
};
} else {
options = {
position: 0 as EditorViewColumn,
preserveFocus: false
};
}
......
......@@ -158,23 +158,22 @@ export namespace DiagnosticSeverity {
export namespace ViewColumn {
export function from(column?: vscode.ViewColumn): EditorViewColumn {
let editorColumn = 0;
if (typeof column !== 'number') {
// stick with ONE
let editorColumn: EditorViewColumn;
if (column === <number>types.ViewColumn.One) {
editorColumn = 0;
} else if (column === <number>types.ViewColumn.Two) {
editorColumn = 1;
} else if (column === <number>types.ViewColumn.Three) {
editorColumn = 2;
} else if (column === <number>types.ViewColumn.Active) {
} else {
// in any other case (no column or ViewColumn.Active), leave the
// editorColumn as undefined which signals to use the active column
editorColumn = undefined;
}
return editorColumn;
}
export function to(position?: EditorViewColumn): vscode.ViewColumn {
if (typeof position !== 'number') {
return undefined;
}
if (position === 0) {
return <number>types.ViewColumn.One;
} else if (position === 1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册