HTML file won't syntax-color (but others will)


#1

I have a file that always comes up in Atom with no syntax coloring, even though it’s HTML. Other sample files do get colored appropriately.

  • The file extension was not originally .html, but I changed that and nothing changed.

  • I’ve tried taking the HTML DOCTYPE and/or XML declaration in and out; also no difference.

  • The file is UTF-8, but that doesn’t seem to be the issue either. I tried saving the problem file as Latin-1 instead, and it still wouldn’t colorize; and I tried saving my trivial sample file as UTF-8, and it still did colorize.

For both files, the filetype in the Atom window footer says “HTML”, and resetting it to HTML again, or XML, or the various HTML (xxx), also makes no difference.

I also tried opening the other file (in BBedit and emacs) and re-saving; also no difference.

So then I tried using “head -n xxx” from bash to copy portions of the problem file to another file – these all work, even when I copy the entire file that way.

However, if I copy with “cp”, the copy does NOT work.

Since this is a Mac, I also checked “ls -l@” for extended attributes, and these appear on some of the files but not others:

com.apple.FinderInfo	  32B
com.apple.TextEncoding	  15B

But I have cases both with and without those extended attributes, that both work and fail.

Oh, this is with a fresh install of 1.13.1 x64.

I’ve checked for similar topics on here, stackexchange, and just Google, to no avail.

Anyone have a clue what this might be?


#2

Is the file very large? I’ve seen Atom refuse to highlight a file of extreme length, and it didn’t immediately start highlighting it when I replaced the text with something much shorter.

Have you tried closing the file, then closing Atom, then reopening Atom and looking at the file?


#3

File is about 2MB. Definitely tried opening/closing/restarting. I think you’re right that it’s related to length – I just tried cutting the file shorter and shorter (using another editor, then saving and reloading in Atom). When I got a little below 32767 lines it suddenly started highlighting. Though oddly, when I undid the last couple cuts, it could highlight; so maybe something is being cached, too.

Ahhh well, looks like sticking to small files for the present.

Thanks!


#4

Atom has a bit of a clunkiness problem. It executes so much stuff on an open file that it has a few safeguards to help cut off situations where it could bog down your system or crash.