Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree wholeheartedly with the sentiment.

However, as I understand it, the issue is not so much with raw size (although it does not help) as it is with long lines.

For instance, the following 161K file freezes completely Atom, to the point that you just have to close it: https://github.com/espadrine/aulx/blob/master/html/tokenizer...

The reason is that the core syntax highlighter (https://atom.io/packages/language-javascript) is heavily unoptimized, and tries precomputing data for the whole line without considering that only the first 0.5k characters will probably be seen.

It is too bad, as this was already fixed globally in existing web text editors such as CodeMirror. Given that it is used in Chrome and Firefox' DevTools, and that JS minification happens on the Web, it had to.



> For instance, the following 161K file freezes completely Atom, to the point that you just have to close it:

I just downloaded it and you are correct, it locks up. Its the really long line here: https://github.com/espadrine/aulx/blob/master/html/tokenizer...

If I open it in Sublime 3 I see that they don't bother to syntax highlight long lines. They just skip it.

Issue filed:

https://github.com/atom/atom/issues/7444


I think you meant line 634, not 63. Also, pro-tip, always link to a specific file version when you're referencing a line because master will change:

https://github.com/espadrine/aulx/blob/b745723680f541353ad50...


thanks, it got accidentally chopped


> If I open it in Sublime 3 I see that they don't bother to syntax highlight long lines. They just skip it.

It appears that Sublime Text 3's threshold is 16384 (2^14) characters. Longer lines are not highlighted. Works quite well to be honest.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: