question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auto formatting breaks if an enum is present

See original GitHub issue

Environment data

dotnet --info output:

.NET Command Line Tools (2.1.105)

Product Information:
 Version:            2.1.105
 Commit SHA-1 hash:  141cc8d976

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.105\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.7
  Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11

VS Code version:

1.23.1 d0182c3417d225529c6d5ad24b7572815d0de9ac x64

C# Extension version:

1.15.2

Steps to reproduce

Open a .cs file with these contents:

public class EnumDemo {

    /// <summary>
    /// 
    /// Here is my enum 
    /// </summary>
    public enum DEMO { One, Two, Three };

    void AFunctionHere () {
        //things are indented wrong 
        var hello = 3;
    }

    void AnotherFunction () {
        // hi
    }
}

Then Format Document ( Alt + Shift + F)

Expected behavior

The indentation should look like this: image

Actual behavior

The indentation looks like this image

Enjoying the plugin, thank you guys for making it and maintaining it

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
Leopotamcommented, May 29, 2018

@dogboydog remove ; after enum - it should fix issue (for C#FixFormat).

0reactions
PorcaMcommented, Dec 28, 2018

It is because of the semicolon. Remove semicolon at the end of ending brace.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to stop Eclipse formatter from placing all enums on one line
Window > Preferences > Java > Code Style > Formatter · Click Edit · Select the Line Wrapping tab · Select the enum...
Read more >
Line break for enumerations with constant arguments does not ...
Hi! In order to have a common code layout, I want to format enum-class declarations so, that each enum-element is in a separate...
Read more >
enum class support · Issue #391 · fmtlib/fmt - GitHub
I'm working in a project that uses a number of enum classes, e.g: enum ... <typename FormatContext> auto format(OrderStatus order_status, ...
Read more >
Enumeration declaration - cppreference.com
An enumeration is a distinct type whose value is restricted to a range of values (see below for details), which may include several ......
Read more >
Enum HOWTO — Python 3.11.1 documentation
An Enum is a set of symbolic names bound to unique values. They are similar to global variables, but they offer a more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found