IsCaretInLibraryStatement() 공개 정적인 메소드

public static IsCaretInLibraryStatement ( ITextView textView ) : bool
textView ITextView
리턴 bool
예제 #1
0
        /// <summary>
        /// Should this key press trigger a completion session?
        /// </summary>
        public override bool IsTriggerChar(char typedCharacter)
        {
            if (!HasActiveCompletionSession)
            {
                switch (typedCharacter)
                {
                case '$':
                case '@':
                    return(true);

                case ':':
                    return(RCompletionContext.IsCaretInNamespace(TextView));

                case '(':
                    return(RCompletionContext.IsCaretInLibraryStatement(TextView));

                default:
                    if (REditorSettings.ShowCompletionOnFirstChar)
                    {
                        return(Char.IsLetter(typedCharacter) || typedCharacter == '.');
                    }
                    break;
                }
            }

            return(false);
        }
예제 #2
0
        /// <summary>
        /// Should this key press trigger a completion session?
        /// </summary>
        public override bool IsTriggerChar(char typedCharacter)
        {
            if (!HasActiveCompletionSession)
            {
                switch (typedCharacter)
                {
                case '$':
                case '@':
                    return(true);

                case ':':
                    return(RCompletionContext.IsCaretInNamespace(TextView));

                case '(':
                    return(RCompletionContext.IsCaretInLibraryStatement(TextView));

                default:
                    if (REditorSettings.ShowCompletionOnFirstChar)
                    {
                        SnapshotPoint?position = REditorDocument.MapCaretPositionFromView(TextView);
                        if (position.HasValue)
                        {
                            int pos      = position.Value;
                            var snapshot = position.Value.Snapshot;
                            // Trigger on first character
                            if (RTokenizer.IsIdentifierCharacter(typedCharacter) && !char.IsDigit(typedCharacter))
                            {
                                // Ignore if this is not the first character
                                return(pos <= 1 || (pos > 1 && !RTokenizer.IsIdentifierCharacter(snapshot[pos - 2])));
                            }
                        }
                    }
                    break;
                }
            }
            return(false);
        }