-
Notifications
You must be signed in to change notification settings - Fork 49
Dollar sign '$' should be included as part of the variable token #23
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
Comments
Originally reported by @deshiknaves with issue PowerShell/vscode-powershell#240. |
I would like this fixed as well. Curious if there is any progress/status on it. |
Would very much like this too by way of default. Eventually, ended up with editing the "editor.wordSeparators" setting for PHP only. |
Are we sure this is what we really want? Some of the guides I have seen regarding scope names suggests that the $ should be scoped as punctuation.definition.variable I tried a test where I renamed this scope to variable.punctuation as this would mean that both the $ and the variable name have the same root scope. Double-clicking in vscode still only highlighted the variable name. I then tried to apply a meta.variable scope to the whole token ($ as well as the variable name), with the same results. Checking in ISE this is the exact same behaviour I see there. The name of the variable is highlighted on double-click, not the $. |
Yep, you are correct that this is the same behavior as in PowerShell ISE (which is ALSO terrible behavior). I STILL default to using the very old PowerShell GUI Editor because it DOES have the correct behavior of including the $ when double clicking. It's a huge burden on speed to not be able to quickly copy and paste variables including the $ |
My only concern is that it won't work even if we scope the $ the same as the variable name. @daviwil do you know for certain that the editor is using the scope names for this? If not, is there any other way we can achieve this? Perhaps as a setting so that people can choose if they want this behavior or not? |
As mentioned above, adding the following to the settings works:
|
@gravejester hmmm... If this is driven by |
Filed an issue with the VS Code team to see if there's a way I can override that setting. Also just found this issue at the vscode-PowerShell repo where someone also asked for the dollar sign to be colored the same as the variable name. |
Yeah, I have mixed feelings about that. In the grammar I'm much more concerned with the tokens getting "proper" scope names, and leave it up the the different themes how these should be colored. I'd rather not cheat by using the wrong scope names just so that a token can get a particular color in the default theme. Thoughts? |
Sounds fine to me to have accurate tokens. The ISE theme can color the token consistently with the ISE :) |
Closing as the discussion appears to have reached a conclusions and an issue was opened for VS Code. @gravejester is also correct about We can add this as a line item when we review scopes in general if someone wants to make a case for breaking convention. |
@lzybkr made a case in SublimeText/PowerShell#147
|
Currently the sigil is scoped If we set it to punctuation.definition.variable.poweshell right now it would inherit from whatever it's inside when a theme doesn't cover it so I am personally not inclined to scope the sigil the same as the variable name because I when designing themes want the option to target it specifically; However, what we could do is make the whole variable
with overlap. |
How does the double-click select behave with overlap? I like the proposition so far, but it would be awesome to see it visually with 1 or more default themes. |
The proposal sounds reasonable. I'm not a fan of busy themes so it feels like it's complicating the syntax unnecessarily, but as long as it resolves the issue, then I won't complain. |
The dollar sign
$
should be included as part of the variable token because editors like VS Code use the syntax tokens to determine what text to select when the user double-clicks in the current file. Currently if the user double-clicks in a variable like$myVar
, only themyVar
portion will be selected since the$
is treated as a separate symbol.The text was updated successfully, but these errors were encountered: