PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.71k stars 491 forks source link

Go to Definition of function parameter jumps into first function having that parameter #348

Open kuulemart opened 7 years ago

kuulemart commented 7 years ago

System Details

Issue Description

I am experiencing a problem with "Go to Definition" feature. When file has multiple function having parameter with same name, "Go to Definition" jumps to first function declaration, regardless from which function parameter we examined. Testfile:

function f1($a) {
    $a + 1;
}

function f2 {
    param($a)
    $a + 2;
}

function f3 {
    param($a)
    $a + 3;
}

Action: Right click on $a inside f3 and select "Go to Definition" Expected result: editor caret is planced before param $a in function f3 declaration Actual result: editor caret is planced before param $a in function f1 declaration

The result does not depend on how params are defined (param keyword vs inline declaration)

daviwil commented 7 years ago

Thanks for the report! I'll take a look.

carlocardella commented 4 years ago

This is still happening on the latest build

Version: 1.41.1 (user setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18363

In this sample the $serviceid definition is in GetStatus but the cursor jumps to the same variable in GetService (the first variable in the list)

Z19QxD3bxh