@@ -55,14 +55,18 @@ public async Task<PrepareRenameSymbolResult> Handle(PrepareRenameSymbolParams re
55
55
} ;
56
56
// ast is FunctionDefinitionAst or CommandAst or VariableExpressionAst or StringConstantExpressionAst &&
57
57
SymbolReference symbol = scriptFile . References . TryGetSymbolAtPosition ( request . Line + 1 , request . Column + 1 ) ;
58
- Ast token = Utilities . GetAst ( request . Line + 1 , request . Column + 1 , scriptFile . ScriptAst ) ;
58
+ Ast token = Utilities . GetAst ( request . Line + 1 , request . Column + 1 , scriptFile . ScriptAst ) ;
59
59
60
60
if ( token == null )
61
61
{
62
62
result . message = "Unable to find symbol" ;
63
63
return result ;
64
64
}
65
-
65
+ if ( Utilities . AssertContainsDotSourced ( scriptFile . ScriptAst ) )
66
+ {
67
+ result . message = "Dot Source detected, this is currently not supported operation aborted" ;
68
+ return result ;
69
+ }
66
70
switch ( token )
67
71
{
68
72
case FunctionDefinitionAst funcDef :
@@ -87,28 +91,17 @@ public async Task<PrepareRenameSymbolResult> Handle(PrepareRenameSymbolParams re
87
91
88
92
case VariableExpressionAst or CommandAst or CommandParameterAst or ParameterAst or StringConstantExpressionAst :
89
93
{
90
-
91
- try
94
+ IterativeVariableRename visitor = new ( request . RenameTo ,
95
+ token . Extent . StartLineNumber ,
96
+ token . Extent . StartColumnNumber ,
97
+ scriptFile . ScriptAst ) ;
98
+ if ( visitor . TargetVariableAst == null )
92
99
{
93
- IterativeVariableRename visitor = new ( request . RenameTo ,
94
- token . Extent . StartLineNumber ,
95
- token . Extent . StartColumnNumber ,
96
- scriptFile . ScriptAst ) ;
97
- if ( visitor . TargetVariableAst == null )
98
- {
99
- result . message = "Failed to find variable definition within the current file" ;
100
- }
100
+ result . message = "Failed to find variable definition within the current file" ;
101
101
}
102
- catch ( TargetVariableIsDotSourcedException )
103
- {
104
-
105
- result . message = "Variable is dot sourced which is currently not supported unable to perform a rename" ;
106
- }
107
-
108
102
break ;
109
103
}
110
104
}
111
-
112
105
return result ;
113
106
} ) . ConfigureAwait ( false ) ;
114
107
}
0 commit comments