fix(vscode): pre-select current dialect in the dialect picker#3181
fix(vscode): pre-select current dialect in the dialect picker#3181Ai-chan-0411 wants to merge 1 commit intoAutomattic:masterfrom
Conversation
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
|
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. |
|
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. |
|
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! |
|
See also #3198 |
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.showQuickPickwas called without anactiveItemsoption, so VS Code defaults to highlighting the first item. The fix reads the currentharper.dialectsetting before opening the picker, finds the matchingQuickPickItem, and passes it asactiveItemsso the picker scrolls to and highlights the active dialect right away.Changes:
packages/vscode-plugin/src/extension.ts— 4 lines added tochangeDialect().Fixes #2667