Exemplo n.º 1
0
        public IntellisenseData(IIntellisenseContext context, DType expectedType, TexlBinding binding, TexlFunction curFunc, TexlNode curNode, int argIndex, int argCount, IsValidSuggestion isValidSuggestionFunc, IList <DType> missingTypes, List <CommentToken> comments)
        {
            Contracts.AssertValue(context);
            Contracts.AssertValid(expectedType);
            Contracts.AssertValue(binding);
            Contracts.AssertValue(curNode);
            Contracts.Assert(0 <= context.CursorPosition && context.CursorPosition <= context.InputText.Length);
            Contracts.AssertValue(isValidSuggestionFunc);
            Contracts.AssertValueOrNull(missingTypes);
            Contracts.AssertValueOrNull(comments);

            _expectedType         = expectedType;
            _suggestions          = new IntellisenseSuggestionList();
            _substringSuggestions = new IntellisenseSuggestionList();
            _binding               = binding;
            _comments              = comments;
            _curFunc               = curFunc;
            _curNode               = curNode;
            _script                = context.InputText;
            _cursorPos             = context.CursorPosition;
            _argIndex              = argIndex;
            _argCount              = argCount;
            _isValidSuggestionFunc = isValidSuggestionFunc;
            _matchingStr           = string.Empty;
            _matchingLength        = 0;
            _replacementStartIndex = context.CursorPosition;
            _missingTypes          = missingTypes;
            BoundTo                = string.Empty;
            _cleanupHandlers       = new List <ISpecialCaseHandler>();
        }
Exemplo n.º 2
0
        private void GetFunctionAndTypeInformation(IIntellisenseContext context, TexlNode curNode, TexlBinding binding, out TexlFunction curFunc, out int argIndex, out int argCount, out DType expectedType, out IsValidSuggestion isValidSuggestionFunc)
        {
            Contracts.AssertValue(context);
            Contracts.AssertValue(curNode);
            Contracts.AssertValue(binding);

            if (!FindCurFuncAndArgs(curNode, context.CursorPosition, binding, out curFunc, out argIndex, out argCount, out expectedType))
            {
                curFunc      = null;
                argIndex     = 0;
                argCount     = 0;
                expectedType = DType.Unknown;
            }

            DType binaryOpExpectedType;

            if (TryGetExpectedTypeForBinaryOp(binding, curNode, context.CursorPosition, out binaryOpExpectedType))
            {
                expectedType = binaryOpExpectedType;
            }

            if (curFunc != null)
            {
                isValidSuggestionFunc = (intellisenseData, suggestion) => intellisenseData.CurFunc.IsSuggestionTypeValid(intellisenseData.ArgIndex, suggestion.Type);
            }
            else
            {
                isValidSuggestionFunc = Helper.DefaultIsValidSuggestionFunc;
            }
        }
Exemplo n.º 3
0
 protected internal virtual IntellisenseData.IntellisenseData CreateData(IIntellisenseContext context, DType expectedType, TexlBinding binding, TexlFunction curFunc, TexlNode curNode, int argIndex, int argCount, IsValidSuggestion isValidSuggestionFunc, IList <DType> missingTypes, List <CommentToken> comments)
 {
     return(new IntellisenseData.IntellisenseData(context, expectedType, binding, curFunc, curNode, argIndex, argCount, isValidSuggestionFunc, missingTypes, comments));
 }