The build system setting is automatically selected based on the file extension

I created a new build system to run GolfScript programs. The definition is as follows:

{ "cmd": ["ruby", "D:\\w\\sublime\\golfscript.rb", "$file"] } 

This works, but I need to manually switch the Build System from "Automatic" to "golfscript" whenever I need to use this, and then switch it to be able to run Ruby, Python, etc.

I want my build system to be automatically applied when I have a *.gs file *.gs .

I read several docs and got the idea that I can use a selector to achieve this, so I added a selector to the existing configuration:

 { "cmd": ["ruby", "D:\\w\\sublime\\golfscript.rb", "$file"], "selector": "source.gs" } 

After reading even more documents / examples, I could not figure out how to talk about what the selector actually has.

How to configure the source.gs selector to point to *.gs files?

+6
source share
1 answer

You need to create a syntax file for GolfScript.

Save the following XML as golfScript.tmLanguage and place it in the Packages/Golfscript folder as described here .

You may need to restart ST.

 <?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> <dict> <key>fileTypes</key> <array> <string>gs</string> </array> <key>name</key> <string>GolfScript</string> <key>patterns</key> <array> </array> <key>scopeName</key> <string>source.gs</string> <key>uuid</key> <string>c4c7fc10-d937-4f5d-9cb7-4316026457e5</string> </dict> </plist> 
+2
source

Source: https://habr.com/ru/post/949469/


All Articles