File tree Expand file tree Collapse file tree
jetbrains_plugin/src/main
kotlin/org/zoocode/jetbrains/editor Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments