public override void Execute(TextCompletionEngine textCompletionEngine, TextArea textArea) { textArea.GetSelectionBounds(out int startLine, out int endLine); int startOffset = textArea.Document.GetOffset(startLine, 0); textArea.Document.UndoStack.StartUndoGroup(); try { for (int i = startLine; i <= endLine; i++) { ICSharpCode.AvalonEdit.Document.DocumentLine line = textArea.Document.GetLineByNumber(i); string lineText = textArea.Document.GetText(line.Offset, line.Length); if (lineText.StartsWith(Prefix)) { textArea.Document.Remove(line.Offset, Prefix.Length); } } ICSharpCode.AvalonEdit.Document.DocumentLine endDocumentLine = textArea.Document.GetLineByNumber(endLine); textArea.Selection = Selection.Create(textArea, startOffset, endDocumentLine.EndOffset); } finally { textArea.Document.UndoStack.EndUndoGroup(); } }
string GetParameterTooltip(int parameterNumber) { DndFunction dndFunction = TextCompletionEngine.GetActiveDndFunction(TextEditor.TextArea); if (dndFunction == null) { return(null); } IEnumerable <ParamAttribute> customAttributes = dndFunction.GetType().GetCustomAttributes(typeof(ParamAttribute)).Cast <ParamAttribute>().ToList(); if (customAttributes == null) { return(null); } ParamAttribute paramAttribute = customAttributes.FirstOrDefault(x => x.Index == parameterNumber); if (paramAttribute == null) { return(null); } return(paramAttribute.Description); }
public void ExecuteCommand(TextArea textArea, TextCompletionEngine textCompletionEngine) { if (Command == null) { System.Diagnostics.Debugger.Break(); return; } Command.Execute(textCompletionEngine, textArea); }
void LoadTextCompletionEngine() { if (TextCompletionEngine != null) { TextCompletionEngine.RequestTextSave -= TextCompletionEngine_RequestTextSave; } TextCompletionEngine = new TextCompletionEngine(TextEditor); TextCompletionEngine.ReloadShortcuts(); TextCompletionEngine.RequestTextSave += TextCompletionEngine_RequestTextSave; }
private void TbxCode_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Space && Modifiers.NoModifiersDown) { CodeTemplate templateToExpand = TemplateEngine.GetTemplateToExpand(TextEditor); if (templateToExpand != null) { e.Handled = true; TextCompletionEngine.HideCodeCompletionWindow(); TemplateEngine.ExpandTemplate(TextEditor, templateToExpand); } } else if (IsNavKey(e.Key) || e.Key == Key.OemComma && Modifiers.NoModifiersDown) { StartTooltipTimer(); } }
public virtual void Execute(TextCompletionEngine textCompletionEngine, TextArea textArea) { }
public override void Execute(TextCompletionEngine textCompletionEngine, TextArea textArea) { textCompletionEngine.CompleteCode(); }
public void RefreshCompletionProviders() { TextCompletionEngine.RefreshCompletionProviders(); }
public void SetText(string code) { TextCompletionEngine.SetText(code); }
public void ReloadShortcuts() { TextCompletionEngine.ReloadShortcuts(); }
public void InvokeCodeCompletion() { TextCompletionEngine.InvokeCodeCompletion(); }