Debug.WriteLine コードスニペット再び
昔書いた System.Diagnostics.Debug.WriteLine を dw[Tab] で呼び出すコードスニペットを更新しました。SimpleTypeName 関数を使ってちょっと賢くなりました。using の有無に応じて System.Diagnostics.Debug.WriteLine と展開するか、Debug.WriteLine と展開するかだけの違いですがw
surround-withコードスニペット対応です(詳しくは昔の記事参照)。Ctrl-k, s のショートカットはどうしてもすぐ忘れてしまいます...
下のファイルを dw.snippet の名前で保存して、ドキュメント(マイドキュメント)下の Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets に置いてください。VisualStudio 2005 でも動きます。
<?xml version="1.0" encoding="utf-8"?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>DebugWriteLine</Title> <Shortcut>dw</Shortcut> <Description>Code snippet for Debug.WriteLine</Description> <Author>siokoshou</Author> <SnippetTypes> <SnippetType>Expansion</SnippetType> <SnippetType>SurroundsWith</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal Editable="false"> <ID>Debug</ID> <Function>SimpleTypeName(global::System.Diagnostics.Debug)</Function> </Literal> </Declarations> <Code Language="csharp" Kind="method body"><![CDATA[$Debug$.WriteLine( $selected$$end$ );]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>