Skip to content

fix: pin error focuses the view instead of the view container#183

Merged
yoavbls merged 4 commits intoyoavbls:mainfrom
tysoncung:fix/pin-error-view-focus
Mar 9, 2026
Merged

fix: pin error focuses the view instead of the view container#183
yoavbls merged 4 commits intoyoavbls:mainfrom
tysoncung:fix/pin-error-view-focus

Conversation

@tysoncung
Copy link
Contributor

Problem

When clicking "Pin Error" in the tooltip, the command reveals the view container using workbench.view.extension.prettyTsErrors. If the user has moved the Pretty TS Errors webview view to a different view container (e.g. the Explorer sidebar), this command focuses the original (now potentially empty) container instead of where the view actually lives — causing an unexpected view switch.

Fix

Changed to use prettyTsErrors.sidePanel.focus which focuses the specific webview view regardless of which container it has been moved to. VS Code automatically generates a .focus command for each registered webview view.

Testing

  1. Move the "Pretty Typescript Errors" view to a separate view container (drag it to the Explorer sidebar or secondary sidebar)
  2. Focus the Pretty TS Errors view
  3. Hover over a TypeScript error and click "Pin Error"
  4. The Pretty TS Errors view should remain visible — previously it would switch to the Explorer view

Fixes #182

When clicking 'Pin Error', the command previously used
'workbench.view.extension.prettyTsErrors' which reveals the view
container. If the user has moved the Pretty TS Errors view to a
different view container (e.g. Explorer sidebar), this would switch
focus to the original (now empty) container instead of where the
view actually lives.

Changed to use 'prettyTsErrors.sidePanel.focus' which focuses the
specific webview view regardless of which container it has been
moved to.

Fixes yoavbls#182
@kevinramharak
Copy link
Collaborator

@tysoncung Thanks that was quick.

@yoavbls https://github.com/yoavbls/pretty-ts-errors/pull/181/changes explicitly set it to workbench.view.extension.prettyTsErrors maybe a mistake after renaming the panel from markdownPreview to sidePanel?

Copy link
Owner

@yoavbls yoavbls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's probably my mistake after renaming the panel.
Thank you 😊

@yoavbls yoavbls merged commit 0d5ed96 into yoavbls:main Mar 9, 2026
1 check passed
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.

Clicking "Pin Error" in tooltip switches active view container from "Pretty Typescript Errors" view to Explorer view.

3 participants