Excel-DNA / IntelliSense

Add in-sheet IntelliSense for Excel UDFs
MIT License
170 stars 52 forks source link

Tooltip pops up for an UDF name inside a string value #55

Open hell-racer opened 6 years ago

hell-racer commented 6 years ago

If UDF name happens to appear inside a string which is used as value of an argument of another function (UDF or native), the IntelliSense tooltip pop up for this UDF.

E.g.: the following formula

=ISTEXT("The function AddThem is used for something")

... will show the tooltip for AddThem UDF.

Possibly we need to check double quotes while parsing the formula and searching for UDF name.

govert commented 6 years ago

There's a bit of an attempt to do this in the FormulaParser: https://github.com/Excel-DNA/IntelliSense/blob/master/Source/ExcelDna.IntelliSense/UIMonitor/FormulaParser.cs

But I think we might need to implement a proper parser some day, instead of a few regular expressions and the current approach.

hell-racer commented 6 years ago

Yeah, the problem is in this file, I think. The method TryGetFormulaInfo removes all the strings w/RegEx before doing its thing, it even takes into account if we are in the middle of editing a string (it closes the quotes and then removes the string), but the method GetLineBeforeFunctionName doesn't do that, thus it finds function names inside a string. I think it needs to do similar thing.

eliotj12 commented 6 years ago

Has this been fixed? I don't seem to have the issue on my side.

hell-racer commented 6 years ago

It looks like the problem appears if we are editing UDF and there's UDF name inside argument: e.g. try to type:

=AddThem("The AddThem

image