Ejemplo n.º 1
0
        /// <summary>
        /// Handle mouse hover events.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AutoCMouseHover(object sender, EventArgs e)
        {
            // check if code hints are enabled
            if (EnableCodeHints == false)
            {
                return;
            }

            // convert cursor position to text position
            var mouse = PointToClient(Cursor.Position);
            var pos   = CharPositionFromPoint(mouse.X, mouse.Y);

            // select keywords using the current text position
            // is the style at that position a valid hint style
            var style = GetStyleAt(pos);

            if (style > 0)
            {
                // is there a word at that position
                var word = GetWordFromPosition(pos);
                if (word?.Length > 0)
                {
                    // get hint for keyword
                    var hint = FxLexer.GetKeywordHint(GetStyleAt(pos), word);
                    if (hint != null)
                    {
                        CallTipShow(WordStartPosition(pos, true), hint);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void TestMethodFindBufferHint()
        {
            var word  = "buffer";
            var style = editor.GetStyleAt(code.IndexOf(word));
            var hint  = lexer.GetKeywordHint(style, word);

            Assert.IsNotNull(hint);
        }