A couple of things about creating a new scheme

Discussion Forums discussion A couple of things about creating a new scheme

This topic contains 0 voices and has 3 replies.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
February 23, 2011 at 4:09 pm #5209

CapsAdmin
Member

I made a scheme for garrysmod lua (AKA glua), which is basically lua but with libraries and a few additions to the syntax rules

One of the things I’ve noticed is that I can’t save a modified scheme from PN, but I can save the style file.

My problem here is that I’m trying to make a highlighter only for glua. So if I make a style and use that it will affect all other schemes. Is there a way around this?

Another thing is this

<style name="String" key="6" fore="b3b1a6"/>

<style name="_string" key="10" fore="b3b1a6" />

<style name="_string" key="11" fore="b3b1a6" />

How can I make the key 10 and 11 point to key 6 without making entries in the menu?

It would be nice to have it so the syntax colors update in real time after you’ve set the colors in options.

March 3, 2011 at 11:12 pm #17670

simon
Key Master

Please post the scheme you’ve made and I’ll see what’s going on.

March 6, 2011 at 6:23 pm #17671

CapsAdmin
Member

http://pastebin.com/qsSUjVXy

I want to make this highlighter have its own style for glua only without making a new style that will affect other highlighters. It works fine and, it just has a few niggles. I want to have one color for all comments, instead of defining the same color 3 times. Same with strings.

It also seems like it’s parsing the scheme file every time I open a lua file (3 ish seconds). Shouldn’t it only need to parse it once?

March 8, 2011 at 9:00 am #17672

simon
Key Master

thanks, the easiest way to do the shared colourings is to use the built-in shared classes. So you have this:

<style name="Default" key="32" fore="FAFAFA" back="2e2e2e" font="Consolas" size="8"  />
<style name="Whitespace" key="0" fore="FAFAFA" back="2e2e2e" font="Consolas" size="8" />

<style name="Comment" key="1" fore="b3b1a6"/>
<style name="Comment2" key="2" fore="b3b1a6"/>
<style name="Comment3" key="3" fore="b3b1a6"/>

<style name="Number" key="4" fore="dada25"/>
<style name="Keyword" key="5" fore="5c89c5"/>
<style name="String" key="6" fore="b3b1a6"/>
<style name="String2" key="10" fore="b3b1a6" />
<style name="String3" key="11" fore="b3b1a6" />

<style name="Meta" key="13" fore="ab74b5"/>
<style name="Library" key="14" fore="ec68a0"/>
<style name="Global" key="15" fore="37a9a9"/>
<style name="Enumuration" key="16" fore="cdac5d"/>

I would change that to this:

<style name="Default" key="32" />
<style name="Whitespace" key="0" />

<style name="Comment" key="1" class="comment"/>
<style name="Comment2" key="2" class="comment"/>
<style name="Comment3" key="3" class="comment"/>

<style name="Number" key="4" class="number"/>
<style name="Keyword" key="5" class="keyword"/>
<style name="String" key="6" class="string"/>
<style name="String2" key="10" class="string" />
<style name="String3" key="11" class="string" />

<style name="Meta" key="13" fore="ab74b5"/>
<style name="Library" key="14" fore="ec68a0"/>
<style name="Global" key="15" fore="37a9a9"/>
<style name="Enumuration" key="16" fore="cdac5d"/>

I’d possibly also try to fit those last four into classes too (see master.scheme). Classes mean that the same style configuration is used across all of the schemes, so that if I apply a color theme you automatically get the same keyword coloring in glua as you do in C++. The same goes for the reason I removed font configuration from default/whitespace – these should be set by the editor rather than the scheme.

There is one other way to group like styles, which is to use a style group:

<group name="Comments" description="Comments" class="comment">
<style name="Comment" key="1" />
<style name="Comment2" key="2" />
<style name="Comment3" key="3" />
</group>

This is less thoroughly tested than the main class mechanism, but may do what you want.

Finally, the scheme file should only be being parsed once as they are turned into compiled schemes (see the .cscheme files in your user settings directory). It’s possible that ctags is taking a long time to invoke on your file, or that you have another corrupt scheme file lying around. Do you see the .cscheme files being updated all the time?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.