Sublime Forum

One file in two columns, each with different syntax coloring

#1

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.

0 Likes

#2

You can bind keys to quickly change syntax:

{ "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" } }

0 Likes

#3

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?

0 Likes

#4

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.

0 Likes

#5

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.

0 Likes

#6

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 ( 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:


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…

0 Likes

#7

You could try 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.

0 Likes