Conversation
… VS Code versions Flip the context key logic from negative (`doesNotSupportSecondarySidebar`) to positive (`supportsSecondarySidebar`) so that the secondary sidebar container is only declared when the VS Code version is known to support it. This prevents the "container 'qwen-code-secondary' does not exist" warning on older versions and avoids accidentally relocating other extensions' views to the Explorer container. Closes #2432 Closes #2416 Made-with: Cursor
📋 Review SummaryThis PR addresses a significant bug where VS Code versions below 1.106 would show a "container 'qwen-code-secondary' does not exist" warning and accidentally relocate other extensions' secondary sidebar views into the Explorer. The fix flips the context key logic from negative ( 🔍 General Feedback
🎯 Specific Feedback🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
PR #2545 代码审查📋 概述目的: 修复在 VS Code < 1.106 版本中出现的 "container 'qwen-code-secondary' does not exist" 警告,并防止扩展意外将其他扩展的 secondary sidebar 视图移动到 Explorer 容器中。 🔍 根本原因分析PR 作者正确识别了问题根源:
✅ 代码质量分析1. package.json 变更 (+4/-4)评价: ✅ 正确的逻辑翻转
2. chatViewRegistration.ts 变更评价: ✅ 优秀的改进
3. 测试变更评价: ✅ 测试覆盖完整
📊 评估总结
💡 改进建议1. 考虑添加版本检测的边界单元测试
it('handles version 1.105 correctly', () => {
expect(detectSecondarySidebarSupport('1.105.0')).toBe(false);
});
it('handles version 1.106 correctly', () => {
expect(detectSecondarySidebarSupport('1.106.0')).toBe(true);
});2. 文档建议可以在 🎯 最终结论推荐合并 ✅ 这是一个高质量的 bug 修复 PR:
建议: 合并前可在本地 VS Code 1.105 和 1.106 版本上进行手动验证。 |
TLDR
Fix the "container 'qwen-code-secondary' does not exist" warning on VS Code versions below 1.106, and prevent the extension from accidentally relocating other extensions' secondary sidebar views into the Explorer container.
Dive Deeper
Root cause:
The
package.jsonused a negative-logic context keyqwen-code:doesNotSupportSecondarySidebar. On older VS Code versions, this key was never explicitly set, so it evaluated toundefined(falsy). This causedwhen: "!qwen-code:doesNotSupportSecondarySidebar"to evaluate totrue, which registered thesecondarySidebarview container even though the VS Code version didn't support it. VS Code then moved all views registered to that non-existent container into the Explorer, including views from other extensions (e.g., Cline).Fix:
Flip the context key from negative logic (
doesNotSupportSecondarySidebar) to positive logic (supportsSecondarySidebar), and always explicitly callsetContextinchatViewRegistration.ts. On older VS Code versions, the key defaults toundefined(falsy), sowhen: "qwen-code:supportsSecondarySidebar"evaluates tofalse— the secondary sidebar container is never declared, avoiding the warning and layout disruption entirely.Changed files:
package.json— flip 4whenclause conditionssrc/constants/viewIds.ts— update comment to reflect new key namesrc/webview/providers/chatViewRegistration.ts— refactor context key setting logicsrc/webview/providers/chatViewRegistration.test.ts— update test assertionsReviewer Test Plan
npm run testto verify all unit tests passTesting Matrix
Linked issues / bugs
Closes #2432
Closes #2416
Made with Cursor