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 ^^^
}
...he can get the inside of the quotation marks to highlight as HTML.
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?
Sublime Text 3 is a very flexible text editor with a lot of helpful features. One of those features is called “Syntax Highlighting”. Syntax Highlighting applies colours to syntax within your code to make it easier to see what certain parts of the code mean at a quick glance.
Package Control is a package manager for Sublime Text that makes it simple to find, install and keep packages up-to-date. 2. Install ‘PackageDev’ Package PackageDev is a Sublime Text package that helps create and edit syntax definitions, snippets, completions files, build systems and other Sublime Text extension files. 3.
Sublime text support most of the popular language. In order to see the list of language you can click on bottom left corner. How can I provide input for a program that I run using Sublime Text Build System? you can goto Tools->Build System->New Build System.
While editing in Sublime Text, you can check what scopes have been applied to the text under the caret by pressing control + shift + p (Mac) or ctrl + alt + shift + p (Windows/Linux). The string context has two patterns: the first matches a backslash character followed by any other, and the second matches a quote character.
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.
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.
Edit:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With