Visitar URL original
Document outline drops child variables when a function/filter reuses a variable name declared earlier (scope-blind declaration dedup) · Issue #2282 · PowerShell/PowerShellEditorServices · GitHub
Skip to content

Document outline drops child variables when a function/filter reuses a variable name declared earlier (scope-blind declaration dedup) #2282

Description

Image

Copilot Instructions: Treat filter keyword the same as function in the LSP when an outline for symbols is requested

Activity

  1. changed the title [-]Filter is not treated the same as function in the outline view, child items do not expand[/-] [+]Document outline drops child variables when a function/filter reuses a variable name declared earlier (scope-blind declaration dedup)[/+] on Jun 16, 2026
  2. andyleejordan commented on Jun 16, 2026

    @andyleejordan
    Member

    Investigated: this isn't specific to filter. The document-outline pipeline already treats filters like functions (SymbolVisitor → SymbolType.Function/SymbolKind.Function; VisitorUtils already special-cases IsFilter for the display name). The real cause is that ReferenceTable.AddReference dedupes variable declarations by name across the whole file, scope-blind (intentional per the inline comment, to clean up the outline). So the second function/filter to declare an already-seen variable name (e.g. $response) loses its declaration and therefore its outline chevron — reproducible with two plain functions, no filter required. A proper fix would scope the declaration-dedup to the containing function/filter, which changes deliberate behavior and warrants its own design + tests.


    Drafted by GitHub Copilot (Claude Opus 4.8) at Andy Jordan (@andyleejordan)'s request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions