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.

Tabs and spaces are mixed when `use-tabs: true`

See original GitHub issue

Hi, first of all thank you for the lib 👍

Issue

When I configured prettyhtml to useTabs it indents using tabs except for the HTML attributes. Attributes indented using spaces. Which I guess should be indented using tabs. See the example below.

Example

Ascii chars:

·  Represents a space char

 Represents a tab char

Options:

{
  useTabs: true,
  tabWidth: 2,
  printWidth: 80
}

Input:

<div class="test">
··<prism-editor
····class="my-editor"
····:code="code"
····@change="changeCode"
····language="html"
··/>
</div>

Expected Output:

<div class="test">
→   <prism-editor
→   →   class="my-editor"
→   →   :code="code"
→   →   @change="changeCode"
→   →   language="html"
→   />
</div>

Got:

<div class="test">
→   <prism-editor
→   ··class="my-editor"
→   ··:code="code"
→   ··@change="changeCode"
→   ··language="html"
→   />
</div>

you can also test it on prettyhtml.netlify.com

  • Click VUE example button
  • Click the Use Tabs option on the left
  • Click Run button on the top right

You should see that attributes are indented using spaces not with tabs.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
StarpTechcommented, Oct 1, 2018

The fix was released with prettyhtml@0.1.7

0reactions
kocacommented, Oct 1, 2018

🎉 🎉 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tabs and spaces are mixed with this code snippet. · Issue #188
... tabWidth: 4, useTabs: true };. What I did: Ran prettier-eslint . What happened: Tabs and spaces were mixed for indentation.
Read more >
What are the downsides of mixing tabs and spaces? [duplicate]
1. The first downside is that it quickly becomes a mess. One of the most used Visual Studio extensions is Productivity Power Tools....
Read more >
python - "inconsistent use of tabs and spaces in indentation"
If you mix tabs and spaces, it may break (see question) or look broken if you have other than 8-space expansion of tabs....
Read more >
Why do some people mix tabs and spaces in their code? - Quora
There are two things to consider when deciding whether to use tabs or spaces. Tabs take no more and generally less storage space...
Read more >
(Python) inconsistent use of tabs and spaces in indentation
The Python "TabError: inconsistent use of tabs and spaces in indentation" occurs when we mix tabs and spaces in the same code block....
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