Skip to content

fix(vscode): pre-select current dialect in the dialect picker#3181

Open
Ai-chan-0411 wants to merge 1 commit intoAutomattic:masterfrom
Ai-chan-0411:fix/dialect-picker-preselect
Open

fix(vscode): pre-select current dialect in the dialect picker#3181
Ai-chan-0411 wants to merge 1 commit intoAutomattic:masterfrom
Ai-chan-0411:fix/dialect-picker-preselect

Conversation

@Ai-chan-0411
Copy link
Copy Markdown

I noticed issue #2667 while exploring the extension — when you click the dialect indicator in the status bar, the quick-pick list always had American highlighted at the top, even if the workspace was already set to, say, British or Australian. That makes it easy to accidentally revert your dialect if you just press Enter.

The root cause is simple: window.showQuickPick was called without an activeItems option, so VS Code defaults to highlighting the first item. The fix reads the current harper.dialect setting before opening the picker, finds the matching QuickPickItem, and passes it as activeItems so the picker scrolls to and highlights the active dialect right away.

Changes: packages/vscode-plugin/src/extension.ts — 4 lines added to changeDialect().

Fixes #2667

The quick-pick dialog for changing the dialect always highlighted
"American" first, regardless of which dialect the workspace was
actually using. This happened because showQuickPick was called
without an activeItems option.

Read the current 'harper.dialect' setting before opening the picker
and pass the matching item as activeItems so VS Code scrolls to and
highlights it immediately.

Fixes Automattic#2667
@hippietrail
Copy link
Copy Markdown
Collaborator

Thanks so much! I wish I didn't get frustrated so easily almost every time I work on the VS Code extension. It would be awesome if you could include a little screengrab video of your modded version working.

@Ai-chan-0411
Copy link
Copy Markdown
Author

Thanks for the feedback! I appreciate it. I'll work on creating a quick screengrab showing the dialect picker pre-selecting the current dialect in action. In the meantime, the fix ensures that when you open the dialect picker, it pre-selects your currently active dialect instead of always defaulting to American. This should make the VS Code extension workflow smoother for you.

@Ai-chan-0411
Copy link
Copy Markdown
Author

Thanks for the kind words! Unfortunately I can't easily record a screengrab since I'm running on a headless Raspberry Pi without a display. But the change is straightforward — it reads the current dialect from the configuration and passes it as the activeItems parameter to showQuickPick, so the picker opens with the current dialect already highlighted instead of always defaulting to American. Happy to add any other tests or adjustments if needed!

@hippietrail
Copy link
Copy Markdown
Collaborator

See also #3198

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.

The dialect picker that pops up in VS Code when clicking the indicator in the status bar always starts with "US" selected

2 participants