fix: recover workspace root on config/PAT change after empty activation - #41
Merged
Merged
Conversation
If a user activates the extension before setting tfvc.adoProject (and without a .vscode-tfvc/ folder), activate() early-returns without resolving `root`. The config-change listener already re-runs initRestClient(), so the REST client comes alive on first config save — but `root` stays undefined, so doInitRestClient() bails at line 122 without creating `repo`/`scmProvider`. Every TFVC command then trips wrapSCM's `!scmProvider` check and shows the misleading "Not configured" toast even though every setting is correct. Symptom from a customer's output channel: No TFVC workspace detected (...). ADO REST client initialized for https://tfs.ieq-network.de//FiF ADO client ready but no workspace root — SCM features disabled until a TFVC workspace is opened. Fix: in reinitOrWarn(), before kicking off initRestClient(), retry the root resolution if it's still undefined. Mirrors the activation-time fallback (first .vscode-tfvc/ folder, else first workspace folder). The user's window reload workaround is no longer needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
A customer reported a misleading "Not configured" toast even though every setting was correct. The output channel showed the giveaway:
Root cause: If
activate()runs beforetfvc.adoProjectis set (and there is no.vscode-tfvc/folder), the early return atextension.ts:302-305skips workspace-root resolution. The config-change listener correctly rebuilds the REST client when the user later types settings, butrootstaysundefined— sodoInitRestClient()bails out at line 122 without creatingrepo/scmProvider. Every TFVC command then tripswrapSCMs!scmProvidercheck and shows the misleading toast.The customer's only workaround was "reload the window after configuring".
Fix: In
reinitOrWarn(), retry the root resolution before callinginitRestClient()ifrootis still undefined. Mirrors the activation-time fallback (first.vscode-tfvc/folder, else first workspace folder).Test plan
npm run compilecleannpm test— 244/244 passTFVC: Set PAT(triggers activation with empty config — hits the early return).adoBaseUrl+adoCollectionPath+adoProjectin settings.TFVC: Initialize Workspace— should work without a window reload.🤖 Generated with Claude Code