casid / jte-intellij

IntelliJ plugin for jte template files.
https://github.com/casid/jte
Apache License 2.0
23 stars 4 forks source link

Formatting adds a new line at the end of each script tag #7

Closed PsychotherapistSam closed 3 years ago

PsychotherapistSam commented 3 years ago

The new formatter (which is appreciated! :) ) adds a new line to a script tag after each format-action

<script>
  console.log('test')
</script>

results in

<script>
  console.log('test')

</script>

and so forth. If I can help or provide further info I'd love to :)

casid commented 3 years ago

Hi @PsychotherapistSam, thanks for reporting!

That's a tricky one, since JavaScript formatting isn't part of the community edition and thus hard to test for during plugin development. The jte formatter should delegate to the existing HTML/JavaScript formatters.

What happens if you put the above code in an .html file and run the auto format there?

PsychotherapistSam commented 3 years ago

Hi @casid,

I just put the script tag in a .html file and the same thing happens as described above. So I thought I maybe changed some Code Style Settings for HTML by accident, so I reset those but that wasn't the problem. (That's from the existing HTML formatter I believe) After adding the script tag to "Inline elements", "Don't break if inline content" or "Keep white spaces inside:" in the code style settings it doesn't add a new line anymore.

casid commented 3 years ago

Thanks for checking back! Glad it works :-)