question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Double clicking variable selects variable AND $ prefix - this is not desirable

See original GitHub issue

System Details

System Details Output

### VSCode version: 1.56.2 054a9295330880ed74ceaedda236253b4f39a335 x64

### VSCode extensions:
abusaidm.html-snippets@0.2.1
atlassian.atlascode@2.8.6
DavidAnson.vscode-markdownlint@0.41.0
donjayamanne.githistory@0.6.16
DotJoshJohnson.xml@2.5.1
eamodio.gitlens@11.4.1
EditorConfig.EditorConfig@0.16.4
eg2.tslint@1.0.47
everettjf.filter-line@2.0.1
formulahendry.dotnet-test-explorer@0.7.5
gep13.chocolatey-vscode@0.7.2
Mikael.Angular-BeastCode@10.0.3
ms-azuretools.vscode-docker@1.13.0
ms-dotnettools.csharp@1.23.12
ms-edgedevtools.vscode-edge-devtools@1.1.9
ms-python.python@2021.5.842923320
ms-python.vscode-pylance@2021.5.4
ms-toolsai.jupyter@2021.6.832593372
ms-vscode-remote.remote-containers@0.177.2
ms-vscode-remote.remote-ssh@0.65.4
ms-vscode-remote.remote-ssh-edit@0.65.6
ms-vscode-remote.remote-ssh-explorer@0.56.0
ms-vscode-remote.remote-wsl@0.56.3
ms-vscode-remote.vscode-remote-extensionpack@0.21.0
ms-vscode.cpptools@1.4.0
ms-vscode.powershell-preview@2021.5.0
ms-vscode.vscode-typescript-tslint-plugin@1.3.3
msjsdiag.debugger-for-chrome@4.12.12
msjsdiag.debugger-for-edge@1.0.15
NicolasVuillamy.vscode-groovy-lint@1.4.0
redhat.vscode-commons@0.0.6
redhat.vscode-yaml@0.19.2
robinbentley.sass-indented@1.5.1
sibiraj-s.vscode-scss-formatter@2.2.0
SimonSiefke.svg-preview@2.8.3
slevesque.vscode-zipexplorer@0.3.1
spmeesseman.vscode-taskexplorer@2.0.7
streetsidesoftware.code-spell-checker@1.10.2
twxs.cmake@0.0.17
wayou.vscode-todo-highlight@1.0.4
yzhang.markdown-all-in-one@3.4.0


### PSES version:

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

I had to run this from pwsh. PSIC just hangs when I try to run this command. But PSES is:

=====> PowerShell Preview Integrated Console v2021.5.0 <=====

Issue Description

Double-clicking a variable has changed to now selecting the $ prefix. This is a problem when pasting over the variable when used in splatting e.g. @iwrArgs becomes @$iwrArgs. Ditto with string interpolation "${smtpServer}" becomes "${$smtpServer}" after pasting. This is highly undesirable IMO.

Expected Behaviour

Double-click select of a variable should not include the $ in the selection.

Actual Behaviour

Double-click select of a variable does include the $ in the selection.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
poshcodebearcommented, Jun 2, 2021

I’m definitely not one of those happy with this change.

It messes with Ctrl+Backspace, so erasing and retyping a variable name means also having to retype the $, and erasing a parameter also erases the trailing -.

It messes with quick refactoring, so Ctrl+F2 to change the name of a variable means, again, retyping the $, even though it makes no sense that I’d want to change that part since all variables must be decorated with a $ (not to mention, it means splats won’t be updated in a quick Ctrl+F2 refactor, which can actually introduce bugs/break scripts)

Not to mention, it makes refactoring multiple functions in the same module to change the noun or prefix a bigger pain, because now I either have to do it for every verb variant or write a regex find/replace for it.

In any event, these are behaviors that I’ve come to expect from the editor in the several years I’ve been using Code to write my PowerShell, and this change has already caused a significant amount of aggravation in just the very short time since it’s been implemented, to the point I had to dig in to the settings to figure out why it wasn’t working as expected, and even went to the hassle of searching the commit history for this repo just to verify I wasn’t going mad and this had actually changed.

This is a breaking change to existing user workflows. I don’t see the old behavior as confusing in the slightest, and personally feel that existing users who have already come to expect certain behavior should take precedence over new users who can learn the existing behavior more easily than we can re-learn it. Four plus years of muscle memory don’t fade overnight.

Anyway, I know there’s a workaround and will be using it, but I really think this was a poorly thought out decision.

3reactions
rkeithhillcommented, Jun 8, 2021

@dragonwolf83 Changing three years of EXISTING behavior was probably not a good idea IMO. That is one issue I have with certain OSS projects. Folks seem a little cavalier with making changes to well established behavior. At the very least, the change in behavior should have been made “opt-in”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Catching a PHP variable using double click in Notepad ++
What you can do is click between the dollar sign and the variable name. Then you will grab the whole variable as long...
Read more >
How to change the scope of double-click text selection
Hi, I'm a Perl programmer and I'm trying to figure out how to change the double-click selection behavior so that it will automatically...
Read more >
Global Variable Source - Jitterbit Community
A global variable can be configured as an in-memory source in Jitterbit. ... Double-clicking on the source icon; in the popup, select Create...
Read more >
Variable Prefixes | CpExtra Help - Infosemantics
Variable Prefixes. CpExtra allows you to create variables with special behaviour. What kind of behaviour they will have is dependant on their prefix....
Read more >
Double clicking code sometimes select the whole line (2021b?)
Typically in text editors, double-clicking some word will select the ... And no, I don't want automatic replacing of variable names in my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found