Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor.wordSeparators no longer allows double click to capture variable with "$" #129852

Closed
Ben-Conrad opened this issue Jul 30, 2021 · 6 comments
Assignees

Comments

@Ben-Conrad
Copy link

Ben-Conrad commented Jul 30, 2021

VSCode 1.58.2 on Windows.

We've been using this setting for many years to allow a double click (in PowerShell) to capture variable names (like $MyVariable). This is used extensively to copy/paste the variables inside VSCode.

By default VSCode only selects MyVariable when double click, so we use this editor.wordSeparators setting to remove '$'

"editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",

There has been a recent change in VSCode that prevents this from working. Double clicking on $MyVariable and ctrl-c only selects MyVariable.

I also notice that the "$" is highlighted with a different color than the rest of the variable name. See screenshots.

Ben

@Ben-Conrad
Copy link
Author

WordSeparator not working:
wordseparator-not-working

PowerShell
configured-language-powershell

Settings.json
settings-json

@Ben-Conrad
Copy link
Author

Ben-Conrad commented Jul 30, 2021

This guy's got the answer, it seems the behavior got toggled inside vscode recently- https://stackoverflow.com/questions/68128258/vscode-does-not-honor-editor-wordseparators-when-writing-powershell-code

{
"[powershell]" : {
"editor.wordSeparators": "`~!@#%^&*()=+[{]}\|;:'",.<>/?"
},
"files.defaultLanguage": "powershell",
"editor.showFoldingControls": "always",
"editor.acceptSuggestionOnEnter": "off",
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"editor.codeLens": false,
"files.hotExit": "onExitAndWindowClose",
"git.autofetch": true,
"git.confirmSync": false,
"git.suggestSmartCommit": false,
"git.alwaysShowStagedChangesResourceGroup": true,
"git.openDiffOnClick": true,
"git.postCommitCommand": "sync",
"git.promptToSaveFilesBeforeCommit": "always",
"git.confirmEmptyCommits": true,
"git.autoStash": true,
}

@Ben-Conrad
Copy link
Author

I consider this a workaround but the maintainers may consider a bug so I'll leave open for a bit to see what you think.

@alexdima
Copy link
Member

VS Code core does not ship a language-specific setting for editor.wordSeparators for PowerShell. This can be verified by using F1 > Preferences: Open Settings (JSON) in a vanilla VS Code installation and searching for editor.wordSeparators.

I think you are running into two problems:

  1. You are using an extension which defines a language specific setting for PowerShell. Please reach out to the extension that is responsible. You can identify it using Extension Bisect (F1 > Help: Start Extension Bisect).
  2. It is not made clear to you that the non-language-specific user setting you define for editor.wordSeparators is overwritten for PowerShell by the default language-specific setting the extension defines. I agree with this feedback cc @sandy081

@alexdima alexdima assigned sandy081 and unassigned alexdima Aug 25, 2021
@Ben-Conrad
Copy link
Author

Thanks everyone, this appears to be an intended change in vscode-powershell, noted here: https://github.com/PowerShell/vscode-powershell/blob/c983f75be23b78daeb69e31a0987a655a14207b9/CHANGELOG.md#v202151

Closing issue.

@sandy081
Copy link
Member

Filed #131707 to improve the user affordance

@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants