Visual Studio 2015 - 按shift + enter时,括号不会自动格式化 [英] Visual Studio 2015 - brackets not automatically formatting when pressing shift + enter

查看:819
本文介绍了Visual Studio 2015 - 按shift + enter时,括号不会自动格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,要创建一个新的括号块,我会输入:

Normally, to create a new bracket block I would type:

{然后输入

这产生:

{

}

然而,(我在目前为止在两台不同的机器上看到过这种情况,可能是默认设置)如果像我一样,你想保持换档,或者意外地将其保持下来,而是按下shift + enter,它会在下面创建一个新行。

however, (I have seen this on two different machines so far, it might be the default setting) if like me, you like to keep shift held down, or accidentally keep it down and instead press shift + enter, it creates a new line underneath.

{ }
//current cursor position

留下未格式化的括号!

这真的很烦人,因为我几乎总是这样做,并且不得不摆弄一下,让括号回到我想要的位置。我该怎么做才能改变shift + enter的行为?

This is really annoying as I nearly always do this, and have to fiddle around for a little second to get the brackets back to where I want them. What can I do to change the behavior of shift + enter?

推荐答案

我们偶然发现了这个帖子,感觉我们可以制作这是Shift + Enter(SmartBreakLine)的一个很好的改进。

We stumbled on this thread and it felt like we could make a nice improvement here to Shift+Enter (SmartBreakLine).

因此,在打开一个块的情况下 {} 并且如果 shift 被有意或无意地扣押,我们现在这样做:

So, in cases where a block was opened { } and if shift was held down intentionally or unintentionally, we now do this:

{
    |
}

而不是

{ }
|

这种方式习惯使用shift +输入来完成该行(在C#中,它添加了如果需要,在行尾添加分号,格式化行,在当前行之后添加新行)不必通过将快捷方式重新映射到BreakLine来丢失这些功能。

this way people who are used to using shift+enter to complete the line (in C#, it adds a semicolon to the end of line if needed, formats the line, adds a new line after current line) do not have to lose those functionalities by remapping the shortcut to BreakLine.

请参阅: https://github.com/dotnet/roslyn/pull/5790

这应该在Vs2015的下一次更新中进行,我们希望你喜欢它。

this should make it in the next update of Vs2015 and we hope you like it.

这篇关于Visual Studio 2015 - 按shift + enter时,括号不会自动格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆