private void editorTextArea_TextEntered(object sender, TextCompositionEventArgs e) { DomParser.KeysCommand cmd = DomParser.KeysCommand.Default; if (e.Text == "[" && _.TextArea.Document.Text[Math.Max(0, _.TextArea.Caret.Offset - 2)] == '#') { cmd = DomParser.KeysCommand.Container; } else if (e.Text == ".") { cmd = DomParser.KeysCommand.LevelByDot; } else if (e.Text == " ") { cmd = DomParser.KeysCommand.Space; } else if (e.Text == "(" && _.TextArea.Document.Text[Math.Max(0, _.TextArea.Caret.Offset - 2)] == '$') { cmd = DomParser.KeysCommand.MSBuildContainer; } if (cmd != DomParser.KeysCommand.Default) { showCodeCompletion(cmd); } }
protected void showCodeCompletion(DomParser.KeysCommand cmd) { if (completionWindow != null) { return; } if (dom == null) { Log.Debug("Use the codeCompletionInit() for work with Code Completion"); return; } IEnumerable <ICompletionData> data = dom.find(_.TextArea.Document.Text, _.TextArea.Caret.Offset, cmd); if (data == null) { return; } completionWindow = new CompletionWindow(_.TextArea) { Width = 270 }; completionWindow.Closed += delegate { completionWindow = null; }; foreach (ICompletionData item in data) { completionWindow.CompletionList.CompletionData.Add(item); } completionWindow.Show(); }