File tree 4 files changed +23
-1
lines changed
src/PowerShellEditorServices/Services/Symbols/Vistors
4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ public FindDeclarationVisitor(SymbolReference symbolRef)
36
36
/// or a decision to continue if it wasn't found</returns>
37
37
public override AstVisitAction VisitFunctionDefinition ( FunctionDefinitionAst functionDefinitionAst )
38
38
{
39
+ // Extent for constructors and method trigger both this and VisitFunctionMember(). Covered in the latter.
40
+ // This will not exclude nested functions as they have ScriptBlockAst as parent
41
+ if ( functionDefinitionAst . Parent is FunctionMemberAst )
42
+ {
43
+ return AstVisitAction . Continue ;
44
+ }
45
+
39
46
// Get the start column number of the function name,
40
47
// instead of the the start column of 'function' and create new extent for the functionName
41
48
int startColumnNumber =
Original file line number Diff line number Diff line change @@ -117,6 +117,13 @@ public override AstVisitAction VisitCommand(CommandAst commandAst)
117
117
/// <returns>A visit action that continues the search for references</returns>
118
118
public override AstVisitAction VisitFunctionDefinition ( FunctionDefinitionAst functionDefinitionAst )
119
119
{
120
+ // Extent for constructors and method trigger both this and VisitFunctionMember(). Covered in the latter.
121
+ // This will not exclude nested functions as they have ScriptBlockAst as parent
122
+ if ( functionDefinitionAst . Parent is FunctionMemberAst )
123
+ {
124
+ return AstVisitAction . Continue ;
125
+ }
126
+
120
127
( int startColumnNumber , int startLineNumber ) = VisitorUtils . GetNameStartColumnAndLineNumbersFromAst ( functionDefinitionAst ) ;
121
128
122
129
IScriptExtent nameExtent = new ScriptExtent ( )
Original file line number Diff line number Diff line change @@ -58,6 +58,13 @@ public override AstVisitAction VisitCommand(CommandAst commandAst)
58
58
/// or a decision to continue if it wasn't found</returns>
59
59
public override AstVisitAction VisitFunctionDefinition ( FunctionDefinitionAst functionDefinitionAst )
60
60
{
61
+ // Extent for constructors and method trigger both this and VisitFunctionMember(). Covered in the latter.
62
+ // This will not exclude nested functions as they have ScriptBlockAst as parent
63
+ if ( functionDefinitionAst . Parent is FunctionMemberAst )
64
+ {
65
+ return AstVisitAction . Continue ;
66
+ }
67
+
61
68
int startLineNumber = functionDefinitionAst . Extent . StartLineNumber ;
62
69
int startColumnNumber = functionDefinitionAst . Extent . StartColumnNumber ;
63
70
int endLineNumber = functionDefinitionAst . Extent . EndLineNumber ;
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
25
25
{
26
26
// Extent for constructors and method trigger both this and VisitFunctionMember(). Covered in the latter.
27
27
// This will not exclude nested functions as they have ScriptBlockAst as parent
28
- if ( functionDefinitionAst . Parent is FunctionMemberAst ) {
28
+ if ( functionDefinitionAst . Parent is FunctionMemberAst )
29
+ {
29
30
return AstVisitAction . Continue ;
30
31
}
31
32
You can’t perform that action at this time.
0 commit comments