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.

Preserve my line breaks between attributes

See original GitHub issue

How do i preserve my lineBreaks and format identation ate same time?

I have

 public InformacoesGeraisController(
      final ConcursoService concursoService, 
      final CopesePessoaService pessoaService,
      final ProgramaService programaService
      ) {
    this.concursoService = concursoService;
    this.pessoaService = pessoaService;
    this.programaService = programaService;
  }

and after format got this

  public InformacoesGeraisController(final ConcursoService concursoService, final CopesePessoaService pessoaService,
      final ProgramaService programaService) {
    this.concursoService = concursoService;
    this.pessoaService = pessoaService;
    this.programaService = programaService;
  }

Its sooo uglyyy

how disable this?

btw, //@formatter:off its not a good option to me

Environment
  • Operating System: Windows
  • JDK version: 1.8
  • Visual Studio Code version: 1.42.0
  • Java extension version:
Steps To Reproduce
  1. CTRL+ALT+F
Current Result
 public InformacoesGeraisController(final ConcursoService concursoService, final CopesePessoaService pessoaService,
      final ProgramaService programaService) {
Expected Result

Keep line breaks

public InformacoesGeraisController(
      final ConcursoService concursoService, 
      final CopesePessoaService pessoaService,
      final ProgramaService programaService
      ) {
Additional Informations

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
snjezacommented, Apr 22, 2021

@Stwissel could you try to set

"java.format.settings.url": "/eclipse-java-google-style.xml",
1reaction
snjezacommented, Feb 13, 2020

@danielschmitz you can set the following property:

"java.format.settings.url": "https://gist.githubusercontent.com/snjeza/3c71f879679ef23a424372fd543e1250/raw/746337e9b6e631110672a1f8ee4cf4a1ad71a8a7/indentation.xml"

See https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings and https://stackoverflow.com/questions/47420149/eclipse-formatting-new-lines-at-each-method-property

Read more comments on GitHub >

github_iconTop Results From Across the Web

html auto-formatting: preserve my line breaks between ...
VSCode Version: 1.9.0. The new html.format.wrapAttributes settings is nice, but can it be extended with an option to keep "manual" wrapping?
Read more >
How to Preserve Newlines, Line Breaks, and Whitespace in ...
Preserve Newlines, Line Breaks, and Whitespace in HTML. Use the white-space: pre; setting to display long-form content containing whitespace and ...
Read more >
Adding line breaks between attributes - xml
From what I've read, XSLT is not able to preserve these line breaks as the XSLT processor is not passed such unimportant information....
Read more >
Hard Line Breaks | Asciidoctor Docs
To preserve line breaks in all paragraphs throughout your entire document, set the hardbreaks-option document attribute in the document header. Example 3. Line ......
Read more >
Get rid of line breaks after class fields with attributes
Is there a way to turn of the line break after the fields with attributes, but keep all the other attribute formatting? Votes....
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