You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Peek/Go to Definition not working on script scoped function #362
Later in the same script it is called but where it is called, if I try to peek or go to definition, PSES does not take me to the above definition. It does nothing.
I see these relevant messages in the log:
READ MESSAGE:
{
"jsonrpc": "2.0",
"id": 5,
"method": "textDocument/definition",
"params": {
"uri": "file:///c%3A/Users/Keith/GitHub/dahlbyk/posh-git/src/GitTabExpansion.ps1",
"position": {
"line": 261,
"character": 29
}
}
}
...
1/31/2017 8:32:47 PM [ERROR] - Method "ExecuteCommand" at line 454 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs
Execution completed with errors:
The term 'gitRemoteBranches' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
The term 'gitRemoteBranches' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
The term 'gitRemoteBranches' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
BTW if I change the callsite to script:gitRemoteBranches then PSES can find the function. It doesn't seem like that should be necessary.
Scoped variables never really worked before, that's an area we need to improve upon pretty soon. Planning to do that as part of the module-wide analysis effort. I'll mark it for 0.10.0 in case we get a chance to do it then, otherwise it'll probably come with 0.11.0.
Should this be kept open until proper scoping support is possible? Or would it be an option to trim scope from definition and/or call to match them? Would show multiple definitions and count references wrong if name is reused though.
Resolved by #1990 (v3.8.1) — script:-scoped function definitions/references now match correctly (same scope-qualifier root cause as #16). Closing as completed.
Activity
daviwil commentedon Feb 1, 2017
Scoped variables never really worked before, that's an area we need to improve upon pretty soon. Planning to do that as part of the module-wide analysis effort. I'll mark it for 0.10.0 in case we get a chance to do it then, otherwise it'll probably come with 0.11.0.
rkeithhill commentedon Feb 1, 2017
Sounds good.
TylerLeonhardt commentedon Jan 12, 2018
Looks like this is no longer reproing 😄 I'm closing it - you know what to do.
rkeithhill commentedon Jan 12, 2018
Yes, it still repros. You have to a location modifier on the variable e.g.:
TylerLeonhardt commentedon Jan 12, 2018
Ah. I did this and that worked:
Cool - we'll keep it open
fflaten commentedon Feb 7, 2023
Should this be kept open until proper scoping support is possible? Or would it be an option to trim scope from definition and/or call to match them? Would show multiple definitions and count references wrong if name is reused though.
andyleejordan commentedon Jun 15, 2026
Resolved by #1990 (v3.8.1) —
script:-scoped function definitions/references now match correctly (same scope-qualifier root cause as #16). Closing as completed.Drafted by GitHub Copilot (Claude Opus 4.8) at Andy Jordan (@andyleejordan)'s request.