@@ -55,14 +55,18 @@ public async Task<PrepareRenameSymbolResult> Handle(PrepareRenameSymbolParams re
5555 } ;
5656 // ast is FunctionDefinitionAst or CommandAst or VariableExpressionAst or StringConstantExpressionAst &&
5757 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 ) ;
5959
6060 if ( token == null )
6161 {
6262 result . message = "Unable to find symbol" ;
6363 return result ;
6464 }
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+ }
6670 switch ( token )
6771 {
6872 case FunctionDefinitionAst funcDef :
@@ -87,28 +91,17 @@ public async Task<PrepareRenameSymbolResult> Handle(PrepareRenameSymbolParams re
8791
8892 case VariableExpressionAst or CommandAst or CommandParameterAst or ParameterAst or StringConstantExpressionAst :
8993 {
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 )
9299 {
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" ;
101101 }
102- catch ( TargetVariableIsDotSourcedException )
103- {
104-
105- result . message = "Variable is dot sourced which is currently not supported unable to perform a rename" ;
106- }
107-
108102 break ;
109103 }
110104 }
111-
112105 return result ;
113106 } ) . ConfigureAwait ( false ) ;
114107 }
0 commit comments