有什么方法可以在 Visual Studio 2008 中自动将注释换行到第 80 列吗? ..或显示第 80 列在哪里?

发布于 2024-07-06 09:02:54 字数 267 浏览 2 评论 0原文

有什么方法可以在您键入注释时自动将注释换行到 80 列边界吗? ..或者失败了,有什么方法可以在 80 边界处显示一条微弱的线,以使手动包裹它们更容易一些?

我使用的其他几个 IDE 具有这些功能中的一种或多种,​​这使得编写包含在合理位置的注释变得更加容易/更快。

[编辑] 如果(像我一样)您使用的是 Visual C++ Express,则需要将密钥的 VisualStudio 部分更改为 VCExpress - 让我困惑了一段时间!

Is there any way to automatically wrap comments at the 80-column boundary as you type them? ..or failing that, any way to display a faint line at the coulmn 80 boundary to make wrapping them manually a little easier?

Several other IDEs I use have one or other of those functions and it makes writing comments that wrap in sensible places much easier/quicker.

[Edit] If (like me) you're using Visual C++ Express, you need to change the VisualStudio part of the key into VCExpress - had me confused for a while there!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

我的痛♀有谁懂 2024-07-13 09:02:54

看看这里的问题:Visual Studio 的隐藏功能 (2005-2010) ?

它显示了如何做到这一点:

“在“HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor”下创建一个名为“Guides”的字符串,其值为“RGB(255,0,0) 79”在文本编辑器中的第 80 列有一条红线。”

Take a look at the question here: Hidden Features of Visual Studio (2005-2010)?

It shows how to do that:

"Under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor" Create a String called "Guides" with the value "RGB(255,0,0) 79" to have a red line at column 80 in the text editor."

无敌元气妹 2024-07-13 09:02:54

这是作为示例宏提供的:

Macros.Samples.VSEditor.FillCommentParagraph

第一次运行它时,它会询问您想要的填充宽度(即 80)。 因为我是 Emacs 难民,所以我将其绑定到 Alt-Q。 之后,您只需进入要格式化的注释,运行命令,它就会适当地包装您的注释。

它并不完美,但已经相当不错了。

This is provided as a sample macro:

Macros.Samples.VSEditor.FillCommentParagraph

The first time you run it it'll ask you what fill width you want (i.e. 80). I bind this to Alt-Q since I'm an Emacs refugee. After that you just move into the comment you want to format, run the command, and it'll wrap your comments suitably.

It ain't perfect, but it's pretty good.

悲歌长辞 2024-07-13 09:02:54

对于 Visual C 2008 Express 用户(像我一样),您需要:

HKEY_CURRENT_USER\Software\Microsoft\VCExpress\9.0\Text Editor

添加一个名为 Guides 的字符串值,其值如下(根据其他响应):

RGB(180,180,255) 80

For Visual C 2008 Express users (like me) you'll need:

HKEY_CURRENT_USER\Software\Microsoft\VCExpress\9.0\Text Editor

Add a string value called Guides with the following value (as per the other responses):

RGB(180,180,255) 80
浅沫记忆 2024-07-13 09:02:54

为了使 Visual Studio 文本编辑器在第 80 列上显示一条微弱的线,请打开 RegEdit 并找到以下内容:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor

请注意,9.0 适用于 Visual Studio 2008。您应该输入 8.0如果您有 Visual Studio 2005。

您创建一个名为 Guides 的新字符串值并输入以下值:

RGB(128,0,0) 80

您可以将 RGB 颜色调整为您喜欢的值。 数字 80 是您希望该行出现在的列。 您可以添加另一行(尽管我不知道这有什么帮助),如下所示:

RGB(128,0,0) 2,80

这将使出现两行,一根位于第 2 列,一根位于第 80 列。

In order to make Visual Studio text editor show a faint line on the 80th column you open RegEdit and locate the following:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor

Please notice that 9.0 is for Visual Studio 2008. You should put 8.0 if you have Visual Studio 2005.

You create a new String value named Guides and enter the following value:

RGB(128,0,0) 80

You can adjust the RGB color to the value you like. The number 80 is the column you want the line to appear at. You can add another line (although I don't see how this can help) like that:

RGB(128,0,0) 2,80

This will make two lines appear, one at the 2th column and one at the 80th column.

九公里浅绿 2024-07-13 09:02:54

HKCU\Software\Microsoft\VisualStudio\9.0\Text Editor\Guides = [REG_SZ] "RGB(192,192,192) 80"
(查看我的 8.0 注册表,所以我不是 100% 确定)

HKCU\Software\Microsoft\VisualStudio\9.0\Text Editor\Guides = [REG_SZ] "RGB(192,192,192) 80"
(Looking at my 8.0 registry, so I'm not 100% certain)

遮了一弯 2024-07-13 09:02:54

顺便说一句,除了上面注释中的最右边的参考线之外,我还为第 4、8、12、16 列等设置了较低对比度的参考线。这确实有助于提高代码的可读性。

By the way, in addition to the rightmost guide as per comments above, I also set lower contrast guides for columns 4, 8, 12, 16 etc. This really helps with code readability.

您的好友蓝忘机已上羡 2024-07-13 09:02:54

Visual Studio 的 SlickEdit 工具。 有一个非常好的实时注释包装器,可以在您键入时自动调整行的长度。

http://www.slickedit.com/products/slickedit-tools

SlickEdit Tools for Visual Studio. There is a very good real time comment wrapper that automatically adjust length of lines as you type.

http://www.slickedit.com/products/slickedit-tools

花辞树 2024-07-13 09:02:54

看看http://www.kynosarges.de/CommentReflower.html

Visual Studio 的 Comment Reflower

Comment Reflower 是 Microsoft Visual Studio 的一个重要插件,它提供块注释(包括 XML 注释)的可配置自动重新格式化。

Take a look at http://www.kynosarges.de/CommentReflower.html.

Comment Reflower for Visual Studio

Comment Reflower is an essential add-in for Microsoft Visual Studio that provides configurable automatic reformatting of block comments, including XML comments.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文