예제 #1
0
        private void OnMouseHover(ScintillaControl sci, int position)
        {
            if (!ASContext.Context.IsFileValid)
            {
                return;
            }

            lastHoverPosition = position;

            // get word at mouse position
            int style = sci.BaseStyleAt(position);

            if (!ASComplete.IsTextStyle(style))
            {
                return;
            }
            position = sci.WordEndPosition(position, true);
            ASResult result = ASComplete.GetExpressionType(sci, position);

            // set tooltip
            if (!result.IsNull())
            {
                if (Control.ModifierKeys == Keys.Control)
                {
                    var code = ASComplete.GetCodeTipCode(result);
                    if (code == null)
                    {
                        return;
                    }
                    UITools.CodeTip.Show(sci, position - result.Path.Length, code);
                }
                else
                {
                    string text = ASComplete.GetToolTipText(result);
                    if (text == null)
                    {
                        return;
                    }
                    // show tooltip
                    UITools.Tip.ShowAtMouseLocation(text);
                }
            }
        }