fix(details): share one message handler across both details-panel entry points - #300
Open
X-Guardian wants to merge 1 commit into
Open
X-Guardian wants to merge 1 commit into
X-Guardian wants to merge 1 commit into
Conversation
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
registerDetailsPanelMessageHandleronComponentBrowserProvider. Net −97 lines.currentVersionreported after a version switch.Change Type
Context
User-facing impact
templateFileUrltocomponentDetailsUpdated. The webview hides the element when the field is absent, so the link vanished until the panel was reopened.Refresh Versionsafter a version switch now reports the version on screen. The browser path never replaced its component afterversionChanged, so a laterfetchVersionssent the originally-openedcurrentVersion.GitLab scope
Affected areas
What changed by bucket
src/providers/componentBrowserProvider.tsregisterDetailsPanelMessageHandler(panel, component, options)holding the merged behaviour of both copies, plus aDetailsPanelOptionsinterface. The component is held in a mutable local so aversionChangedround trip replaces it — the detached path's behaviour, now applied to both._hoverContextis carried across that reassignment so an edit-in-place after a version switch still edits rather than inserting anew.src/providers/componentBrowserProvider.tsshowComponentDetails's inlineif/else-ifchain (~105 lines) collapses to one call.src/extension.tsswitch(~137 lines) collapses to one call passing{ detachedFrom: originalEditor }, dropping the imports it no longer needs.src/providers/componentBrowserProvider.tsComponentBrowserProviderand never callsshow(), sooriginalEditoris unset andinsertComponentwould refuse to insert. The handler adopts the editor passed viadetachedFromat registration, soinsertComponentbehaves identically on both paths.src/providers/componentBrowserProvider.tsinsertComponentFromDetached, a one-line pass-through toinsertComponent, has no callers left and is removed.Validation
Local checks
npm run compilenpm test— 411 passing;npm run lintcleanManual test notes
component:include → View Full Component Details → switch version: the Template File link disappears onbetaand is retained here. Needs a component with a cachedtemplatePath, or the link is absent on initial render too..gitlab-ci.yml: the browser path adds an include at the cursor, the detached path edits the existing one in place. Both now run the same handler, and nothing automated covers either write.Breaking Changes
Risk and Rollback
_hoverContext. The wrong branch duplicates an include or overwrites the wrong lines, which only the insert checks above would catch.Release Notes Draft
Checklist
vscodeand is not reachable from the unit suite; the label logic it calls is covered by the existingtagScopingtests)