Sublime Forum

CSS3 2.0.0 - Rewritten from scratch in sublime-syntax format

#1

I rewrote CSS3 from scratch for the new sublime-syntax system. The result is night-and-day better than v1.0. I will make the claim that this is the definitive CSS package for Sublime.

https://packagecontrol.io/packages/CSS3

Here’s the changelog:

  • complete rewrite using the new sublime-syntax system
  • fixed countless highlighting bugs
  • removed W3C validator for performance (will return as separate package)
  • removed backtracking regexes for performance
  • much, much faster
  • updated for latest changes to the specs
  • CSS variables
  • HTML5 custom element selectors
  • added exhaustive completions
  • increased specificity of completions (less noisy)

I went through 40+ W3C specs and implemented custom regexes for 400+ properties. Every property, value, @-rule, and function now has comprehensive completions. The finished language definition came in at about 9600 lines. This makes it one of the largest, if not the largest, definition for any language. The main reasons CSS3 is so huge is because of A) CSS is a gargantuan language, and B) I only wanted valid CSS values to be highlighted. In other words, if you mistype a property value, it shouldn’t be highlighted. I had to write regexes for each of the 400+ CSS properties to make that happen. That sucked hard, but the result is a big win for productivity.

Despite its size, version 2.0 is MUCH faster than 1.0 thanks to the new regex engine. It used to take a second or two for the syntax highlighting to be applied to large CSS files. Now it typically takes less than 100ms.

The new sublime-syntax system was a dream to work with compared with the old TextMate garbage. My hat’s off to the Sublime Text authors for such a nice language definition system. Package authors: if you haven’t made the leap to sublime-syntax yet, it’s well worth the effort.

I’m really happy with how everything turned out, but here’s a confession: I don’t write CSS professionally. If some of you front-end wizards would try it out and send me bug reports, I’d really appreciate it.

Thanks!

12 Likes

#2

I hope you can make some contributions to Sublime’s Default CSS Package to make it better using what you’ve done and learnt.

3 Likes

#3

I’ll take a look at it. I could probably boost the property list without too much trouble. Adding completions for all those properties would take some time, though. The default CSS package has been improved a lot, due to wbond and others’ work, but it’s almost a full-time job to stay on top of all the changes (more than 40 specs being updated constantly).

1 Like

#4

@y0ssar1an You might want to update the info on package control to ST3 only support, as the new *.sublime-syntax is not supported in ST2. Apart from that, I’m seconding the request above. Keep up the good work.

0 Likes

#5

Big THANKS for your effort! You did a very good job on that package. Well done :slight_smile: Guys like you make sublimetext to what it is :slightly_smiling:

2 Likes