fix(Views): 优化侧边栏视图默认布局(次要视图默认折叠 + initialSize 高度权重) - #64
Merged
ThreeFish-AI merged 2 commits intoJul 4, 2026
Conversation
Stash/Shelf/Worktrees 默认 visibility:collapsed(仅占标题栏、点击即展开), Commit/Graph/Branches 及次要视图分别设 initialSize 高度权重,缓解视图挤占空间。 VS Code 侧边栏视图约 142px 最小展开高度为核心硬编码(官方 #123715 已 not planned), 无法经扩展解除;新默认仅对新安装或「View: Reset View Locations」后生效。 同步 CHANGELOG(Unreleased)与 docs/.agents/issue.md #12。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
依用户偏好将 hyperGit.worktrees 的 visibility 由 collapsed 改回 visible(保留 initialSize:1), 使其默认展开但占位收窄;Stash/Shelf 仍默认折叠。同步校正 CHANGELOG 与 issue #12 表述以对齐最终默认。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
This was referenced Jul 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景与动因
用户反馈 Worktrees 视图展开后无法继续缩小(仍占大片空白),期望「所有视图可拖到任意高度、取消最小高度限制」。
经核对 VS Code 核心源码与官方 issue 确认:该诉求无法经扩展实现——侧边栏每个视图面板最小体高由核心硬编码 = 120px(+22px 标题栏 ≈ 142px 最小展开高度,见
src/vs/base/browser/ui/splitview/paneview.ts),直接夹取拖拽分隔条下限;WebviewViewPane extends ViewPane未覆写该值,故本扩展 webview 与 tree 视图共用同一下限;开放该能力的官方特性请求 microsoft/vscode#123715 已关闭为 not planned,无任何 API/贡献点,注入 CSS 亦绕不过 JS 层minimumSize。据此与用户确认,采用受支持的折中缓解:优化初始布局默认值,降低视图挤占空间的体感(但不解除、也无法解除最小高度)。
改动内容(纯
package.json声明式,零 src 变更)contributes.views["hyper-git"]:visibility: "collapsed":默认仅占 22px 标题栏,点击即展开。visible:依用户偏好默认展开,仅以initialSize权重收窄(用户在本分支自定的最终取舍)。initialSize高度权重(类 CSS flex):Commit 3 / Graph 3 / Branches 2 / Stash·Shelf·Worktrees 各 1,令首屏比例更合理。同步文档:
CHANGELOG.md新增 Unreleased 条目;docs/.agents/issue.md追加 #12 沉淀该平台限制与缓解方式,防同类踩坑。实现细节与注意事项
viewsExtensionPoint.ts的viewDescriptorschema 确认可用;initialSize仅当「同一扩展同时拥有视图与容器」时生效——本扩展拥有hyper-git容器与全部视图,条件满足。visibility/initialSize只影响初始状态:新安装自动生效;已有持久化布局的老用户需执行命令面板「View: Reset View Locations」(或右键活动栏图标 → Reset Location)后才采用新默认。验证
pnpm run compile(tsc + eslint + esbuild)全绿;package.jsonJSON 合法。pnpm run test:unit:332/332 通过(33 文件)。