protected override void GenerateCompletionData(TextArea textArea, char charTyped) { if (forceNewExpression) { preSelection = ""; if (charTyped != '\0') { preSelection = null; } ExpressionContext context = overrideContext; if (context == null) { context = ExpressionContext.Default; } AddResolveResults(ParserService.CtrlSpace(caretLineNumber, caretColumn, fileName, textArea.Document.TextContent, context), context); return; } ExpressionResult expressionResult = GetExpression(textArea); string expression = expressionResult.Expression; preSelection = null; if (expression == null || expression.Length == 0) { preSelection = ""; if (charTyped != '\0') { preSelection = null; } AddResolveResults(ParserService.CtrlSpace(caretLineNumber, caretColumn, fileName, textArea.Document.TextContent, expressionResult.Context), expressionResult.Context); return; } int idx = expression.LastIndexOf('.'); if (idx > 0) { preSelection = expression.Substring(idx + 1); expressionResult.Expression = expression.Substring(0, idx); if (charTyped != '\0') { preSelection = null; } GenerateCompletionData(textArea, expressionResult); } else { preSelection = expression; if (charTyped != '\0') { preSelection = null; } AddResolveResults(ParserService.CtrlSpace(caretLineNumber, caretColumn, fileName, textArea.Document.TextContent, expressionResult.Context), expressionResult.Context); } }
protected override void GenerateCompletionData(TextArea textArea, char charTyped) { #if DEBUG if (DebugMode) { Debugger.Break(); } #endif if (!allowCompleteExistingExpression) { preSelection = ""; if (charTyped != '\0') { preSelection = null; } ExpressionContext context = overrideContext ?? ExpressionContext.Default; AddResolveResults(ParserService.CtrlSpace(caretLineNumber, caretColumn, fileName, textArea.Document.TextContent, context), context); AddTemplates(textArea, charTyped); return; } ExpressionResult expressionResult = GetExpression(textArea); LoggingService.Debug("Ctrl-Space got expression " + expressionResult.ToString()); string expression = expressionResult.Expression; preSelection = null; if (expression == null || expression.Length == 0) { preSelection = ""; if (charTyped != '\0') { preSelection = null; } AddResolveResults(ParserService.CtrlSpace(caretLineNumber, caretColumn, fileName, textArea.Document.TextContent, expressionResult.Context), expressionResult.Context); AddTemplates(textArea, charTyped); return; } int idx = expression.LastIndexOf('.'); if (idx > 0) { preSelection = expression.Substring(idx + 1); expressionResult.Expression = expression.Substring(0, idx); if (charTyped != '\0') { preSelection = null; } GenerateCompletionData(textArea, expressionResult); } else { preSelection = expression; if (charTyped != '\0') { preSelection = null; } ArrayList results = ParserService.CtrlSpace(caretLineNumber, caretColumn, fileName, textArea.Document.TextContent, expressionResult.Context); AddResolveResults(results, expressionResult.Context); AddTemplates(textArea, charTyped); } }