Fix: Remove 📌 marker from initial BSP when switching to another BSP in workspace mode #30
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.
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
currentSelectedBspItemvariable intree.tswas not being initialized when the extension first activated and marked the default BSP inextension.ts.When a user later switched to another BSP, the switching logic in
tree.tschecked ifcurrentSelectedBspItemexisted 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()totree.tsthat properly initializes thecurrentSelectedBspItemtracking variable. This function is now called inextension.tsduring extension activation, right after marking the initial default BSP.With this change, the existing BSP switching logic now correctly:
Changes
setCurrentSelectedBspItem()function to initialize the current selected BSP itemsetCurrentSelectedBspItem()when marking the initial BSP during extension activationTesting
Fixes the bug where the initial default BSP retained its 📌 marker after switching to another BSP in workspace mode.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.