Example #1
0
        internal IIntellisenseResult Suggest(string expression, FormulaType parameterType, int cursorPosition)
        {
            var formula = new Formula(expression);

            formula.EnsureParsed(TexlParser.Flags.None);

            var binding = TexlBinding.Run(
                new Glue2DocumentBinderGlue(),
                formula.ParseTree,
                new SimpleResolver(EnumStore.EnumSymbols),
                ruleScope: parameterType._type,
                useThisRecordForRuleScope: false
                );

            var context      = new IntellisenseContext(expression, cursorPosition);
            var intellisense = IntellisenseProvider.GetIntellisense();
            var suggestions  = intellisense.Suggest(context, binding, formula);

            if (suggestions.Exception != null)
            {
                throw suggestions.Exception;
            }

            return(suggestions);
        }
Example #2
0
        /// <summary>
        /// Get intellisense from the formula.
        /// </summary>
        public IIntellisenseResult Suggest(string expression, FormulaType parameterType, int cursorPosition)
        {
            var result  = this.CheckInternal(expression, parameterType, intellisense: true);
            var binding = result._binding;
            var formula = result._formula;

            var context      = new IntellisenseContext(expression, cursorPosition);
            var intellisense = IntellisenseProvider.GetIntellisense();
            var suggestions  = intellisense.Suggest(context, binding, formula);

            return(suggestions);
        }
 public IntellisenseContext(IntellisenseContextType contextType, IntellisenseContext enclosingContext)
 {
     ContextType      = contextType;
     EnclosingContext = enclosingContext;
 }
 public IntellisenseContext(IntellisenseContextType contextType, IntellisenseContext enclosingContext)
 {
     ContextType = contextType;
     EnclosingContext = enclosingContext;
 }