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.

Add option to put opening braces on new line

See original GitHub issue

The location of braces seems to be an eternal debate among programmers. We have

// I don't like this
if(end_of_line_braces) {
    do_stuff();
}

// I do like this
if(own_line_braces)
{
    do_more_stuff();
}

// Weirdness work makes me use
if(indented_braces)
    {
    do_even_more_stuff();
    }

Why not make braces configurable to the user’s preference? I looked through the decompiler options and it already has quite a few settings the user can configure (indentation, comment style, etc). This is one more quality of life change I think would be nice to have.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:30
  • Comments:5

github_iconTop GitHub Comments

16reactions
MulleDK19commented, Mar 25, 2019

Dear GOD, YES please!

if(end_of_line_braces) {
    do_stuff();
}

Is absolutely horrible for readability. At a quick glance, it looks like there is no starting brace at all.

2reactions
Wall-AFcommented, Sep 30, 2021

Also, maybe add a comment indicating the nesting/block depth on both opening and closing braces. I.e.:

if (...) { //1
  .
  .
  .
  if (..) { //2
    .
    .
    .
  } //2
  .
  .
  .
} // 1
.
.
.

It would help when blocks are large.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I set up VSCode to put curly braces on a new line?
Go to File\Preferences\Settings · Add the following lines in 'User Settings' (in the right side pane) "javascript.format.placeOpenBraceOnNewLineForControlBlocks" ...
Read more >
coding style - Should curly braces appear on their own line?
When I was a student I used to put curly braces on the same line, so that there are fewer lines, and the...
Read more >
How to force braces onto the next line
It's broken down by "class", "method", and "other" in the formatter settings. ... and it's listed under "Braces Placement", you want "Next line"....
Read more >
Where Do Curly Braces Belong? - Jeremy Bytes
Option two is to put the curly braces on a separate line. Here's a sample: Each of these styles has its pros and...
Read more >
C# formatting options - .NET - Microsoft Learn
The new-line options concern the use of new lines to format code. ... Option values, true, Insert space before opening square brackets [....
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