Skip to content

Commit f82c89e

Browse files
committed
fix tab state issue
1 parent 1c4bea4 commit f82c89e

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

jetbrains_plugin/src/main/kotlin/org/zoocode/jetbrains/editor/TabStateManager.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,26 @@ class TabStateManager(var project: Project) {
4242
// Generate new group ID
4343
val groupId = nextGroupId++
4444

45+
// IEditorTabGroupDto.viewColumn uses VS Code's zero-based EditorGroupColumn.
46+
// ACTIVE_GROUP (-1) and SIDE_GROUP (-2) are valid only while selecting a
47+
// target group; exposing either through the DTO makes ViewColumn.to throw
48+
// "invalid 'EditorGroupColumn'" when an extension reads TabGroup.viewColumn.
49+
val resolvedViewColumn = when (viewColumn) {
50+
EditorGroupColumn.active.value -> state.groups.values
51+
.firstOrNull { it.isActive }
52+
?.viewColumn
53+
?: 0
54+
EditorGroupColumn.beside.value -> (state.groups.values
55+
.maxOfOrNull { it.viewColumn }
56+
?: -1) + 1
57+
else -> viewColumn.coerceAtLeast(0)
58+
}
59+
4560
// Create tab group
4661
val group = EditorTabGroupDto(
4762
groupId = groupId,
4863
isActive = isActive,
49-
viewColumn = viewColumn,
64+
viewColumn = resolvedViewColumn,
5065
tabs = emptyList()
5166
)
5267
state.groups[groupId] = group

jetbrains_plugin/src/main/resources/icons/zoo-logo.svg

Lines changed: 1 addition & 1 deletion
Loading

jetbrains_plugin/src/main/resources/icons/zoo-logo_dark.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)