Excel-DNA / IntelliSense

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

Hide Excel tooltip while IntelliSense tooltip is visible #15

Closed LBuckland closed 6 years ago

LBuckland commented 8 years ago

Using Excel 2016 32-bit, this add-in works really well, except when you make reference to a native function then that IntelliSense takes over. For example "=IF(myUDF(A1),true,false)" results in only the IF statement IntelliSense being displayed.

govert commented 8 years ago

Thanks for having a look and raising this issue! The current formula parsing is completely simplistic, but I have extracted the function that needs to improve. We need a better implementation of this: https://github.com/Excel-DNA/IntelliSense/blob/master/Source/ExcelDna.IntelliSense/UIMonitor/FormulaParser.cs#L9

bool TryGetFormulaInfo(string formulaPrefix, out string functionName, out int currentArgIndex)

It takes the whole formula up to the point where the cursor is located, and should work out the current function name and argument index. For example for

=IF(myUDF(A

if should give functionName = "myUDF" and currentArgIndex = 0.

Would you like to suggest a better implementation?

Ron-Ldn commented 8 years ago

If you try my implementation detailed in issue #12, you will see that the "myUDF" IntelliSense appears correctly. However, the native IntelliSense for the "IF" is there as well. We should look for a way to disable the native IntelliSense when the ExcelDNA IntelliSense is active.

govert commented 8 years ago

This is the same as #19? A bit better now, but not yet perfect.

Ron-Ldn commented 8 years ago

I wouldn't tell it is the same. But the newest version looks quite good to me. Let me share my thoughts. If you enter "=if(A1=A2, sum" in a cell or in the formula bar, then you will get 2 pop-ups from Excel: one for the "if" and one for the "sum", and they are not overlapping.

ifsumintellisense

Then if you open a parenthesis after the "sum", the "if" IntelliSense disappears.

ifsumintellisense2

I remember that with an older version of the ExcelDna IntelliSense, the pop-up for the custom UDF was overlapped by the "if" one, in the same way as with #19 But it looks better now:

ifaddthemintellisense

When I start editing the "AddThem" parameters, the "if" IntelliSense remains, which is a different behaviour than Excel, but as long as it does not hide the ExcelDna IntelliSense, I think it is good.

ifaddthemintellisense2

govert commented 8 years ago

I spent quite a lot of time learning to track the Excel tooltip, and eventually to hide it. But every edit makes it pop up again. So I gave up for now, and just moved out tooltip out of the way.

I still want to find a way of hiding the Excel tip, so we'll leave this issue open for now.

Ron-Ldn commented 8 years ago

Hi Govert, I noticed that when we have 2 boxes, one from Excel and one from ExcelDNA like with my "=if(A1=A2, sum" example, then the boxes are not overlapping when they appear, but they do if I move the Excel window. As soon as I edit the formula, the ExcelDna one moves down again in order to resolve the overlapping issue. I observed the same behaviour with the resizing of course. I assume that the code hooking the move/resize event is not calling the function to resolve the overlapping issue.

govert commented 8 years ago

@Ron-Ldn This should now be fixed with e11a9baea2bbefcd8d9f18ce001f709917f6261f

Ron-Ldn commented 8 years ago

@govert It is fixed indeed. Do you still want to keep that issue open?

hell-racer commented 6 years ago

I think IntelliSense interacts with Excel's native tooltips well enough. Let's close it?