Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

Problem

In workspace mode, when the extension initially activates with a default BSP, it marks that BSP with a 📌 pin icon. However, when a user subsequently double-clicks to activate a different BSP, the initial BSP's 📌 marker was not being removed. This resulted in multiple BSPs incorrectly displaying the pin icon simultaneously, making it unclear which BSP was actually the active one.

Root Cause

The issue occurred because the currentSelectedBspItem variable in tree.ts was not being initialized when the extension first activated and marked the default BSP in extension.ts.

When a user later switched to another BSP, the switching logic in tree.ts checked if currentSelectedBspItem existed before attempting to unmark the previous BSP. Since it was never initialized, the condition failed and the initial BSP's marker was never removed.

Solution

This PR adds a new exported function setCurrentSelectedBspItem() to tree.ts that properly initializes the currentSelectedBspItem tracking variable. This function is now called in extension.ts during extension activation, right after marking the initial default BSP.

With this change, the existing BSP switching logic now correctly:

  1. Identifies the previously selected BSP (including the initial one)
  2. Removes the 📌 marker from it
  3. Adds the marker to the newly selected BSP

Changes

  • src/project/tree.ts: Added setCurrentSelectedBspItem() function to initialize the current selected BSP item
  • src/extension.ts: Call setCurrentSelectedBspItem() when marking the initial BSP during extension activation

Testing

  • ✅ TypeScript compilation successful
  • ✅ Vue frontend build successful
  • ✅ ESLint validation passed
  • ✅ No breaking changes to existing functionality

Fixes the bug where the initial default BSP retained its 📌 marker after switching to another BSP in workspace mode.

Original prompt

This section details on the original issue you should resolve

<issue_title>bug: 在workspace模式下最初始的默认bsp,在后续激活其他bsp时,初始bsp依然处于激活状态</issue_title>
<issue_description>在workspace模式下最初始的默认bsp,在后续激活其他bsp时,初始bsp依然处于激活状态,依然还是显示 📌,并不会移除掉 📌

需要完善,修正这个问题:

  • 当再激活其他bsp做为当前bsp时,最初始的bsp状态变成正常状态,也移除 📌 标志。
    </issue_description>

<agent_instructions>修正这个bug,同时确保构建没问题。</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix initial BSP status not updating after activation Fix: Remove 📌 marker from initial BSP when switching to another BSP in workspace mode Oct 24, 2025
Copilot AI requested a review from BernardXiong October 24, 2025 15:55
@BernardXiong BernardXiong marked this pull request as ready for review October 24, 2025 16:04
@BernardXiong BernardXiong merged commit 8656796 into main Oct 24, 2025
4 checks passed
@BernardXiong BernardXiong deleted the copilot/fix-initial-bsp-status branch October 24, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: 在workspace模式下最初始的默认bsp,在后续激活其他bsp时,初始bsp依然处于激活状态

2 participants