Visual Studio 2010 自动格式化

发布于 2024-11-27 02:25:43 字数 432 浏览 1 评论 0原文

我的机器上安装了 Productivity Power Tools 扩展以及 VS 2010,但我似乎遇到了一个神秘的问题。

当我输入 ;} 时,IDE 不再自动格式化代码,这很烦人,我在 }选项。

我发现这个问题,但这并没有也不能解决我的问题(设置表明我的 IDE 中已经有相同的设置)。

我目前无法提供更多信息,它昨天还在工作,今天早上我上班,它就停止工作了,我根本没有更改任何设置。任何帮助将不胜感激。

I have the Productivity Power Tools extension installed on my machine, as well as VS 2010, but I seem to have developed a mysterious issue.

The IDE no longer auto-formats code when I enter a ; or } which is quite annoying, I made particular use of the auto-format on } option.

I found this question, but that doesn't solve my problem either (the settings suggested there were already the same in my IDE).

I can't really offer more information at the minute, it was working yesterday, I came into work this morning and it's just stopped working, I haven't changed any settings at all. Any help would be massively appreciated.

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

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

发布评论

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

评论(3

雨落星ぅ辰 2024-12-04 02:25:43

通常,当我的代码无法构建,或者我在某处(或类似的东西)错过了右大括号 } 时,通常会在我正在查看的代码上方看到这种情况。首先检查代码是否构建,以将其作为可能性删除,然后尝试从菜单中强制自动格式化(编辑 > 高级 > 格式化文档 (Ctrl + K , Ctrl + D))。还不行吗?

这可能无法解决问题,但应该有助于完善问题。

Typically I've seen this when my code wouldn't build, or I'd missed a closing brace } somewhere (or something similar), usually above the code that I'm looking at. Check that the code builds first just to remove it as a possibility, then try a forced auto format from the menu (Edit > Advanced > Format Document (Ctrl + K, Ctrl + D)). Does it still not work?

This may not solve the issue, but should help refine the problem.

晌融 2024-12-04 02:25:43

这发生在我身上。关闭文件和关闭VS都没有帮助,而且这不是代码中缺少括号的情况。不知何故,VS 中的一些黑魔法改变了格式设置。

这是 VS 2010 中的设置:
工具 ⇒ 选项 ⇒ 文本编辑器 ⇒ C# ⇒ 格式化 ⇒ 换行 ⇒ 将块保留在单行上。

取消选中该复选框,当您输入右括号时,行将换行。

This happened to me. Closing files and closing VS didn't help, and it's not the case of a missing bracket in the code. Somehow the Formatting setting got changed by some black magic in VS.

Here's where the setting is in VS 2010:
Tools ⇒ Options ⇒ Text Editor ⇒ C# ⇒ Formatting ⇒ Wrapping ⇒ Leave block on Single Line.

Uncheck the checkbox, and the lines will wrap when you enter the closing bracket.

扛起拖把扫天下 2024-12-04 02:25:43

我知道的老问题,但是没有提到的经典 MS 解决方案:关闭文件和/或 VS 并重新启动(有时只需文件就足够了,有时是 VS)。

如果您长时间打开文件/进行大量编辑,这种情况会经常发生。 VS 只是感到厌倦/无聊/困惑/不知所措。

Old issue I know, but classic MS solution that hasn't been mentioned: close the file and/or VS and start again (sometimes just the file is enough, sometimes VS).

This happens a lot if you have the file open for a long time / lots of edits. VS just gets fed up / bored / confused / overwhelmed.

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