Autoclose-html package duplicates ending tags


#1

My Atom just updated to Atom 1.3.1.

Now if I’m editing an XHTML5 file I enter <p>, Atom places </p></p> after that. I don’t know how this got past testing, but this is pretty much a show-stopper bug—how can edit XHTML5 when Atom adds two ending tags every time I add an open one?


#2

So here’s the problem: I had autoclose-html installed, and I had disabled it, reenabled it, and then disabled it again. It was shown as disabled, but apparently Atom’s disable/enable mechanism is the real culprit here, because apparently autoclose-html was registered multiple times and was thus adding ending tags multiple times—even though that plugin was shown as disabled.


#3

Could you explain please how you found this out? Is there a type of package installation history somewhere?

Thanks!


#4

You can try this yourself:

  1. Install the autoclose-html plugin.
  2. Go to File > Settings > Packages and select Disable for the autoclose-html plugin, but do not restart Atom.
  3. Without leaving the window, select Enable for the autoclose-html plugin, but do not restart Atom.
  4. Open up an XHTML5 file and enter <p>. You’ll get </p></p> added for you automatically.

Repeat steps 2 and 3 to get lots of extra </p>s.


#5

Actually, Atom’s disable/enable mechanism depends on packages doing the right thing in their deactivate method, i.e. cleaning up after themselves and removing the things they add. If you take a look at the code in autoclose-html.coffee:

There is no deactivate method created and nothing is ever cleaned up. You should probably open a bug on the package to let them know they need to fix this :grinning:


#6

Thanks for looking into this. But (sigh) so many bugs to file that I haven’t got any work done this afternoon. I’m trying out Atom for editing XHTML5 files. But nothing works. No really—nothing.

  • linter-tidy doesn’t lint. (I’ve commented on the StackOverflow question someone had already filed.)
  • linter-htmlhint freaks out at an XML declaration of an XHTML5 file. (I filed two bugs, one for linter-htmlhint and another for htmlhint. At htmlhint they told me they don’t support XML.)
  • atom-beautify sees the XML declaration of an XHTML5 document, and indents the entire document! (I filed a bug.)
  • Now I just try to Toggle Soft Wrap in Atom, but 1) there’s no shortcut key, 2) there’s no notification in the menu that it’s turned on, 3) it is on a per-file basis, and 4) it isn’t “sticky” in that I have to go through the whole process everytime I start editing just to get things wrapped again. This has already been discussed, but nobody’s done anything about it.

(Whew.) I am positively tired of filing bugs today…


#7

My soft-wrap-indicator package solves the indication problem of whether a file has Soft Wrap turned on and also makes it easy to toggle by clicking the indicator in the status bar.

As far as “per-file” basis, if you want certain file types to be soft-wrapped by default then you can go into the settings for that package and check “Soft Wrap”. Here’s how I did that for Markdown files:

  1. Launch Atom
  2. Open the Settings View using Cmd+, on OS X or Ctrl+, on other platforms
  3. Click the Packages tab
  4. Search for language-gfm
  5. Click the Settings button on the language-gfm tile
  6. Scroll down to and check “Soft Wrap”

By default, all Markdown files will be soft wrapped after that.