コード例 #1
0
        private bool ShouldStartSession(char typedChar, string filename, SnapshotPoint caretPosition, bool isRecursiveCall, out bool waitForCompilation)
        {
            waitForCompilation = false;

            if (_session != null && !_session.IsDismissed)
            {
                return(false);
            }

            var stack = _compilerService.GetCurrentAstStack(filename, caretPosition)
                        .Where(ast => !(ast is IEnumerable))                 // Skip IAstList
                        .ToArray();

            if (stack.Length == 0)
            {
                return(false);
            }

            var stackTop = stack[0];

            if (stackTop is Property || (typedChar == '.' && !isRecursiveCall))
            {
                waitForCompilation = true;
                return(false);
            }

            if (stackTop is GlobalDeclaration)
            {
                return(false);
            }

            return(true);
        }