|
1 | 1 | using System; |
| 2 | +using System.Linq; |
2 | 3 | using System.Text.RegularExpressions; |
3 | 4 | using System.Windows; |
4 | 5 | using System.Windows.Input; |
@@ -182,72 +183,61 @@ private void EvaluateIntelliSense() |
182 | 183 | { |
183 | 184 | var methodString = ISMatches[j].Groups["method"].Value; |
184 | 185 | var found = false; |
| 186 | + |
185 | 187 | // Match for static methods. |
186 | | - foreach (var methodMap in methodMaps) |
| 188 | + var staticMethodMap = methodMaps.FirstOrDefault(e => e.Name == classString); |
| 189 | + var staticMethod = |
| 190 | + staticMethodMap?.Methods.FirstOrDefault(e => e.Name == methodString); |
| 191 | + if (staticMethod != null) |
187 | 192 | { |
188 | | - if (classString == methodMap.Name) |
189 | | - { |
190 | | - foreach (var method in methodMap.Methods) |
191 | | - { |
192 | | - if (method.Name == methodString) |
193 | | - { |
194 | | - xPos = ISMatches[j].Groups["method"].Index + |
195 | | - ISMatches[j].Groups["method"].Length; |
196 | | - ForwardShowIS = true; |
197 | | - ISFuncNameStr = method.FullName; |
198 | | - ISFuncDescriptionStr = method.CommentString; |
199 | | - ForceReSet = true; |
200 | | - found = true; |
201 | | - break; |
202 | | - } |
203 | | - } |
204 | | - |
205 | | - break; |
206 | | - } |
| 193 | + xPos = ISMatches[j].Groups["method"].Index + |
| 194 | + ISMatches[j].Groups["method"].Length; |
| 195 | + ForwardShowIS = true; |
| 196 | + ISFuncNameStr = staticMethod.FullName; |
| 197 | + ISFuncDescriptionStr = staticMethod.CommentString; |
| 198 | + ForceReSet = true; |
| 199 | + found = true; |
207 | 200 | } |
| 201 | + |
208 | 202 | if (!found) |
209 | 203 | { |
210 | 204 | // Many any methodmap, since the ide is not aware of the types |
211 | 205 | foreach (var methodMap in methodMaps) |
212 | 206 | { |
213 | | - Console.WriteLine(methodMap.Name); |
214 | | - foreach (var method in methodMap.Methods) |
| 207 | + var method = |
| 208 | + methodMap.Methods.FirstOrDefault(e => e.Name == methodString); |
| 209 | + if (method != null) |
215 | 210 | { |
216 | | - if (method.Name == methodString) |
217 | | - { |
218 | | - xPos = ISMatches[j].Groups["method"].Index + |
219 | | - ISMatches[j].Groups["method"].Length; |
220 | | - ForwardShowIS = true; |
221 | | - ISFuncNameStr = method.FullName; |
222 | | - ISFuncDescriptionStr = method.CommentString; |
223 | | - ForceReSet = true; |
224 | | - found = true; |
225 | | - break; |
226 | | - } |
| 211 | + xPos = ISMatches[j].Groups["method"].Index + |
| 212 | + ISMatches[j].Groups["method"].Length; |
| 213 | + ForwardShowIS = true; |
| 214 | + ISFuncNameStr = method.FullName; |
| 215 | + ISFuncDescriptionStr = method.CommentString; |
| 216 | + ForceReSet = true; |
227 | 217 | } |
228 | 218 | } |
229 | 219 | } |
230 | 220 | } |
231 | 221 | else |
232 | 222 | { |
233 | | - foreach (var func in funcs) |
234 | | - if (testString == func.Name) |
235 | | - { |
236 | | - xPos = ISMatches[j].Groups["name"].Index + |
237 | | - ISMatches[j].Groups["name"].Length; |
238 | | - ForwardShowIS = true; |
239 | | - ISFuncNameStr = func.FullName; |
240 | | - ISFuncDescriptionStr = func.CommentString; |
241 | | - ForceReSet = true; |
242 | | - break; |
243 | | - } |
| 223 | + var func = funcs.FirstOrDefault(e => e.Name == testString); |
| 224 | + if (func != null) |
| 225 | + { |
| 226 | + xPos = ISMatches[j].Groups["name"].Index + |
| 227 | + ISMatches[j].Groups["name"].Length; |
| 228 | + ForwardShowIS = true; |
| 229 | + ISFuncNameStr = func.FullName; |
| 230 | + ISFuncDescriptionStr = func.CommentString; |
| 231 | + ForceReSet = true; |
| 232 | + } |
244 | 233 | } |
245 | 234 |
|
246 | 235 | break; |
247 | 236 | } |
248 | 237 |
|
249 | 238 | if (FoundMatch) |
250 | 239 | { |
| 240 | + // ReSharper disable once RedundantAssignment |
251 | 241 | scopeLevel--; //i have no idea why this works... |
252 | 242 | break; |
253 | 243 | } |
|
0 commit comments