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.

Option for closing bracket to be on the same line

See original GitHub issue

Metadata

  • @prettier/plugin-xml version: '0.13.0
  • Options:

Our gradle spotless config:

        format 'xml', {
            target '**/*.xml'
            prettier(['prettier': '2.0.5', '@prettier/plugin-xml': '0.13.0']).config(['parser': 'xml', 'tabWidth': 4])
        }
  • xmlSelfClosingSpace: true
  • xmlWhitespaceSensitivity: "strict" (be 100% sure changing this to "ignore" doesn’t fix your issue)
    • changing it to ignore actually throws an error: (Error while formatting: TypeError: Cannot read property 'startLine' of undefined)

Input

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    android:orientation="horizontal">

Current output

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    android:orientation="horizontal"
>

Expected output

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    android:orientation="horizontal" >

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kddnewtoncommented, Jul 14, 2021

I’m coming back to this because prettier core is introducing the bracketSameLine option in 2.4.0 (https://github.com/prettier/prettier/pull/11006). I’ll support that option in this plugin too once I get a minute to implement. If any of the folks on this issue want to send a PR that’d be great.

0reactions
tomerelicommented, May 2, 2021

I (think) I’m using v0.13.1 and this doesn’t seem to be implemented, I still get the XML closing bracket in a new line, which is annoying.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keep else, catch, on same line as closing bracket in Visual ...
Go to Tool -> Option then General -> Text editor -> C++ -> Formatting -> New lines . Choose the following settings:.
Read more >
Option for closing brackets on the same line. · Issue #63 · etingof ...
Apache 2.2, which is the version of Apache on CentOS 6, sometimes allows syntax like: Where the final closing brackets are on the...
Read more >
vue/html-closing-bracket-newline
People have their own preference about the location of closing brackets. This rule enforces a line break (or no line break) before tag's...
Read more >
What is a good practice? Opening brace in the same line or in ...
There is a real 3rd option as well: On same line for choices, loops and such and on a new line for functions:...
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, ... very close to equal that the possible...
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