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.

0.4.0: indentation issues

See original GitHub issue

Using 0.4.0 I tested one of our XML files.

Settings:

tabWidth: 4
printWidth: 120

Before:

<core:FragmentDefinition
  xmlns:core="sap.ui.core"
  xmlns:m="sap.m"
  xmlns:dev="sap.ead.c4s.ui.view.control"
  xmlns:devEl="sap.ead.c4s.ui.view.element"
  xmlns="http://www.w3.org/1999/xhtml">
  <m:VBox
    renderType="Bare"
    items="{
        path: 'contextMenu>/Info/Context',
        templateShareable: false
      }">
    <dev:SmallBreadcrumbs
      items="{
          path: 'contextMenu>',
          templateShareable: false
        }">
      <dev:items>
        <devEl:SmallBreadcrumbItem depth="{contextMenu>depth}">
          <m:HBox renderType="Bare">
            <m:HBox renderType="Bare">
              <dev:DataExplorerIcon
                explorerType="{contextMenu>DataExplorerType}"
                explorerSubType="{contextMenu>DataExplorerSubType}"/>
              <m:Label
                text="{
                    path: 'contextMenu>',
                    formatter: '._navigationPathTitleFormatter'
                  }"
                class="c4sSmallTileHeaderTitle"/>
            </m:HBox>
          </m:HBox>
        </devEl:SmallBreadcrumbItem>
      </dev:items>
    </dev:SmallBreadcrumbs>
  </m:VBox>
</core:FragmentDefinition>

After:

<core:FragmentDefinition
    xmlns:core="sap.ui.core"
    xmlns:m="sap.m"
    xmlns:dev="sap.ead.c4s.ui.view.control"
    xmlns:devEl="sap.ead.c4s.ui.view.element"
    xmlns="http://www.w3.org/1999/xhtml"
>
  <m:VBox renderType="Bare" items="{
        path: 'contextMenu>/Info/Context',
        templateShareable: false
      }">
    <dev:SmallBreadcrumbs items="{
          path: 'contextMenu>',
          templateShareable: false
        }">
      <dev:items>
        <devEl:SmallBreadcrumbItem depth="{contextMenu>depth}">
          <m:HBox renderType="Bare">
            <m:HBox renderType="Bare">
              <dev:DataExplorerIcon
                                explorerType="{contextMenu>DataExplorerType}"
                                explorerSubType="{contextMenu>DataExplorerSubType}"
                            />
              <m:Label
                                text="{
                    path: 'contextMenu>',
                    formatter: '._navigationPathTitleFormatter'
                  }"
                                class="c4sSmallTileHeaderTitle"
                            />
            </m:HBox>
          </m:HBox>
        </devEl:SmallBreadcrumbItem>
      </dev:items>
    </dev:SmallBreadcrumbs>
  </m:VBox>
</core:FragmentDefinition>

Perceived issues:

  1. Starting in line 8, a tabWidth of 2 seems to be used.
  2. Surprisingly high indentations in lines 21 - 23, 25, 29, 30.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:22 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
kddnewtoncommented, Jan 25, 2020

Okay, I think what I’d like to go with is creating an --xml-whitespace-sensitivity option that has ignore, strict, and smart (or something like that. The first two are obviously far easier to implement (the last one requires a lot of knowledge about the schema and elements, I’m very interested in implementing it, but not as a first pass).

1reaction
winterkindcommented, Jan 22, 2020

@thorn0 I don’t think there is anything wrong with the HTML parser. To quickly show what I meant see here.

It is XML with a given default namespace and a Title tag inside that namespace. The HTML parser throws an error because it assumes this is the Title of HTML (that’s my guess at least). From my point of view that is okay because my content is not HTML but XML.

I liked your comment because it showed the effect that a whitespace option could have for our XML.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python 3.x - Confusing indentation issue - Stack Overflow
As the error says, your file is inconsistently uses tabs and spaces. The whole file has to consistently use the same one. –...
Read more >
Indent the first line of a paragraph - Microsoft Support
Select Format, and then choose Paragraph. On the Indents and Spacing tab, under Indentation, select First line. Select OK. Select OK again.
Read more >
Optional Braces - Scala 3 - EPFL
It is an error if the indentation width of some line is incomparable with the indentation width of the region that's current at...
Read more >
How to fix indentation Error in Python - Numpy Ninja
The indentation error can occur when the spaces or tabs are not placed properly. There will not be an issue if the interpreter...
Read more >
indent-checker - npm Package Health Analysis - Snyk
Learn more about indent-checker: package health score, popularity, security, maintenance, versions and more. ... No known security issues ... 0.4.0.
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