开发者

Is it possible to teach emacs to insert XML Code documentation in Csharp-mode?

开发者 https://www.devze.com 2022-12-20 04:21 出处:网络
In Visual Stu开发者_JS百科dio, editing a C# file, when I type in three slashes in succession, it auto-generates a template for XML code documentation.

In Visual Stu开发者_JS百科dio, editing a C# file, when I type in three slashes in succession, it auto-generates a template for XML code documentation.

Can I get emacs (csharp-mode) to do something similar?


Have you looked at yasnippet? It's a pretty extensible template system, with an easy to understand syntax. You could have three /// bound to the template you want.


I took a shot at implementing some logic to automatically insert XML comments in csharp-mode. I've published it to the EmacsWiki as csharp-mode v0.7.2 I could have done this with yasnippet or some other template package, but I didn't want to tie csharp-mode to a specific template package.

The behavior is that, if you type three slashes (///), then you get a template for a summary comment;

  /// <summary>
  ///   (point)
  /// </summary>

If you then type three slashes after THAT, then you get a remarks section:

  /// <summary>
  ///   Lorem ipsum....
  /// </summary>
  /// <remarks>
  ///   <para>
  ///     (point)
  ///   </para>
  /// </remarks>

That behavior sort of mimics what you get in Visual Studio 2008, when you type 3 slashes. Try it out.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号