Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/vs/workbench/api/common/extHostTypeConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import { TestId } from '../../contrib/testing/common/testId.js';
import { CoverageDetails, DetailType, ICoverageCount, IFileCoverage, ISerializedTestResults, ITestErrorMessage, ITestItem, ITestRunProfileReference, ITestTag, TestMessageType, TestResultItem, TestRunProfileBitset, denamespaceTestTag, namespaceTestTag } from '../../contrib/testing/common/testTypes.js';
import { AiSettingsSearchResult, AiSettingsSearchResultKind } from '../../services/aiSettingsSearch/common/aiSettingsSearch.js';
import { EditorGroupColumn } from '../../services/editor/common/editorGroupColumn.js';
import { ACTIVE_GROUP, SIDE_GROUP } from '../../services/editor/common/editorService.js';
import { ACTIVE_GROUP, MODAL_GROUP, SIDE_GROUP } from '../../services/editor/common/editorService.js';
import { checkProposedApiEnabled, isProposedApiEnabled } from '../../services/extensions/common/extensions.js';
import { Dto, SerializableObjectWithBuffers } from '../../services/extensions/common/proxyIdentifier.js';
import * as extHostProtocol from './extHost.protocol.js';
Expand Down Expand Up @@ -328,6 +328,10 @@ export namespace ViewColumn {
return SIDE_GROUP;
}

if (column === types.ViewColumn.Modal) {
return MODAL_GROUP;
}

return ACTIVE_GROUP; // default is always the active group
}

Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/api/common/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ export enum InlineCompletionDisplayLocationKind {
export enum ViewColumn {
Active = -1,
Beside = -2,
Modal = -4,
One = 1,
Two = 2,
Three = 3,
Expand Down
43 changes: 41 additions & 2 deletions src/vs/workbench/api/test/common/extHostTypeConverters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import assert from 'assert';
import { URI, UriComponents } from '../../../../base/common/uri.js';
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';
import { IconPathDto } from '../../common/extHost.protocol.js';
import { ChatRequestModeInstructions, IconPath } from '../../common/extHostTypeConverters.js';
import { ThemeColor, ThemeIcon } from '../../common/extHostTypes.js';
import { ChatRequestModeInstructions, IconPath, ViewColumn } from '../../common/extHostTypeConverters.js';
import { ThemeColor, ThemeIcon, ViewColumn as ViewColumnEnum } from '../../common/extHostTypes.js';
import { ACTIVE_GROUP, MODAL_GROUP, SIDE_GROUP } from '../../../../workbench/services/editor/common/editorService.js';
import { IChatRequestModeInstructions } from '../../../contrib/chat/common/model/chatModel.js';
import { Dto } from '../../../services/extensions/common/proxyIdentifier.js';

Expand Down Expand Up @@ -243,4 +244,42 @@ suite('extHostTypeConverters', function () {
assert.deepStrictEqual(backToApi.toolReferences?.[1].range, [10, 20]);
});
});

suite('ViewColumn', function () {
suite('from', function () {
test('undefined defaults to Active group', function () {
assert.strictEqual(ViewColumn.from(undefined), ACTIVE_GROUP);
});

test('Active resolves to Active group', function () {
assert.strictEqual(ViewColumn.from(ViewColumnEnum.Active), ACTIVE_GROUP);
});

test('Beside resolves to Side group', function () {
assert.strictEqual(ViewColumn.from(ViewColumnEnum.Beside), SIDE_GROUP);
});

test('Modal resolves to Modal group', function () {
assert.strictEqual(ViewColumn.from(ViewColumnEnum.Modal), MODAL_GROUP);
});

test('numbered columns are zero-indexed', function () {
assert.strictEqual(ViewColumn.from(ViewColumnEnum.One), 0);
assert.strictEqual(ViewColumn.from(ViewColumnEnum.Two), 1);
assert.strictEqual(ViewColumn.from(ViewColumnEnum.Nine), 8);
});
});

suite('to', function () {
test('zero-indexed positions map to numbered columns', function () {
assert.strictEqual(ViewColumn.to(0), ViewColumnEnum.One);
assert.strictEqual(ViewColumn.to(1), ViewColumnEnum.Two);
assert.strictEqual(ViewColumn.to(8), ViewColumnEnum.Nine);
});

test('negative positions throw', function () {
assert.throws(() => ViewColumn.to(-1));
});
});
});
});
6 changes: 6 additions & 0 deletions src/vscode-dts/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7348,6 +7348,12 @@ declare module 'vscode' {
* of editors will always be `One`, `Two`, `Three`,... or `undefined` but never `Beside`.
*/
Beside = -2,
/**
* A *symbolic* editor column representing a modal overlay on top of the workbench. This value
* can be used when opening editors, but the *resolved* {@link TextEditor.viewColumn viewColumn}-value
* of editors will always be `One`, `Two`, `Three`,... or `undefined` but never `Modal`.
*/
Modal = -4,
/**
* The first editor column.
*/
Expand Down