@@ -39,6 +39,7 @@ public string[]
39
39
public List < SMTypedef > Typedefs = new List < SMTypedef > ( ) ;
40
40
public string [ ] TypeStrings = new string [ 0 ] ;
41
41
public List < SMVariable > Variables = new List < SMVariable > ( ) ;
42
+ public List < string > currentVariables = new List < string > ( ) ;
42
43
43
44
public void Sort ( )
44
45
{
@@ -131,11 +132,19 @@ private void ProduceStringArrays(int caret = -1, List<SMFunction> currentFunctio
131
132
{
132
133
// TODO: This somewhat works, but somethings when in the end of a function it's buggy and doesnt find
133
134
// 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" ) ) ;
135
137
if ( currentFunc != null )
136
138
{
137
-
138
139
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 ( ) ;
139
148
}
140
149
}
141
150
@@ -205,16 +214,17 @@ public void MergeDefinitions(SMDefinition def)
205
214
}
206
215
}
207
216
208
- public SMDefinition ProduceTemporaryExpandedDefinition ( SMDefinition [ ] definitions , int caret , List < SMFunction > currentFunctions )
217
+ public SMDefinition ProduceTemporaryExpandedDefinition ( SMDefinition [ ] definitions , int caret ,
218
+ List < SMFunction > currentFunctions )
209
219
{
210
220
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 ) ;
215
225
216
- def . Sort ( ) ;
217
- def . ProduceStringArrays ( caret , currentFunctions ) ;
226
+ def . Sort ( ) ;
227
+ def . ProduceStringArrays ( caret , currentFunctions ) ;
218
228
return def ;
219
229
}
220
230
0 commit comments