Treat filter the same as function in LSP outline hierarchy#2283
Draft
Treat filter the same as function in LSP outline hierarchy#2283
filter the same as function in LSP outline hierarchy#2283Conversation
- Add explicit comment in VisitFunctionDefinition clarifying filter gets SymbolType.Function so it participates in the outline hierarchy the same way regular functions do (children expand correctly) - Update MultipleSymbols.ps1 test data so AFilter has a local variable declaration ($FilterVar = $_), exercising filter-with-children path - Update FindsSymbolsInFile test counts and add assertion verifying $FilterVar inside a filter is tracked as a declaration (prerequisite for it appearing as a child of the filter in the outline) Agent-Logs-Url: https://github.com/PowerShell/PowerShellEditorServices/sessions/89bcabc2-3cb5-470a-8d43-bcc6adaf0c30 Co-authored-by: JustinGrote <15258962+JustinGrote@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix filter keyword treatment in outline view
Treat May 6, 2026
filter the same as function in LSP outline hierarchy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
filterfunctions appeared as non-expandable leaf nodes in the outline even when they contained declarations — unlikefunction, which correctly shows child symbols (variables, nested functions) when present.The outline's hierarchy algorithm already works correctly for both: a filter's child declarations appear nested under it when its
ScriptRegioncontains them. The missing piece was thatVisitFunctionDefinitionimplicitly fell through toSymbolType.Functionfor filters without documenting the intent, and the test fixture hadfilter AFilter {$_}with no declarations inside — so no expand arrow ever appeared.Changes
SymbolVisitor.cs— Added comment toVisitFunctionDefinitionmaking explicit thatfilteris intentionally assignedSymbolType.Function, identical to regular functions, so filter bodies participate fully in the outline child-symbol hierarchy.MultipleSymbols.ps1— Changedfilter AFilter {$_}→filter AFilter { $FilterVar = $_ }to include a local variable declaration, covering the filter-with-children path.SymbolsServiceTests.cs— Updated symbol counts and added an assertion that$FilterVardeclared inside a filter is tracked asIsDeclaration = true— the prerequisite for it appearing as a child of the filter in thetextDocument/documentSymbolresponse.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
0t3vsblobprodcus362.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)4myvsblobprodcus32.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)4zjvsblobprodcus390.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)8xbvsblobprodcus382.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)dlbvsblobprodcus316.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)e7bvsblobprodcus348.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)jd4vsblobprodcus366.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)jrqvsblobprodcus343.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)ofvvsblobprodcus315.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)sqdvsblobprodcus333.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)tphvsblobprodcus375.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)ukkvsblobprodcus352.vsblob.vsassets.io/usr/bin/dotnet dotnet restore /home/REDACTED/work/PowerShellEditorServices/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj --verbosity quiet(dns block)If you need me to access, download, or install something from one of these locations, you can either: