Format Switch Statement
See original GitHub issueEnvironment
- Operating System: WSL 1 on Win 10
- JDK version: 11.0.5 2019-10-15
- Visual Studio Code version: 1.41.1
- Java extension version: 0.55.1
Steps To Reproduce
- Add a
switch
statement format the document
Current Result
Expected Result
Additional Informations
Is this configurable? This is the extension that is formatting the code, right?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Switch statement formatting - coding style - Stack Overflow
I've been conflicted over how to format switch statements for awhile now. I see three viable options, and while I've been using the...
Read more >switch…case in C (Switch Statement in C) with Examples
A general syntax of how switch-case is implemented in a 'C' program is as follows: switch( expression ) { case value-1: Block-1; Break;...
Read more >switch - JavaScript - MDN Web Docs - Mozilla
The switch statement evaluates an expression, matching the expression's value against a series of case clauses, and executes statements ...
Read more >C - switch statement - Tutorialspoint
A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and...
Read more >The switch Statement (The Java™ Tutorials > Learning the ...
A switch works with the byte , short , char , and int primitive data types. It also works with enumerated types (discussed...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s a rationale for not indenting cases: https://stackoverflow.com/questions/4509039/why-the-strange-indentation-on-switch-statements
But I still find it hurts my eyes. Also Oracle’s doc on switch shows indentation: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html.
The google formatter does the same: https://google.github.io/styleguide/javaguide.html#s4.8.4-switch
IntelliJ IDEA and Netbeans indent cases by default too.
@snjeza can you please make it the default setting in jdt.ls. Current formatting of switch cases makes no sense at all.