@@ -39,6 +39,7 @@ public string[]
3939 public List < SMTypedef > Typedefs = new List < SMTypedef > ( ) ;
4040 public string [ ] TypeStrings = new string [ 0 ] ;
4141 public List < SMVariable > Variables = new List < SMVariable > ( ) ;
42+ public List < string > currentVariables = new List < string > ( ) ;
4243
4344 public void Sort ( )
4445 {
@@ -131,11 +132,19 @@ private void ProduceStringArrays(int caret = -1, List<SMFunction> currentFunctio
131132 {
132133 // TODO: This somewhat works, but somethings when in the end of a function it's buggy and doesnt find
133134 // the correct function or it finds nothing at all. The addition is a small hack that sometimes works
134- var currentFunc = currentFunctions . FirstOrDefault ( e => e . Index < caret && caret <= e . EndPos + 5 && e . File . EndsWith ( ".sp" ) ) ;
135+ var currentFunc = currentFunctions . FirstOrDefault ( e =>
136+ e . Index < caret && caret <= e . EndPos + 5 && e . File . EndsWith ( ".sp" ) ) ;
135137 if ( currentFunc != null )
136138 {
137-
138139 constantNames . AddRange ( currentFunc . FuncVariables . Select ( v => v . Name ) ) ;
140+ var stringParams = currentFunc . Parameters . Select ( e => e . Split ( '=' ) . First ( ) . Trim ( ) )
141+ . Select ( e => e . Split ( ' ' ) . Last ( ) ) . Where ( e => ! string . IsNullOrWhiteSpace ( e ) ) . ToList ( ) ;
142+ constantNames . AddRange ( stringParams ) ;
143+ currentVariables . AddRange ( stringParams ) ;
144+ }
145+ else
146+ {
147+ currentVariables . Clear ( ) ;
139148 }
140149 }
141150
@@ -205,16 +214,17 @@ public void MergeDefinitions(SMDefinition def)
205214 }
206215 }
207216
208- public SMDefinition ProduceTemporaryExpandedDefinition ( SMDefinition [ ] definitions , int caret , List < SMFunction > currentFunctions )
217+ public SMDefinition ProduceTemporaryExpandedDefinition ( SMDefinition [ ] definitions , int caret ,
218+ List < SMFunction > currentFunctions )
209219 {
210220 var def = new SMDefinition ( ) ;
211- def . MergeDefinitions ( this ) ;
212- foreach ( var definition in definitions )
213- if ( definition != null )
214- def . MergeDefinitions ( definition ) ;
221+ def . MergeDefinitions ( this ) ;
222+ foreach ( var definition in definitions )
223+ if ( definition != null )
224+ def . MergeDefinitions ( definition ) ;
215225
216- def . Sort ( ) ;
217- def . ProduceStringArrays ( caret , currentFunctions ) ;
226+ def . Sort ( ) ;
227+ def . ProduceStringArrays ( caret , currentFunctions ) ;
218228 return def ;
219229 }
220230
0 commit comments