-
Notifications
You must be signed in to change notification settings - Fork 512
VSCode Peek / Go to Definition functions do not work when variable is cast as specific type #1439
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
VSCode Peek / Go to Definition functions do not work when variable is cast as specific type #1439
Comments
I have a fix for this - plus some bonus fixes :) |
@tylerl0706 Great news. Thanks Tyler. Any more info on the bonus fixes 👍 |
$var1 = "string"
$var1
[string] $var2 = "string"
$var2
[NotNull()] $var3 = "string"
$var3
$a, $var4 = "string", "sss"
$var4
$a, [string] $var5 = "string", "sss"
$var5 will all go to the correct spot. |
@stukey: Just to aid in discovery of this issue, can you please correct the typo in the title (and body)? |
Sure if you can tell me how to do that. I can’t see an option to edit the title, only the body of the original post. |
Ah looks like @tyler0706 already did it. |
@stukey: Great; in general, look for the button labeled |
Yup 🤯 I did edit the post but didn’t see any option to edit the title. Maybe it’s because Im getting the mobile view on my iPhone.
… On 24 Jul 2018, at 18:07, Michael Klement ***@***.***> wrote:
@stukey: Great; in general, look for the button labeled Edit to the right of the title:
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
👍 |
System Details
$PSVersionTable
: see belowIssue Description
I am not sure whether this is a VSCode issue or a PowerShell Extension issue so please forgive me if I have logged this in the wrong place.
In the latest version of VSCode (1.25.1) with the latest version of the PowerShell Extension (1.8.1) on Windows 10:
If you cast your variables by prefixing them with the type, e.g. [string], the “Go to Definition” and “Peak Definition” functions do not work.
Right-click on the second ‘$testVar’ and select either “Go to Definition” or “Peak definition” and you’ll get an error “No definition found for $testVar”. Screenshot:
Try it without casting it as a [string] and it works as expected.
The text was updated successfully, but these errors were encountered: