private void TextEditor_TextArea_TextEntering(object sender, TextCompositionEventArgs e) { if (SyntaxHighlighting != HighlightingManager.GetHighlightingFromExtension(".java")) { return; } string wordContext = GetClosedWordToCursor(CaretOffset); if (EditorCompletionWindow._editorCompletionList.SelectedItem == null && _completionWindow != null) { _completionWindow.Close(); } else if (e.Text[0] == '.' && EditorCompletionWindow._editorCompletionList.SelectedItem?.Text.Length < 1) { InitializeCompletionWindow(wordContext); } if (e.Text[0] == ';') { if (_classList.Contains(wordContext.Replace(".", "/"))) { AddCompletionData(wordContext); } EditorCompletionWindow._editorCompletionList.RequestInsertion(e); } else if (e.Text[0] == '\n' && _completionWindow != null) { _completionWindow.Close(); } else if (e.Text.Length > 1 && _completionWindow != null && !char.IsLetterOrDigit(e.Text[0]) && wordContext != "") { if (!CompletionList.Contains(wordContext) && _completionWindow == null) { AddCompletionData(wordContext); } else if (wordContext.Length > 0 && !CompletionList.Contains(wordContext)) { EditorCompletionWindow._editorCompletionList.RequestInsertion(e); } } }
private void TextEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e) { if (Brackets.ContainsKey(e.Text)) { Document.Insert(CaretOffset, Brackets[e.Text]); CaretOffset--; } if (SyntaxHighlighting != HighlightingManager.GetHighlightingFromExtension(".java")) { return; } var wordContext = GetClosedWordToCursor(CaretOffset); if (CompletionList.CompletionData.Any(x => x.Text.StartsWith(wordContext))) { InitializeCompletionWindow(wordContext); } else { _completionWindow?.Close(); } }