Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
Use LINQ for IntelliSense
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexer10 committed Mar 26, 2020
1 parent 6c941a0 commit f549f2a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 45 deletions.
2 changes: 1 addition & 1 deletion App/AssemblyInfo1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
#if (DEBUG)
[assembly: AssemblyVersion("1.13.*")]
#else
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyVersion("1.3.0.1")]
#endif
78 changes: 34 additions & 44 deletions UI/Components/IntelliSenseController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Input;
Expand Down Expand Up @@ -182,72 +183,61 @@ private void EvaluateIntelliSense()
{
var methodString = ISMatches[j].Groups["method"].Value;
var found = false;

// Match for static methods.
foreach (var methodMap in methodMaps)
var staticMethodMap = methodMaps.FirstOrDefault(e => e.Name == classString);
var staticMethod =
staticMethodMap?.Methods.FirstOrDefault(e => e.Name == methodString);
if (staticMethod != null)
{
if (classString == methodMap.Name)
{
foreach (var method in methodMap.Methods)
{
if (method.Name == methodString)
{
xPos = ISMatches[j].Groups["method"].Index +
ISMatches[j].Groups["method"].Length;
ForwardShowIS = true;
ISFuncNameStr = method.FullName;
ISFuncDescriptionStr = method.CommentString;
ForceReSet = true;
found = true;
break;
}
}

break;
}
xPos = ISMatches[j].Groups["method"].Index +
ISMatches[j].Groups["method"].Length;
ForwardShowIS = true;
ISFuncNameStr = staticMethod.FullName;
ISFuncDescriptionStr = staticMethod.CommentString;
ForceReSet = true;
found = true;
}

if (!found)
{
// Many any methodmap, since the ide is not aware of the types
foreach (var methodMap in methodMaps)
{
Console.WriteLine(methodMap.Name);
foreach (var method in methodMap.Methods)
var method =
methodMap.Methods.FirstOrDefault(e => e.Name == methodString);
if (method != null)
{
if (method.Name == methodString)
{
xPos = ISMatches[j].Groups["method"].Index +
ISMatches[j].Groups["method"].Length;
ForwardShowIS = true;
ISFuncNameStr = method.FullName;
ISFuncDescriptionStr = method.CommentString;
ForceReSet = true;
found = true;
break;
}
xPos = ISMatches[j].Groups["method"].Index +
ISMatches[j].Groups["method"].Length;
ForwardShowIS = true;
ISFuncNameStr = method.FullName;
ISFuncDescriptionStr = method.CommentString;
ForceReSet = true;
}
}
}
}
else
{
foreach (var func in funcs)
if (testString == func.Name)
{
xPos = ISMatches[j].Groups["name"].Index +
ISMatches[j].Groups["name"].Length;
ForwardShowIS = true;
ISFuncNameStr = func.FullName;
ISFuncDescriptionStr = func.CommentString;
ForceReSet = true;
break;
}
var func = funcs.FirstOrDefault(e => e.Name == testString);
if (func != null)
{
xPos = ISMatches[j].Groups["name"].Index +
ISMatches[j].Groups["name"].Length;
ForwardShowIS = true;
ISFuncNameStr = func.FullName;
ISFuncDescriptionStr = func.CommentString;
ForceReSet = true;
}
}

break;
}

if (FoundMatch)
{
// ReSharper disable once RedundantAssignment
scopeLevel--; //i have no idea why this works...
break;
}
Expand Down

0 comments on commit f549f2a

Please sign in to comment.