Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Indention still doesn't work entirely as expected #44

Open
gu-stav opened this issue Dec 2, 2014 · 11 comments
Open

Indention still doesn't work entirely as expected #44

gu-stav opened this issue Dec 2, 2014 · 11 comments

Comments

@gu-stav
Copy link

gu-stav commented Dec 2, 2014

This issue was moved from atom/atom#4379.

Indention got much better in the latest releases, but consider the following HTML-Scenario:

<div>
  <a href="#"
     class="something"
     tal:repeat=""
     tal:condition="">Test</a>
</div>

When I copy the <a/> and paste it (2 empty spaces before), Sublime3 gives me (the expected result):

<div>
  <a href="#"
     class="something"
     tal:repeat=""
     tal:condition="">Test</a>

  <a href="#"
     class="something"
     tal:repeat=""
     tal:condition="">Test</a>
</div>

in Atom (OSX, 0.152) it becomes:

<div>
  <a href="#"
     class="something"
     tal:repeat=""
     tal:condition="">Test</a>
     <a href="#"
     class="something"
     tal:repeat=""
     tal:condition="">Test</a>
</div>

Auto-Indent is turned on for language-html. It's not about the <a/>-Tag - I can reproduce it with every other element aswell.

@winstliu
Copy link
Contributor

I can still reproduce this under latest master.

@winstliu winstliu added the bug label Apr 27, 2015
@muppetjones
Copy link

The indent problem is atom-wide (since 0.192 as far as I can tell): here.

@eviljoe
Copy link

eviljoe commented Oct 21, 2015

I also have problems with indenting HTML that contains tags that have line breaks in their opening tag. For example, have the following HTML:

<div>
    <div class="class1 class2" id="thatBrokenDiv"
        height="100" width="100">
    </div>
</div>

When I highlight it and use the Editor: Auto Indent command, I get the following result:

<div>
    <div class="class1 class2" id="thatBrokenDiv"
    height="100" width="100">
</div>
</div>

The inner div's closing tag is not indented enough. I make a lot of Angular templates which can sometimes involve a LOT of custom attributes specified on the opening tags. To keep my code clean, I wrap the tags at 120 characters. This causes no end of problems when I go to auto-indent my HTML templates.

@rodmax
Copy link

rodmax commented Jun 16, 2016

I use atom 1.7.4 and have the same with @eviljoe issue when I write tag's attributes in multiple lines.
The biggest problem as for me it's when a close tag has no the same indent with the open tag

Maybe someone can explain status regarding this issue

@winstliu
Copy link
Contributor

Maybe someone can explain status regarding this issue

No one (as far as I know) is actively working on this issue.

@revelt
Copy link

revelt commented Apr 19, 2018

To me this happens most often when I move chunks over lines and there are cheeky indentations above. For example:

move_lines_too

@dariosalvi78
Copy link

still happening in 2020. Any workaround?

@rodmax
Copy link

rodmax commented Feb 13, 2020

@dariosalvi78, in 2020 I highly recommend you to use vs code :)

For me now is no one reason to stay using atom

Regarding the issue, I made fork https://github.com/rodmax/language-html-custom

In which I quickly rewrite parser regexps
To satisfy my needs, but it seems, I broke php support and maybe something else

@dariosalvi78
Copy link

yeah, I have tried VS code for a while, indentation works better, but I still prefer Atom for its simple interface TBH. It's a pity something so basic like indentation doesn't work as it should. There's also Atom beautify but it didn't solve my problem.

@revelt
Copy link

revelt commented Feb 14, 2020

@rodmax In my humble opinion, VSCode is excels at JS/TS front-end development. But in writing JS programs, specifically, npm packages, Atom is superior, mainly because of stellar Atom plugin work done by steelbrain. For example, VSCode ESLint plugin can't whitelist ESLint rules for autofixing — one can't even use AVA in VSCode because of this. Atom on other hand can whitelist ESLint autofixing. Of course, it's better to switch to node-tap which has the global --only flag to toggle the test isolation feature and solves autofixing issue that way... Atom has its strengths.

@rodmax
Copy link

rodmax commented Feb 15, 2020

@revelt I assume that the atom has plugins that are better than the vscode counterparts, but i just mean the follow:

  • the vscode is much better almost in all base experience, i can describe a tons issue like you say about ESLint, where vscode better than atom (i personally use atom for front-end/python/shell-scripting several years, but migrate to vscode a year ago and very happy)
  • Regarding this issue, atom can not indent html, it is core feature, that's why I recommend to the issue author migrate to vscode, is the one "real fix" for that today

And the main point today it is support and community,unfortunately the atom is losing popularity

  • spikes on conference used vscode
  • python/rust/go/front-end/c programmers used vscode. Even JS programmers used code, due to great intellisense(by using TS server autcomplete/refactoring/navigation and many more)
  • all novice used vscode, as more known and popular

the formula is simple: the more people around the product the better

@dariosalvi78 you are right, vs-code by default have too many 🚥 enabled by default, personally i disabled all them and appearance looks like atom, simple and ascetic

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants