File tree Expand file tree Collapse file tree
src/PowerShellEditorServices/Services/Symbols/Visitors
test/PowerShellEditorServices.Test/Language Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ public override AstVisitAction VisitCommand(CommandAst commandAst)
5050
5151 public override AstVisitAction VisitFunctionDefinition ( FunctionDefinitionAst functionDefinitionAst )
5252 {
53- // Treat filter the same as function: both get SymbolType.Function so they appear in the
54- // outline and support child symbols (variables, nested functions, etc.) in the hierarchy .
53+ // Treat filter the same as function: both get SymbolType.Function so they use the same
54+ // function-like symbol kind. Document-symbol inclusion and child hierarchy are determined elsewhere .
5555 SymbolType symbolType = functionDefinitionAst . IsWorkflow
5656 ? SymbolType . Workflow
5757 : SymbolType . Function ;
Original file line number Diff line number Diff line change @@ -789,11 +789,19 @@ public void FindsSymbolsInFile()
789789 Assert . True ( symbol . IsDeclaration ) ;
790790
791791 // Verify that a variable declared inside a filter is tracked as a declaration,
792- // allowing it to appear as a child of the filter in the LSP outline hierarchy.
792+ // and that it is returned as a child of the filter in the LSP outline hierarchy.
793793 symbol = Assert . Single ( symbols , i => i . Id == "var FilterVar" ) ;
794794 Assert . Equal ( "$FilterVar" , symbol . Name ) ;
795795 Assert . True ( symbol . IsDeclaration ) ;
796796
797+ DocumentSymbol filterDocumentSymbol = Assert . Single (
798+ GetDocumentSymbols ( FindSymbolsInMultiSymbolFile . SourceDetails ) ,
799+ i => i . Name == "AFilter" ) ;
800+ DocumentSymbol filterVariableDocumentSymbol = Assert . Single (
801+ filterDocumentSymbol . Children ,
802+ i => i . Name == "$FilterVar" ) ;
803+ Assert . Equal ( SymbolKind . Variable , filterVariableDocumentSymbol . Kind ) ;
804+
797805 symbol = symbols . Last ( i => i . Type == SymbolType . Variable ) ;
798806 Assert . Equal ( "var nestedVar" , symbol . Id ) ;
799807 Assert . Equal ( "$nestedVar" , symbol . Name ) ;
You can’t perform that action at this time.
0 commit comments