From 3c0f740368db9876ee88dc9f38e2a1fba62e6af8 Mon Sep 17 00:00:00 2001 From: Hexah Date: Fri, 27 Mar 2020 01:24:18 +0100 Subject: [PATCH] Find definition for methodmaps. #1 --- App/AssemblyInfo1.cs | 2 +- UI/Components/IntelliSenseController.cs | 34 ++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/App/AssemblyInfo1.cs b/App/AssemblyInfo1.cs index 75648a82..9165071f 100644 --- a/App/AssemblyInfo1.cs +++ b/App/AssemblyInfo1.cs @@ -33,5 +33,5 @@ #if (DEBUG) [assembly: AssemblyVersion("1.13.*")] #else -[assembly: AssemblyVersion("1.3.0.1")] +[assembly: AssemblyVersion("1.3.0.2")] #endif diff --git a/UI/Components/IntelliSenseController.cs b/UI/Components/IntelliSenseController.cs index 1c1987c1..7c4d2295 100644 --- a/UI/Components/IntelliSenseController.cs +++ b/UI/Components/IntelliSenseController.cs @@ -199,13 +199,19 @@ private void EvaluateIntelliSense() found = true; } + // Try to find declaration if (!found) { - // Many any methodmap, since the ide is not aware of the types - foreach (var methodMap in methodMaps) + var pattern = + $@"\b((?[a-zA-Z_]([a-zA-Z0-9_]?)+))\s+({classString})\s*(;|=)"; + var findDecl = new Regex(pattern, RegexOptions.Compiled); + var match = findDecl.Match(editor.Text); + var classMatch = match.Groups["class"].Value; + if (classMatch.Length > 0) { + var methodMap = methodMaps.FirstOrDefault(e => e.Name == classMatch); var method = - methodMap.Methods.FirstOrDefault(e => e.Name == methodString); + methodMap?.Methods.FirstOrDefault(e => e.Name == methodString); if (method != null) { xPos = ISMatches[j].Groups["method"].Index + @@ -214,9 +220,31 @@ private void EvaluateIntelliSense() ISFuncNameStr = method.FullName; ISFuncDescriptionStr = method.CommentString; ForceReSet = true; + found = true; } } } + + // Match the first found + if (!found) + { + // Many any methodmap, since the ide is not aware of the types + foreach (var methodMap in methodMaps) + { + var method = + methodMap.Methods.FirstOrDefault(e => e.Name == methodString); + + if (method == null) + continue; + + xPos = ISMatches[j].Groups["method"].Index + + ISMatches[j].Groups["method"].Length; + ForwardShowIS = true; + ISFuncNameStr = method.FullName; + ISFuncDescriptionStr = method.CommentString; + ForceReSet = true; + } + } } else {