【发布时间】:2015-08-22 03:00:06
【问题描述】:
是否有一些用于 angularjs html 模板的语法荧光笔?
例子
ng-click="someVariable"
我希望 someVariable 与"" 之间的其他字符串不同地突出显示,或者至少我希望 ng-someDirective 突出显示。
【问题讨论】:
标签: angularjs syntax-highlighting sublimetext3
是否有一些用于 angularjs html 模板的语法荧光笔?
例子
ng-click="someVariable"
我希望 someVariable 与"" 之间的其他字符串不同地突出显示,或者至少我希望 ng-someDirective 突出显示。
【问题讨论】:
标签: angularjs syntax-highlighting sublimetext3
我强烈推荐你使用这个包:
https://github.com/angular-ui/AngularJS-sublime-package
它为您提供自动完成功能和其他功能。
关于语法高亮,我有这样的:
您必须导航到安装文件夹中的 Packages 文件夹(我的是 /opt/sublime_text/Packages)。
然后您打开Color Scheme - Default.sublime-package(使用任何 ZIP 资源管理器),然后编辑 Monokai.tmTheme(或您正在使用的主题)。
你必须找到包含<string>Tag attribute</string>的标签,并在dict后面添加这个section部分:
<dict>
<key>name</key>
<string>Tag ng attribute</string>
<key>scope</key>
<string>entity.other.attribute-name.ng</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#FF6600</string>
</dict>
</dict>
您保存文件,然后重新添加到您的“ZIP”,这是一个 sublime-package 文件夹。
第 2 步:
做同样的事情,但是对于你的HTML.tmLanguage,在HTML.sublime-package里面。
在那里,你需要找到:
<key>tag-generic-attribute</key>
<dict>
...
</dict>
并在之后添加部分:
<key>tag-ng-attribute</key>
<dict>
<key>match</key>
<string>\b(ng-[a-zA-Z\-:]+)</string>
<key>name</key>
<string>entity.other.attribute-name.ng.html</string>
</dict>
再次保存,将其插入您的 sublime-package,然后瞧,删除 sublime 应用程序缓存,重新启动它,然后您就有了语法高亮。
请告诉我结果。 我在这个链接中得到了这个解释: https://groups.google.com/forum/#!topic/angular/qCGSZ6a6KVA
希望对你有帮助
【讨论】:
对于 sublime 3,您必须编辑 HTML.sublime-syntax 文件:
找到第 197 行“tag-id-attribute”和粘贴之前
tag-ng-attribute:
- match: \b(ng-[a-zA-Z\-:]+)
captures:
1: entity.other.attribute-name.ng.html
2: punctuation.separator.key-value.html
确保您没有标签。
然后转到文件底部和“-include:tag-id-attribute”之后 粘贴:
- include: tag-ng-attribute
【讨论】: