Skip to content

PowerShell splatting (@params hashtable) breaks parameter-binding extraction #1666

Description

@Widthdom

Summary

PowerShell's splatting feature lets callers pass parameters via a hashtable expanded with the @ sigil: $params = @{Path="."; Recurse=$true}; Get-ChildItem @params. The PowerShell reference extractor's call regex only sees Get-ChildItem, but does not recognize @params as a parameter source — so the references from the splatted call to the named parameters (Path, Recurse) are absent. Common in production scripts that build parameter sets dynamically.

Distinct from #1482 (call regex requires hyphenation; misses user-defined functions), #281 (every cmdlet call is invisible — covers basic call detection), #308 (scope prefixes), #216 (class members), #254 (DSC/workflow keywords). None address splatting parameter binding.

Where

  • src/CodeIndex/Indexer/References/Languages/PowerShellReferenceExtractor.cs:10-12

Suggested approach

(1) Detect @<identifier> token in argument position after a cmdlet/function call. (2) Walk backward (within the same script scope) to find the most-recent $<identifier> = @{...} assignment and extract the keys. (3) Emit reference rows from each key to the cmdlet's named-parameter set. (4) For dynamic / cross-file splat sources, fall back to flagging the call as "splat-bound" so consumers know parameter resolution is opaque.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions