deadfoxygrandpa / Elm.tmLanguage

Elm language syntax highlighting and tool integration for ST2/3
https://packagecontrol.io/packages/Elm%20Language%20Support
MIT License
122 stars 27 forks source link

Add GLSL syntax? #16

Closed deadfoxygrandpa closed 9 years ago

deadfoxygrandpa commented 9 years ago

@evancz

On a local branch I just added support for GLSL syntax, which I didn't have before. Anything inside a GLSL block gets highlighted according to whichever GLSL syntax highlighting plugin you have installed, if any. If you don't have a GLSL syntax highlighting plugin, it doesn't do any highlighting at all inside a GLSL block. (This is the current behavior even if you do have a GLSL highlighting plugin installed)

Do you think this is a bad idea? I know you don't seem to be a fan of special cases like this, in general...

evancz commented 9 years ago

I think my personal preference is for less, but @kfish has done more work with GLSL in Elm by doing elm-shadertoy so I'd be curious what he thinks.

I feel I could go either way on this one. Perhaps if the open and close symbols were strong, it would feel less confusing. Not really sure.

deadfoxygrandpa commented 9 years ago

This is what the current behavior always is: glsl3 This is what my local branch now looks like if you don't have a GLSL plugin installed: glsl2 And this is what it looks like if you do have a GLSL plugin installed: glsl

evancz commented 9 years ago

+@johnpmayer

With short shaders like this, I prefer the no color one because it does not make me think there is a new Elm declaration on every line. I think in larger shaders, it'll become more pleasant. @kfish will probably know better, or have some examples to try out in elm-shadertoy.

deadfoxygrandpa commented 9 years ago

The other thing is, if you don't want the extra highlighting, you could always just not install an extra plugin. GLSL syntax isn't supported by Sublime Text out of the box.

deadfoxygrandpa commented 9 years ago

I decided to go ahead with this change for now. I like it locally, with the shaders I've been writing. I'm still open to the idea of removing it later.

johnpmayer commented 9 years ago

I remember using an emacs package which only highlighted the syntax of the language where your cursor was. Normally, html would be highlighted and Javascript would be gray. However, if your cursor was within a script tag, the JavaScript would be highlighted, and the outside html would be gray.

I think it was called multi-html-mode On Dec 11, 2014 1:45 AM, "Alex Neslusan" notifications@github.com wrote:

Closed #16 https://github.com/deadfoxygrandpa/Elm.tmLanguage/issues/16.

— Reply to this email directly or view it on GitHub https://github.com/deadfoxygrandpa/Elm.tmLanguage/issues/16#event-205987781 .

deadfoxygrandpa commented 9 years ago

I was just thinking that this wouldn't be possible in Sublime Text, but this plugin makes it seem possible with the right tricks! I think it's a pretty cool idea.

evancz commented 9 years ago

Whoa, that'd be pretty cool!

kfish commented 9 years ago

@evancz I prefer to keep shaders in separate files anyway just to keep that logic separate from the shapes and physics. As a result it's not too confusing to have syntax highlighting on the shader also.

deadfoxygrandpa commented 9 years ago

@johnpmayer I just got that context-sensitive highlighting thing working in one direction. Now I can gray out GLSL when you're not inside a GLSL block, and restore the highlighting when you are. This is pretty cool.

deadfoxygrandpa commented 9 years ago

Here it is so far, in animated GIF action: glsl

deadfoxygrandpa commented 9 years ago

This is cool. Thanks for the idea, John. glsl2

johnpmayer commented 9 years ago

This is legit On Dec 12, 2014 11:15 AM, "Alex Neslusan" notifications@github.com wrote:

This is cool. Thanks for the idea, John. [image: glsl2] https://camo.githubusercontent.com/6a3b934cb66f43cdd953e4a729b7279f11f74e96/687474703a2f2f692e696d6775722e636f6d2f73536b716d37532e676966

— Reply to this email directly or view it on GitHub https://github.com/deadfoxygrandpa/Elm.tmLanguage/issues/16#issuecomment-66794241 .