Home Download Buy Blog Forum Support

One file in two columns, each with different syntax coloring

One file in two columns, each with different syntax coloring

Postby shaun on Fri Oct 14, 2011 6:23 pm

Currently, if you have two views open for the same file, if you change the syntax coloring for one of the views, the other switches to match.
I would absolutely love to be able to set each view independently from the other.

My real-world example:
I've been working on a fairly large HAML document, and roughly half of the document is actually JavaScript which, of course, gets no coloring because it's inside a HAML document. It's a pain having to switch back and forth just to get the coloring, so I don't bother. But that feature would be a perfect solution.
shaun
 
Posts: 7
Joined: Fri Sep 30, 2011 4:52 pm

Re: One file in two columns, each with different syntax coloring

Postby iamntz on Fri Oct 14, 2011 6:28 pm

You can bind keys to quickly change syntax:

Code: Select all
{ "keys": ["alt+2"], "command": "set_file_type", "args":{ "syntax" : "Packages/HTML/HTML.tmLanguage" } },
{ "keys": ["alt+4"], "command": "set_file_type", "args":{ "syntax" : "Packages/CSS/CSS.tmLanguage" } }
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: One file in two columns, each with different syntax coloring

Postby warhammerkid on Sat Oct 15, 2011 4:45 pm

It should be possible to modify the HAML tmLanguage file to switch to javascript for the relevant code section. The HTML.tmLanguage file should give examples for switching to Javascript and switching to CSS for the relevant code blocks in HTML (script and style tags). This way, you could set it so that :javascript would automatically render the contained code the proper way. Whose HAML syntax config are you using?
warhammerkid
 
Posts: 3
Joined: Sat Oct 15, 2011 4:40 pm

Re: One file in two columns, each with different syntax coloring

Postby macula on Thu Apr 26, 2012 1:35 pm

I am just now trying Sublime and have been thrilled so far, except that the Ruby-HAML highlighter does not work properly. In particular, code within a :javascript scope (in other words: javascript code within a HAML file) is not highlighted properly.

This does not appear to be a problem with scope definitions in the bundle files because the very same bundle words well in TextMate and, surprisingly, the Alpha version of Chocolat.

Any suggestions? I am doing intensive HAML work these days and this could become a show-stopper for me.

And in general, does scoping work the way it works in TextMate? Or does Sublime have some catching up to do in that department?

Many thanks.
macula
 
Posts: 7
Joined: Thu Apr 26, 2012 1:30 pm

Re: One file in two columns, each with different syntax coloring

Postby macula on Thu Apr 26, 2012 4:56 pm

UPDATE!

The issue appears to be resolved in the latest dev channel release. Will repost if this is not the case, but until then, please consider the thread closed. Thank you.
macula
 
Posts: 7
Joined: Thu Apr 26, 2012 1:30 pm

Re: One file in two columns, each with different syntax coloring

Postby fredrikaustin on Sat Jun 02, 2012 1:25 am

Hi,

I'm still having this problem (javascript not syntax highlighting when in a .html.haml file), even using the latest dev channel build (2195) on osx.

I was originally using build 2185 I believe -- the default download. I followed instructions here ( https://github.com/n00ge/sublime-text-haml-sass ) to install the packages for syntax hilighting, which does color the haml source, but once you go into javascript, the syntax coloring is gone:

Screen Shot 2012-06-01 at 8.08.54 PM.png
syntax hilighting bug?
Screen Shot 2012-06-01 at 8.08.54 PM.png (26.91 KiB) Viewed 2045 times


To upgrade to the new dev version (build 2195) I did not reinstall these packages, since everything in ~/Library/App.../Sublime.../Packages is still of course there...

Thanks for any help! The editor is gorgeous, I hope I can resolve this issue...
fredrikaustin
 
Posts: 1
Joined: Sat Jun 02, 2012 1:14 am

Re: One file in two columns, each with different syntax coloring

Postby dentarg on Mon Jan 20, 2014 5:00 pm

You could try https://sublime.wbond.net/packages/Haml (https://github.com/phuibonhoa/handcraft ... ate-bundle). Install it from Package Control, search for "Haml". Works for me.

Would be nice to change the default to that, somehow.
dentarg
 
Posts: 6
Joined: Wed Mar 28, 2012 8:48 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Exabot [Bot] and 12 guests