【问题标题】:VS2010: How to set format on enterVS2010:如何在输入时设置格式
【发布时间】:2011-08-27 23:28:45
【问题描述】:

我已经下载了适用于 VS2010 的 Productivity Power Tools 插件。我正在使用该设置自动插入右括号。但是,我似乎无法让编辑器在输入时正确格式化。可能最好用代码 sn-p 来显示我的要求:

// I will be using the pipe | to show the carret

// At this point, the closing brace is inserted:
var foo = new Foo{|
// So it becomes this:
var foo = new Foo{|}

// Now pressing enter formats it like this:
var foo = new Foo{
    |
}

// BUT THIS IS HOW I WANT THE FORMATTING TO BE:
var foo = new Foo
{
    |
}

// It is however formatted correctly on semilcolon:
// So this:
var foo = new Foo{
    var bar = 5;|
}
// Becomes this:
var foo = new Foo
{
    var bar = 5;
};|

【问题讨论】:

标签: c# visual-studio-2010 autocomplete formatting intellisense


【解决方案1】:

有一个名为“自动支撑完成”的选项
您可以通过 Tools-> Options -> Productivity Power Tools -> All Extensions
获得它 如果您不喜欢默认行为和用户 VS2010 设置,可以将其关闭

【讨论】:

  • 我正在使用“自动大括号完成”。如果您通读上面的代码 sn-p,您会看到我想要完成的工作。我希望它在输入时正确格式化。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-22
  • 1970-01-01
  • 2011-10-22
相关资源
最近更新 更多