Fix VS Code theme not appearing (extension needs an extensions.json entry) - #128
Fix VS Code theme not appearing (extension needs an extensions.json entry)#128srince77 wants to merge 1 commit into
Conversation
VS Code no longer treats a bare extension folder as installed. It checks ~/.vscode/extensions/extensions.json to know what is installed, so Aether's generated extension folder was never recognized, even though its files were correct. Omarchy's own omarchy-theme-set-vscode script already works around this for its bundled theme by writing a matching entry into extensions.json. This applies the same fix to Aether's ApplyVSCodeTheme: register the extension there after writing its files, and clear any leftover .obsolete marker from a previous uninstall. Existing entries in extensions.json are preserved untouched, so Marketplace extensions keep their metadata. Registration failures are logged rather than failing theme application. Fixes omacom#113
|
@bjarneo Wanted to flag my reasoning behind this fix and a possible follow up, in case you'd rather steer before I spend more time on it. Why this approach: VS Code stopped picking up a bare extension folder in A more robust alternative I'm considering: Happy to build that out if it's worth the extra surface area, or leave this fix as is if the simpler approach is preferred. Let me know which direction you'd rather see. |
Fixes #113.
VS Code stopped treating a bare extension folder as installed. It now checks
~/.vscode/extensions/extensions.jsonto know what is installed, so an unpacked folder placed there with nothing recording it is invisible to the theme picker and the Extensions view, even though the files are correct.I confirmed this on my own machine (VS Code 1.137.0). Omarchy's own VS Code theme hook,
omarchy-theme-set-vscode, already works around this for its bundled theme by writing a matching entry intoextensions.json. Aether'sApplyVSCodeThemenever did the equivalent, so its generated extension folder sits there unrecognized, which matches exactly what is reported in #113.What this changes
internal/theme/applier_vscode.go: after writing the extension files, also register the extension inextensions.jsonusing the same entry shape Omarchy's script writes, and clear any leftover.obsoletemarker from a previous uninstall (VS Code will hide an extension that is still listed there even if it is back inextensions.json).Existing entries in
extensions.jsonare preserved untouched viajson.RawMessage, so Marketplace extensions keep their metadata. Registration failures are logged rather than failing theme application, so a corrupt or unreadableextensions.jsoncannot break the rest of theme apply.No new dependencies.
Testing
internal/theme/applier_vscode_test.gocovering: extension gets registered end to end throughApplyVSCodeTheme, existing marketplace entries are preserved with their metadata intact, repeated calls do not create duplicate entries, and the.obsoletemarker is cleared (both when other keys remain and when it becomes empty).go test ./internal/... ./cli/...passes.go vet ./internal/... ./cli/...clean.gofmt -lclean on changed files.