1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
8
using ICSharpCode.AvalonEdit.AddIn.Snippets;
9
using ICSharpCode.AvalonEdit.Editing;
10
using ICSharpCode.Core;
11
using ICSharpCode.SharpDevelop.Editor;
12
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
13
using ICSharpCode.SharpDevelop.Gui;
15
namespace ICSharpCode.AvalonEdit.AddIn.Commands
17
public class SurroundWithCommand : AbstractMenuCommand
20
/// Starts the command
22
public override void Run()
24
ICodeEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ICodeEditorProvider;
29
CodeSnippetGroup group = SnippetManager.Instance.FindGroup(Path.GetExtension(provider.TextEditor.FileName));
34
DefaultCompletionItemList list = new DefaultCompletionItemList();
36
list.Items.AddRange(group.Snippets.Where(i => i.HasSelection).Select(item => item.CreateCompletionItem(provider.TextEditor)));
38
new CodeSnippetCompletionWindow(provider.TextEditor, list).Show();