崇高文字2:根据上下文的不同语言高亮? (一拉Webstorm) [英] Sublime Text 2: Different language highlighting based on context? (a la Webstorm)
问题描述
我是看在 Egghead.io了解 AngularJS一些影片。的视频创作者使用Webstorm(而且,我相信,为他们工作)。一个特点我注意到的是,他可以设置不同的语法不同的作用域或引号内突出。所以,在code像下面这样(从AngularJS指令)
I was watching some videos on Egghead.io about AngularJS. The creator of the videos uses Webstorm (and, I believe, works for them). One feature I noticed is that he can set different syntax highlighting within different scopes or quotation marks. So, in code like the following (from an AngularJS directive)
return {
template: '<div>something</div>',
// ^^^ these guys ^^^
}
......他可以得到引号内突出的HTML。
...he can get the inside of the quotation marks to highlight as HTML.
我使用的崇高文字2 的,和我相当执着于它。是否有崇高的现有功能/插件,它能够处理这样的情况?如果没有,是用崇高文本2 API这样的事情技术上是可行的?
I use Sublime Text 2, and am fairly wedded to it. Is there an existing feature/plugin for Sublime that could handle a case like this? If not, is something like this technically possible using the Sublime Text 2 API?
推荐答案
我不认为它是内置的,但它肯定可以的。我一直在做的graphviz与一些工作,希望做同样的事情。标签可以像语法HTML生成。不管怎么说,我与 .tmLanguage
文件打得四处并且加入了全新的模式,以配合HTML哪里像条目是有效的情况下(我找标签= &LT;
)。我使用的捕捉模式都不甚理想,但它工作正常,我。这给我下,我认为这是类似于你在找什么。
I don't think it's built in, but it's certainly possible. I've been doing some work with graphviz and wanted to do something similar. Labels can be generated with html like syntax. Anyways, I played around with the .tmLanguage
file and added a new pattern to match the context where html like entries were valid (I look for label = <
). The patterns I used for the captures aren't that good, but it works for fine for me. This give me the following, which I think is similar to what you are looking for.
我不知道什么AngularJS,所以我不能帮你具体的东西,但它肯定是可能的。需要注意的是在下面的图片,最后&LT;表&gt;&LT; /表&gt;
只是表明,高亮不发生有
I don't know anything about AngularJS, so I can't help you with anything specific to that, but it is certainly possible. Note that in the image below, the last <table></table>
are just to show that highlighting doesn't occur there.
编辑:
忘了这个包含在原岗位,但这里是我更新tmLangauage文件。这第一个模式是我加入(链接)。我用 PlistJsonConverter 的JSON从去plist中,然后将文件保存为 .tmLanguage
。希望这有助于。
Forgot to include this in the original post, but here is my updated tmLangauage file. That first pattern is what I added(link). I used PlistJsonConverter to go from JSON to plist, then saved the file as .tmLanguage
. Hope this helps.
这篇关于崇高文字2:根据上下文的不同语言高亮? (一拉Webstorm)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!