Skip to content

Commit a13afea

Browse files
committed
Consolidate formula extraction - still checked twice...
1 parent 056e7e8 commit a13afea

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Source/ExcelDna.IntelliSense.Host/MyFunctions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static object AnotherFunction( [Description("In and out")] object inout)
2828
return inout;
2929
}
3030

31-
[ExcelFunction]
31+
[ExcelFunction(Name ="A.Non.Descript.Function")]
3232
public static object ANonDescriptFunction(object inout)
3333
{
3434
return inout;

Source/ExcelDna.IntelliSense/FormulaParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static class FormulaParser
88
// TODO: This needs a proper implementation, considering subformulae
99
internal static bool TryGetFormulaInfo(string formulaPrefix, out string functionName, out int currentArgIndex)
1010
{
11-
var match = Regex.Match(formulaPrefix, @"^=(?<functionName>\w*)\(");
11+
var match = Regex.Match(formulaPrefix, @"^=(?<functionName>(\w|.)*)\(");
1212
if (match.Success)
1313
{
1414
functionName = match.Groups["functionName"].Value;

Source/ExcelDna.IntelliSense/IntelliSenseDisplay.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ bool ShouldProcessFormulaEditTextChange(string formulaPrefix)
102102
if (_argumentsToolTip?.Visible == true)
103103
return true;
104104

105-
// TODO: Consolidate the check here with the FormulaMonitor
106-
var match = Regex.Match(formulaPrefix, @"^=(?<functionName>\w*)\(");
107-
if (match.Success)
105+
// TODO: Why do this twice....?
106+
string functionName;
107+
int currentArgIndex;
108+
if (FormulaParser.TryGetFormulaInfo(formulaPrefix, out functionName, out currentArgIndex))
108109
{
109-
string functionName = match.Groups["functionName"].Value;
110-
return _functionInfoMap.ContainsKey(functionName);
110+
if (_functionInfoMap.ContainsKey(functionName))
111+
return true;
111112
}
112113
// Not interested...
113114
Debug.Print($"Not processing formula {formulaPrefix}");

0 commit comments

Comments
 (0)