PowerShell / PowerShell/vscode-powershell

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

Open
#348 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Symbols & References Issue-Bug
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

System Details
  • Operating system name and version: Win10 Anniversary Update
  • VS Code version: 1.7.2
  • PowerShell extension version: 0.7.2
  • Output from $PSVersionTable:
    Name Value

PSVersion 5.1.14393.206
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.206
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Evaluate $PSVersionTable in PowerShell and paste the output here
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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report in the supplied PowerShell test file by invoking Go to Definition on $a inside f3, then trace the PowerShell extension's definition-provider entry point. Done means the command selects f3's parameter rather than the first matching declaration, for both inline and param-block forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.