ARCed.Scintilla.SnippetManager.DoSnippetCheck C# (CSharp) Method

DoSnippetCheck() public method

public DoSnippetCheck ( ) : bool
return bool
        public bool DoSnippetCheck()
        {
            if (!this._isEnabled || this._snippetLinks.IsActive || Scintilla.AutoComplete.IsActive || Scintilla.Selection.Length > 0)
                return false;

            int pos = Scintilla.NativeInterface.GetCurrentPos();

            //	In order to even _start searching for a snippet keyword the
            //	current position needs to meet these conditions:
            //	Can't be at the very beginning of the document. Why? becuase
            //	then obviously there can't be a preceding keyword then can it?
            //	The preceding character can't be whitespace (same reason)
            //
            //	I decided I like expanding a template in the middle of a word
            if (pos <= 0 || Scintilla.NativeInterface.GetCharAt(pos - 1).ToString().IndexOfAny(Scintilla.Lexing.WhitespaceCharsArr) >= 0)
                return false;

            //	We also don't want a template expand if we're in a Comment or
            //	String. Be sure and mask out any indicator style that may be applied
            int currentStyle = Scintilla.NativeInterface.GetStyleAt(pos - 1) & 0x1f;
            if (currentStyle == 1 || currentStyle == 2 || currentStyle == 4)
                return false;

            //	Let Scintilla figure out where the beginning of
            //	the word to the left is.
            int newPos = Scintilla.NativeInterface.WordStartPosition(pos, true);

            Range snipRange = Scintilla.GetRange(newPos, pos);
            string keyworkCandidate = snipRange.Text;

            Snippet snip;
            if (!this._list.TryGetValue(keyworkCandidate, out snip))
            {
                //	Not a match. Buh-bye
                return false;
            }

            this.InsertSnippet(snip, newPos);
            Scintilla.Commands.StopProcessingCommands = true;
            return true;
        }