@@ -39,8 +39,6 @@ public partial class EditorElement
3939
4040 private int LastShowedLine = - 1 ;
4141
42- public ulong LastSMDefUpdateUID = 0 ;
43-
4442 // TODO Add EnumStructs
4543 private SMMethodmap [ ] methodMaps ;
4644
@@ -89,6 +87,7 @@ public void InterruptLoadAutoCompletes(string[] FunctionStrings, SMFunction[] Fu
8987 } ) ;
9088 }
9189
90+ private Regex methodExp = new Regex ( @"(?<=\.)[A-Za-z_]\w*" , RegexOptions . RightToLeft ) ;
9291 private void EvaluateIntelliSense ( )
9392 {
9493 if ( editor . SelectionLength > 0 )
@@ -172,107 +171,105 @@ private void EvaluateIntelliSense()
172171 else if ( text [ i ] == '(' )
173172 {
174173 scopeLevel -- ;
175- if ( scopeLevel < 0 )
176- {
177- var FoundMatch = false ;
178- var searchIndex = i ;
179- for ( var j = 0 ; j < ISMatches . Count ; ++ j )
180- if ( searchIndex >= ISMatches [ j ] . Index &&
181- searchIndex <= ISMatches [ j ] . Index + ISMatches [ j ] . Length )
174+ if ( scopeLevel >= 0 ) continue ;
175+ var FoundMatch = false ;
176+ var searchIndex = i ;
177+ for ( var j = 0 ; j < ISMatches . Count ; ++ j )
178+ if ( searchIndex >= ISMatches [ j ] . Index &&
179+ searchIndex <= ISMatches [ j ] . Index + ISMatches [ j ] . Length )
180+ {
181+ FoundMatch = true ;
182+ var testString = ISMatches [ j ] . Groups [ "name" ] . Value ;
183+ var classString = ISMatches [ j ] . Groups [ "class" ] . Value ;
184+ if ( classString . Length > 0 )
182185 {
183- FoundMatch = true ;
184- var testString = ISMatches [ j ] . Groups [ "name" ] . Value ;
185- var classString = ISMatches [ j ] . Groups [ "class" ] . Value ;
186- if ( classString . Length > 0 )
186+ var methodString = ISMatches [ j ] . Groups [ "method" ] . Value ;
187+ var found = false ;
188+
189+ // Match for static methods.
190+ var staticMethodMap = methodMaps . FirstOrDefault ( e => e . Name == classString ) ;
191+ var staticMethod =
192+ staticMethodMap ? . Methods . FirstOrDefault ( e => e . Name == methodString ) ;
193+ if ( staticMethod != null )
187194 {
188- var methodString = ISMatches [ j ] . Groups [ "method" ] . Value ;
189- var found = false ;
190-
191- // Match for static methods.
192- var staticMethodMap = methodMaps . FirstOrDefault ( e => e . Name == classString ) ;
193- var staticMethod =
194- staticMethodMap ? . Methods . FirstOrDefault ( e => e . Name == methodString ) ;
195- if ( staticMethod != null )
196- {
197- xPos = ISMatches [ j ] . Groups [ "method" ] . Index +
198- ISMatches [ j ] . Groups [ "method" ] . Length ;
199- ForwardShowIS = true ;
200- ISFuncNameStr = staticMethod . FullName ;
201- ISFuncDescriptionStr = staticMethod . CommentString ;
202- ForceReSet = true ;
203- found = true ;
204- }
205-
206- // Try to find declaration
207- if ( ! found )
208- {
209- var pattern =
210- $@ "\b((?<class>[a-zA-Z_]([a-zA-Z0-9_]?)+))\s+({ classString } )\s*(;|=)";
211- var findDecl = new Regex ( pattern , RegexOptions . Compiled ) ;
212- var match = findDecl . Match ( editor . Text ) ;
213- var classMatch = match . Groups [ "class" ] . Value ;
214- if ( classMatch . Length > 0 )
215- {
216- var methodMap = methodMaps . FirstOrDefault ( e => e . Name == classMatch ) ;
217- var method =
218- methodMap ? . Methods . FirstOrDefault ( e => e . Name == methodString ) ;
219- if ( method != null )
220- {
221- xPos = ISMatches [ j ] . Groups [ "method" ] . Index +
222- ISMatches [ j ] . Groups [ "method" ] . Length ;
223- ForwardShowIS = true ;
224- ISFuncNameStr = method . FullName ;
225- ISFuncDescriptionStr = method . CommentString ;
226- ForceReSet = true ;
227- found = true ;
228- }
229- }
230- }
195+ xPos = ISMatches [ j ] . Groups [ "method" ] . Index +
196+ ISMatches [ j ] . Groups [ "method" ] . Length ;
197+ ForwardShowIS = true ;
198+ ISFuncNameStr = staticMethod . FullName ;
199+ ISFuncDescriptionStr = staticMethod . CommentString ;
200+ ForceReSet = true ;
201+ found = true ;
202+ }
231203
232- // Match the first found
233- if ( ! found )
204+ // Try to find declaration
205+ if ( ! found )
206+ {
207+ var pattern =
208+ $@ "\b((?<class>[a-zA-Z_]([a-zA-Z0-9_]?)+))\s+({ classString } )\s*(;|=)";
209+ var findDecl = new Regex ( pattern , RegexOptions . Compiled ) ;
210+ var match = findDecl . Match ( editor . Text ) ;
211+ var classMatch = match . Groups [ "class" ] . Value ;
212+ if ( classMatch . Length > 0 )
234213 {
235- // Match any methodmap, since the ide is not aware of the types
236- foreach ( var methodMap in methodMaps )
214+ var methodMap = methodMaps . FirstOrDefault ( e => e . Name == classMatch ) ;
215+ var method =
216+ methodMap ? . Methods . FirstOrDefault ( e => e . Name == methodString ) ;
217+ if ( method != null )
237218 {
238- var method =
239- methodMap . Methods . FirstOrDefault ( e => e . Name == methodString ) ;
240-
241- if ( method == null )
242- continue ;
243-
244219 xPos = ISMatches [ j ] . Groups [ "method" ] . Index +
245220 ISMatches [ j ] . Groups [ "method" ] . Length ;
246221 ForwardShowIS = true ;
247222 ISFuncNameStr = method . FullName ;
248223 ISFuncDescriptionStr = method . CommentString ;
249224 ForceReSet = true ;
225+ found = true ;
250226 }
251227 }
252228 }
253- else
229+
230+ // Match the first found
231+ if ( ! found )
254232 {
255- var func = funcs . FirstOrDefault ( e => e . Name == testString ) ;
256- if ( func != null )
233+ // Match any methodmap, since the ide is not aware of the types
234+ foreach ( var methodMap in methodMaps )
257235 {
258- xPos = ISMatches [ j ] . Groups [ "name" ] . Index +
259- ISMatches [ j ] . Groups [ "name" ] . Length ;
236+ var method =
237+ methodMap . Methods . FirstOrDefault ( e => e . Name == methodString ) ;
238+
239+ if ( method == null )
240+ continue ;
241+
242+ xPos = ISMatches [ j ] . Groups [ "method" ] . Index +
243+ ISMatches [ j ] . Groups [ "method" ] . Length ;
260244 ForwardShowIS = true ;
261- ISFuncNameStr = func . FullName ;
262- ISFuncDescriptionStr = func . CommentString ;
245+ ISFuncNameStr = method . FullName ;
246+ ISFuncDescriptionStr = method . CommentString ;
263247 ForceReSet = true ;
264248 }
265249 }
266-
267- break ;
250+ }
251+ else
252+ {
253+ var func = funcs . FirstOrDefault ( e => e . Name == testString ) ;
254+ if ( func != null )
255+ {
256+ xPos = ISMatches [ j ] . Groups [ "name" ] . Index +
257+ ISMatches [ j ] . Groups [ "name" ] . Length ;
258+ ForwardShowIS = true ;
259+ ISFuncNameStr = func . FullName ;
260+ ISFuncDescriptionStr = func . CommentString ;
261+ ForceReSet = true ;
262+ }
268263 }
269264
270- if ( FoundMatch )
271- {
272- // ReSharper disable once RedundantAssignment
273- scopeLevel -- ; //i have no idea why this works...
274265 break ;
275266 }
267+
268+ if ( FoundMatch )
269+ {
270+ // ReSharper disable once RedundantAssignment
271+ scopeLevel -- ; //i have no idea why this works...
272+ break ;
276273 }
277274 }
278275
0 commit comments