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
I have observed that the reference counter does not count when the function is being used as a scriptblock or as parameter in Get-Command, see example1.
Also if you reimpliment the function, the counter will be 1 for both, see example2.
Yes, ideally we can improve the situation here. Since PowerShell has all the caveats of dynamic scope, the function provider, Set-Variable/Get-Variable, etc. things like the reference CodeLens are very much "best effort" features.
In terms of solvability (and bang for buck), I imagine the work priority would be:
Fix function redefinition reference count
Implement function variable and function provider references
The Get-Command scenario
That last scenario is one that would require more complex logic (since the foo there is just a bare word, the Get-Command is the only thing that means it's a function).
Or really any use of $Function:<some function name>. Great idea, totally doable.
However, it's not really feasible to support:
Get-Command foo
For reasons previously notated. There's a whole lot of edge cases to process around that, none of which we have any logic to process already. Sorry about that!
Issue Description
I have observed that the reference counter does not count when the function is being used as a scriptblock or as parameter in Get-Command, see example1.
Also if you reimpliment the function, the counter will be 1 for both, see example2.
Attached Example
1
2
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: