public CodeSnippet(CodeSnippet copy) { this.name = copy.name; this.description = copy.description; this.text = copy.text; this.keyword = copy.keyword; }
void SnippetTextBox_TextChanged(object sender, EventArgs e) { CodeSnippet snippet = dataGrid.SelectedItem as CodeSnippet; if (snippet != null) { snippet.Text = snippetTextBox.Text; } }
public bool SaveOptions() { CodeSnippet emptySnippet = new CodeSnippet(); foreach (CodeSnippetGroup g in groups) { for (int i = 0; i < g.Snippets.Count; i++) { if (emptySnippet.Equals(g.Snippets[i])) g.Snippets.RemoveAt(i--); } } SnippetManager.Instance.SaveGroups(groups); return true; }
public SnippetCompletionItem(ITextEditor textEditor, CodeSnippet codeSnippet) { if (textEditor == null) throw new ArgumentNullException("textEditor"); if (codeSnippet == null) throw new ArgumentNullException("codeSnippet"); this.textEditor = textEditor; this.textArea = textEditor.GetService(typeof(TextArea)) as TextArea; if (textArea == null) throw new ArgumentException("textEditor must be an AvalonEdit text editor"); this.codeSnippet = codeSnippet; this.Priority = CodeCompletionDataUsageCache.GetPriority("snippet" + codeSnippet.Name, true); }
public bool SaveOptions() { CodeSnippet emptySnippet = new CodeSnippet(); foreach (CodeSnippetGroup g in groups) { for (int i = 0; i < g.Snippets.Count; i++) { if (emptySnippet.Equals(g.Snippets[i])) { g.Snippets.RemoveAt(i--); } } } SnippetManager.Instance.SaveGroups(groups); return(true); }
void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { CodeSnippet snippet = dataGrid.SelectedItem as CodeSnippet; if (snippet != null) { snippetTextBox.Text = snippet.Text; snippetTextBox.IsReadOnly = false; snippetTextBox.Background = SystemColors.WindowBrush; } else { snippetTextBox.Text = null; snippetTextBox.IsReadOnly = true; snippetTextBox.Background = SystemColors.ControlBrush; } }
public SnippetCompletionItem(ITextEditor textEditor, CodeSnippet codeSnippet) { if (textEditor == null) { throw new ArgumentNullException("textEditor"); } if (codeSnippet == null) { throw new ArgumentNullException("codeSnippet"); } this.textEditor = textEditor; this.textArea = textEditor.GetService(typeof(TextArea)) as TextArea; if (textArea == null) { throw new ArgumentException("textEditor must be an AvalonEdit text editor"); } this.codeSnippet = codeSnippet; this.Priority = CodeCompletionDataUsageCache.GetPriority("snippet" + codeSnippet.Name, true); }