public override IActionableErrorInfo Check() { var value = GetValue(); if (DataListUtil.IsCalcEvaluation(value, out string calculationExpression)) { value = calculationExpression; _syntaxBuilder.Build(value, false, out Token[] tokens); if (_syntaxBuilder.EventLog != null && _syntaxBuilder.HasEventLogs) { return(new ActionableErrorInfo(DoError) { Message = "Syntax Error An error occurred while parsing { " + value + " } It appears to be malformed" }); } } return(null); }
public IList <IntellisenseProviderResult> GetIntellisenseResults(IntellisenseProviderContext context) { if (context == null) { return(new List <IntellisenseProviderResult>()); } var caretPosition = context.CaretPosition; var inputText = context.InputText ?? string.Empty; var parseEventLog = _syntaxTreeBuilderHelper.EventLog; var intellisenseDesiredResultSet = context.DesiredResultSet; if (context.IsInCalculateMode) { if (intellisenseDesiredResultSet == IntellisenseDesiredResultSet.EntireSet && (caretPosition == 0 || string.IsNullOrEmpty(inputText))) { parseEventLog?.Clear(); if (_syntaxTreeBuilderHelper.EventLog != null && _syntaxTreeBuilderHelper.HasEventLogs) { List <IntellisenseProviderResult> tResults = new List <IntellisenseProviderResult>(); tResults.AddRange(IntellisenseResult); return(EvaluateEventLogs(tResults, inputText)); } return(IntellisenseResult); } Token[] tokens; var searchText = context.FindTextToSearch(); _syntaxTreeBuilderHelper.Build(searchText, true, out tokens); string sub = string.IsNullOrEmpty(searchText) ? inputText : searchText; List <IntellisenseProviderResult> subResults = IntellisenseResult.Where(t => t.Name.StartsWith(sub)).ToList(); return(subResults); } return(EmptyResults); }