Home Download Buy Blog Forum Support

New language files (xys) - a few problems

New language files (xys) - a few problems

Postby highend on Fri Jan 20, 2012 3:36 pm

Hi,

I discovered Sublime Text yesterday and it has a few features that I really like (and that are missing in other text editors).
So I want to extend it a bit and because I'm writing *.xys scripts most of the time (these belong to XYplorer, a very good
file manager with scripting capabilities) I'd like to add the necessary files to Sublime Text.

The first minor problem:

A part of the XYS.tmLanguage file:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>fileTypes</key>
   <array>
      <string>xys</string>
   </array>
   <key>name</key>
   <string>XYS</string>
   <key>patterns</key>
   <array>
      <dict>
         <key>name</key>
         <string>variable.xys</string>
         <key>match</key>
         <string>\$[A-Za-z][A-Za-z0-9_]+</string>
      </dict>
   </array>
   <key>scopeName</key>
   <string>source.xys</string>
</dict>
</plist>


I'm currently using the Mac Classic color theme and it contains this entry:
Code: Select all
      <dict>
         <key>name</key>
         <string>Variable</string>
         <key>scope</key>
         <string>variable.language, variable.other</string>
         <key>settings</key>
         <dict>
            <key>fontStyle</key>
            <string>italic</string>
            <key>foreground</key>
            <string>#1209030</string>
         </dict>
      </dict>


I've read the documentation for "Scopes" and I hope I got it right.

What I expect to see: Every variable ($xxx) should have a brown text color and an italic font style but
none of the variables in a .xys script is colored in that way. I have a few more <dict> entries in tmLanguage
file and those are working fine.
It it a regex problem?

Second problem:
I've created a snippet, saved under "D:\Users\Highend\Tools\Sublime Text\Data\Packages\XYS\if.sublime-snippet".

Code: Select all
<snippet>
   <description>Case Expression</description>
   <content><![CDATA[
if(){
   $
}
]]></content>
   <tabTrigger>if</tabTrigger>
   <scope>source.xys</scope>
</snippet>


If I type "if" I get the tooltip with e.g.: "if Case Expression" but hitting return or tab deletes the if and doesn't
replace it with the full snippet expression.

Please bare with me, the learning curve of Sublime Text seems a bit steep for the beginner (especially if english isn't your motherlanguage)...

Regards,
Highend
highend
 
Posts: 94
Joined: Fri Jan 20, 2012 2:47 pm

Re: New language files (xys) - a few problems

Postby jps on Sat Jan 21, 2012 3:14 am

Your scope is "variable.xys", while the selector is "variable.language, variable.other": this won't match. One option is to change your assigned scope to "variable.other.xys", which will then match the selector.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: New language files (xys) - a few problems

Postby highend on Sat Jan 21, 2012 11:23 pm

Thank you, jps.

After changing the scope name it works as expected.

I was able to fix the snippet as well and btw, snippets with the possibility to jump to different positions via tab are just _awesome_.

Regards,
Highend
highend
 
Posts: 94
Joined: Fri Jan 20, 2012 2:47 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 11 guests