XML Formatting: Line break between XML declaration and copyright

Answered

I wanted to have a line break between XML file's XML declaration and copyright comment but I couldn't find a configuration for this.

It happens after I use "Set from: Predefined style / Android".

I can enable "Keep Line Breaks" but it's too general and wouldn't work if the file already didn't have a break between XML declaration and copyright comment (when triggering manual formatting).

 

It's mildly infuriating to see XML declaration and copyright comment together after triggering formatting to format other stuff.

Examples: 

With break:
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019, John Doe
All rights reserved.
-->
Without a break:
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2019, John Doe
All rights reserved.
-->
0
5 comments
Avatar
Liubov Melnikova

Sorry for the misunderstanding, there's no such option currently, please feel free to create a feature request: https://youtrack.jetbrains.com/newIssue .

0
Avatar
Permanently deleted user

It's not like that by default. The behavior changes after I use "Set from: Predefined style / Android". That action must be changing something so it makes the formatter behave like this?

 

0
Avatar
Liubov Melnikova

Could you please check .editorconfig file, if it's configured correctly? Also, please try Help | Invalidate caches and restart, it might help.

0
Avatar
Permanently deleted user

Sorry for late reply.
I don't have the .editorconfig file.  Yes, I tried restarting.

Are you able to reproduce it?

0

Can't reproduce. Does it happen only in Android specific files or in any XML files?

Please share a small sample project with your code style and copyright profiles embedded: https://uploads.services.jetbrains.com/.

0

Please sign in to leave a comment.