Sublime Forum

New language files (xys) - a few problems

#1

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]<?xml version="1.0" encoding="UTF-8"?>

fileTypes xys name XYS patterns name variable.xys match \$[A-Za-z][A-Za-z0-9_]+ scopeName source.xys [/code]

I’m currently using the Mac Classic color theme and it contains this entry:

<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 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”.

<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

0 Likes

#2

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.

0 Likes

#3

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

0 Likes