Home Download Buy Blog Forum Support

Switching syntax within one file

Switching syntax within one file

Postby Jens on Mon Mar 17, 2014 4:13 am

Is it possible with Sublilme to get it to recognize different parts of the one file as being different languages that require different syntax formats.

I have HTML files with embedded javascript (within <script> </script> tags) and also C# code within defined tags.

I know that I can switch language on the fly, but it is a bit tedious if your are moving from one to the other and back all of the time.
Posts: 1
Joined: Mon Mar 17, 2014 4:06 am

Re: Switching syntax within one file

Postby skuroda on Mon Mar 17, 2014 5:42 am

Yes it is possible. As you've pointed out, you can nest JavaScript syntax within HTML files. You need to edit the tmLanguage file. You will define a start and end pattern, and include the relevant scope. You may want to reference here and here. You may also want to investigate how HTML includese JavaScript syntax as a guide.
Posts: 692
Joined: Fri Oct 05, 2012 8:11 am

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 25 guests