Fix the pin toggle, stale selection, and project detection in Unity repos

Three problems visible on a real project:

- The inline pin button showed twice on every unpinned row: the `when`
  clauses matched /pinned/ and /unpinned/, and "unpinned" contains "pinned".
  Context values now use unambiguous `pin:on` / `pin:off` tokens, and both
  commands call one togglePin — the pair exists only so the button's icon can
  reflect the current state.
- The list selected the tab you just left. followActiveTab read `isActive`
  from the entry snapshot, and after a refresh the tree has not necessarily
  asked for children yet, so it matched against the previous build. It now
  rebuilds the list and compares against the live active tab.
- Every file in a Unity repo resolved to an arbitrary project. Unity generates
  one .csproj per assembly into the repo root, and the walk took whichever
  readDirectory happened to return first. Matches are now sorted, a project
  file named after its directory wins, and .asmdef — which lives in the
  assembly's own directory and is what actually defines a Unity assembly — is
  a default marker, so it is found before reaching the root.

Palette widened from 8 to 12 hues, since a hash-assigned colour collides more
often than it looks like it should.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
max
2026-09-07 18:24:36 +02:00
co-authored by Claude Opus 5
parent 7e104450e8
commit 2e9a43f78b
3 changed files with 90 additions and 31 deletions
+49 -12
View File
@@ -115,12 +115,12 @@
"view/item/context": [
{
"command": "verticalTabs.pin",
"when": "view == verticalTabs.tabs && viewItem =~ /unpinned/",
"when": "view == verticalTabs.tabs && viewItem =~ /pin:off/",
"group": "inline@1"
},
{
"command": "verticalTabs.unpin",
"when": "view == verticalTabs.tabs && viewItem =~ /pinned/",
"when": "view == verticalTabs.tabs && viewItem =~ /pin:on/",
"group": "inline@1"
},
{
@@ -130,12 +130,12 @@
},
{
"command": "verticalTabs.pin",
"when": "view == verticalTabs.tabs && viewItem =~ /unpinned/",
"when": "view == verticalTabs.tabs && viewItem =~ /pin:off/",
"group": "1_state@1"
},
{
"command": "verticalTabs.unpin",
"when": "view == verticalTabs.tabs && viewItem =~ /pinned/",
"when": "view == verticalTabs.tabs && viewItem =~ /pin:on/",
"group": "1_state@1"
},
{
@@ -239,6 +239,7 @@
"type": "string"
},
"default": [
".asmdef",
".csproj",
".fsproj",
".vbproj",
@@ -259,7 +260,7 @@
"description": "Project colour 1.",
"defaults": {
"dark": "#4ec9b0",
"light": "#267f99",
"light": "#227d68",
"highContrast": "#4ec9b0"
}
},
@@ -268,7 +269,7 @@
"description": "Project colour 2.",
"defaults": {
"dark": "#dcdcaa",
"light": "#795e26",
"light": "#7a6e17",
"highContrast": "#dcdcaa"
}
},
@@ -277,7 +278,7 @@
"description": "Project colour 3.",
"defaults": {
"dark": "#9cdcfe",
"light": "#001080",
"light": "#0b5f92",
"highContrast": "#9cdcfe"
}
},
@@ -286,7 +287,7 @@
"description": "Project colour 4.",
"defaults": {
"dark": "#c586c0",
"light": "#af00db",
"light": "#8b338a",
"highContrast": "#c586c0"
}
},
@@ -295,7 +296,7 @@
"description": "Project colour 5.",
"defaults": {
"dark": "#ce9178",
"light": "#a31515",
"light": "#a3441f",
"highContrast": "#ce9178"
}
},
@@ -304,7 +305,7 @@
"description": "Project colour 6.",
"defaults": {
"dark": "#b5cea8",
"light": "#098658",
"light": "#3c7a2e",
"highContrast": "#b5cea8"
}
},
@@ -313,7 +314,7 @@
"description": "Project colour 7.",
"defaults": {
"dark": "#569cd6",
"light": "#0000ff",
"light": "#1d4f91",
"highContrast": "#569cd6"
}
},
@@ -322,10 +323,46 @@
"description": "Project colour 8.",
"defaults": {
"dark": "#d7ba7d",
"light": "#b8860b",
"light": "#8a6512",
"highContrast": "#d7ba7d"
}
},
{
"id": "verticalTabs.project9",
"description": "Project colour 9.",
"defaults": {
"dark": "#f28b82",
"light": "#b3261e",
"highContrast": "#f28b82"
}
},
{
"id": "verticalTabs.project10",
"description": "Project colour 10.",
"defaults": {
"dark": "#a5d6a7",
"light": "#2e7d32",
"highContrast": "#a5d6a7"
}
},
{
"id": "verticalTabs.project11",
"description": "Project colour 11.",
"defaults": {
"dark": "#b39ddb",
"light": "#5e35b1",
"highContrast": "#b39ddb"
}
},
{
"id": "verticalTabs.project12",
"description": "Project colour 12.",
"defaults": {
"dark": "#80cbc4",
"light": "#00695c",
"highContrast": "#80cbc4"
}
},
{
"id": "verticalTabs.noProject",
"description": "Colour for files that belong to no project.",