syntax highlighting for gst files?

107 views
Skip to first unread message

chris

unread,
Feb 22, 2012, 5:20:07 PM2/22/12
to gosu-idea
Hi:

How/where do I go to set up syntax highlighting for gst files? Working
with ronin where most of the content is HTML and everything other than
reserverd words are in the default colour is kind of annoying.

Thanks

Chris

Dumitru Petrusca

unread,
Feb 22, 2012, 6:34:07 PM2/22/12
to gosu-idea
Highlighting seem to work for template files, I tried with this simple
example

<%@ params( myParam: String ) %>
Hello!
<%
var x: int = 100
if (x > 10) {
print( "wow " + myParam )
}
%>

and I see colors for strings, keywords, identifiers, etc. Do you not
get that?

The color settings are at: File->Settings->Editor->Colors & Fonts-
>Gosu.

Hope this helps,
Dumitru.

Carson Gross

unread,
Feb 22, 2012, 6:49:52 PM2/22/12
to gosu...@googlegroups.com
Chris is talking about highlighting-within-highlighting.

In many templating systems, you can have a template with multiple file extensions, and IntelliJ will properly highlight and enable editing in both language scopes.  As an example, if you edit Ruby On Rails templates that end in:

  some_template.html.erb

then, when you are in the template scope, you get HTML syntax highlighting and completion, and when you are in a scripting scope you get ruby highlighting and a very small amount of code completion.

I know we have something similar for the PCF editor, with embedded Gosu snippets, but this problem is more general: we should be able to detect the language for a given compound file ending, such as .javascript.gst or .xml.gst and support mixing the outer file types content with script components.

I recall looking into this at one point and finding there are two different APIs: one for embedding expressions within a broader context and one for more seamlessly mixing content.  The latter API was more difficult, but allows for this extremely nice mixing of languages within a template.

Anyway, Chris, unless you can find a hack work around, it might be a bit before you see this.  :)

Cheers,
Carson

Carson Gross

unread,
Feb 22, 2012, 6:57:46 PM2/22/12
to gosu...@googlegroups.com
This post may be relevant to the discussion:

  http://devnet.jetbrains.net/message/5450284#5450284

I *think* it was the com.intellij.psi.MultiplePsiFilesPerDocumentFileViewProvider API that allows you to do general language mixing, but looking at our code I'm not sure that's true.

Cheers,
Carson

Dumitru Petrusca

unread,
Feb 22, 2012, 7:10:48 PM2/22/12
to gosu-idea
Ok, got it, I though that basic Gosu highlighting does not work.

As for the fancy multi-psi-embed-any-way-you-want thing... it's just
not our top priority at the moment. If anyone of you Ronin guys want
to take a stub at it, you're more than welcome! We will provide all
the support necessary and make any low-level changes that might be
required.

Dumitru.
> > On Wed, Feb 22, 2012 at 3:34 PM, Dumitru Petrusca <dpetru...@guidewire.com

Carson Gross

unread,
Feb 22, 2012, 7:48:15 PM2/22/12
to gosu...@googlegroups.com
Maybe the Gosu plugin could get moved out to Github?  I know brian has some experience syncing with it...

Cheers,
Carson

Chris Gow

unread,
Feb 22, 2012, 8:53:33 PM2/22/12
to gosu...@googlegroups.com
That would be awesome. Certainly easier to contribute if it is
Reply all
Reply to author
Forward
0 new messages