How to make Zen Coding support JavaScript files in Sublime Text2?

旧时模样 提交于 2019-12-04 17:40:14

Open up Packages/ZenCoding/sublimezenplugin.py Right after `#########CONSTANTS#########, there should be:

HTML                      = 'text.html - source'
XML                       = 'text.xml'

Add the following:

JS                        = 'source.js'

Then scroll down to where it says:

ZEN_SCOPE = ', '.join([HTML, XML, CSS])

And change that to:

ZEN_SCOPE = ', '.join([HTML, XML, CSS, JS])

This will activate zencoding in JS files; however, beware that Zencoding will ALWAYS be active in js files. If you want to limit the scope to, say, strings in JS, you can change the scope. The scopes of JS strings is string.quoted.double.js for double quotes and string.quoted.single.js. You can add both of these to the JS = ... line. Feel free to experiment with the scope to fit it to your liking. For more info on scopes, check out the documentation on it here: http://readthedocs.org/docs/sublime-text-unofficial-documentation/en/latest/extensibility/syntaxdefs.html

Also, to see the current scope immediately under the cursor, the keybinding for Windows/Linux is ctrl+alt+shift+p and for OSX is alt+command+p.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!