Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening brace not moved to new line while typing #2378

Closed
tstivers1990 opened this issue Jun 12, 2018 · 3 comments
Closed

Opening brace not moved to new line while typing #2378

tstivers1990 opened this issue Jun 12, 2018 · 3 comments

Comments

@tstivers1990
Copy link

tstivers1990 commented Jun 12, 2018

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

.NET Core SDKs installed:
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

VS Code version: 1.24.0

C# Extension version: 1.15.2

Steps to reproduce

Type a class, such as public class Testing { }

Expected behavior

In most editors, after typing the opening brace, a closing brace is automatically added. Some editors choose to format at this point, moving the opening brace to its own line and the closing brace to its own line, and placing the cursor on a blank line between them automatically indented.

Actual behavior

Upon pressing enter, the opening brace remains on the same line as the declaration, the closing brace is moved to its own line, and the cursor is placed on a blank line between them, like so:

public class Testing {
    |
}

I have tried creating the omnisharp.json file in %USERPROFILE%\.omnisharp\ with the desired settings, but it does not seem to have an impact. Format on typing is enabled in VS Code. Typing something like public bool Test {get;set;} gets formatted to public bool Test { get; set; } automatically. Manually triggering formatting through the right click context menu formats opening braces to their own line as desired, so it shouldn't be a configuration issue. The formatting is just not applied while typing.

@DustinCampbell
Copy link
Member

Thanks for reporting this. I can definitely reproduce this issue.

@akshita31
Copy link
Contributor

Closing this as a duplicate of #1591

@DustinCampbell
Copy link
Member

@akshita31 : Note that there is a "Resolved-Duplicate" label that you can use to mark issues as dupes when closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants