autoclose-html icon indicating copy to clipboard operation
autoclose-html copied to clipboard

Extra Indentation on close tag

Open TruRooms opened this issue 5 years ago • 9 comments

Atom: 1.32.0 OS: Mac OS High Sierra 10.13.6 Autoclose HTML: 0.23.0

When creating a new html block, the closing tag indentation is always one indent unit whether set to 2 or 4 spaces. Problem did not appear using earlier versions of Atom and began after an auto update.

Example:

<div class="row">
  <div class="col-xs-12">
  </div>
</div>

appears as

<div class="row">
  <div class="col-xs-12">
    </div>
  </div>

When using 2 spaces for the default indentation level.

It appears the offending lines are in autoclose-html.coffee#177:

        if not isInline
            editor.insertNewline()
            editor.insertNewline()
        editor.insertText('</' + eleTag + '>')

It appears the double new line on my specific machine is not resetting the indentation level.

TruRooms avatar Oct 30 '18 17:10 TruRooms

Was able to solve by having the editor backspace in between the new lines.

editor.insertNewLine()
editor.backspace()
editor.insertNewLine()

TruRooms avatar Oct 30 '18 17:10 TruRooms

I was looking at an issue with another atom package, and the culprit there was having Tree Sitter Parsers enabled. When I disabled that option (Settings -> Core -> Use Tree Sitter Parsers), this annoying indentation problem also disappeared.

agentlogic avatar Nov 08 '18 13:11 agentlogic

Was able to solve by having the editor backspace in between the new lines.

editor.insertNewLine()
editor.backspace()
editor.insertNewLine()

Experiencing the same issue and this workaround fixed it for me as well.

seanhuber avatar Nov 18 '18 02:11 seanhuber

@TruRooms Please make a fork and upload this to Atom!

CoWinkKeyDinkInc avatar Nov 25 '18 04:11 CoWinkKeyDinkInc

@seanhuber I have also found this problem!

linjialiang avatar Dec 23 '18 04:12 linjialiang

@mattberkowitz @CoWinkKeyDinkInc The problem has been generated #210

linjialiang avatar Dec 23 '18 04:12 linjialiang

Atom: 1.32.0 OS: Mac OS High Sierra 10.13.6 Autoclose HTML: 0.23.0

When creating a new html block, the closing tag indentation is always one indent unit whether set to 2 or 4 spaces. Problem did not appear using earlier versions of Atom and began after an auto update.

Example:

<div class="row">
  <div class="col-xs-12">
  </div>
</div>

appears as

<div class="row">
  <div class="col-xs-12">
    </div>
  </div>

When using 2 spaces for the default indentation level.

It appears the offending lines are in autoclose-html.coffee#177:

        if not isInline
            editor.insertNewline()
            editor.insertNewline()
        editor.insertText('</' + eleTag + '>')

It appears the double new line on my specific machine is not resetting the indentation level.

The problem is at line #117, not #177.

WillyT59 avatar Feb 19 '21 14:02 WillyT59

Atom: 1.32.0 OS: Mac OS High Sierra 10.13.6 Autoclose HTML: 0.23.0 When creating a new html block, the closing tag indentation is always one indent unit whether set to 2 or 4 spaces. Problem did not appear using earlier versions of Atom and began after an auto update. Example:

<div class="row">
  <div class="col-xs-12">
  </div>
</div>

appears as

<div class="row">
  <div class="col-xs-12">
    </div>
  </div>

When using 2 spaces for the default indentation level. It appears the offending lines are in autoclose-html.coffee#177:

        if not isInline
            editor.insertNewline()
            editor.insertNewline()
        editor.insertText('</' + eleTag + '>')

It appears the double new line on my specific machine is not resetting the indentation level.

The problem is at line #117, not #177.

I forked the code, added the above correction. My repo is here:

https://github.com/Ordinal-Data-Inc/autoclose-html.git

The README.md in my repo has the (temporary) installation instructions to the updated code. Hopefully this will be included in an upcoming update to main.

WillyT59 avatar Feb 19 '21 19:02 WillyT59

This package is no longer being maintained. However, my fork shouldn't have the issue described, and is a published package: https://github.com/binaryfunt/autoclose-html-plus

binaryfunt avatar Feb 21 '21 16:02 binaryfunt