Sublime Forum

Question regarding Scheme support


Using Scheme with Sublime Text 3 I have a couple issues:

  1. The package doesn’t recognize some file extensions, like *.sls, that are associated with different kinds of Scheme scripts, depending the RnRS version. I’d like to know how to associate such file extensions with the Scheme package, so I don’t have to do it manually every time I open one.

  2. The package flags brackets, when used instead of parentheses, as erroneous red background. It’s very common for Scheme scripts to use [] in some places instead of () for readability. Without getting into whether this makes Scheme code more readable (an arguable point), the fact the package makes brackets look hideous definitely hurts readability. :slight_smile:

I looked at Scheme specific settings but they are aimed at overriding general text settings, and didn’t offer any specific settings that jumped out at me as addressing either issue.



If you have a file (that has the Scheme syntax applied) currently open in ST and has focus, then all you have to do is go to Preferences -> Settings - Syntax Specific from the main menu and paste in the following

	    "extensions": ["sls"],

This would then associate files having sls extensions to the Scheme syntax and you don’t have to then manually apply it everytime.

It’s possible the syntax is scoping [] as invalid.illegal causing the red background. You’ll either have to open an issue (I have no idea about Scheme) on the package that provides the syntax or modify the syntax yourself to remove it.



Regarding adding extensions, it worked when I added “*.sls” as the pattern—thanks!

How would I modify the Scheme package syntax itself? I didn’t find a way to open it in the editor itself via the menu so I’m guessing I’ll have to spelunk the directory where user packages are installed internally to modify it, right? I didn’t find it in the installation/Packages directory—the files there seem to be binary (I’m guessing zip files).



Regarding that, you can use View Package File from the command palette to view package resource files (in this case, resource files offered by Scheme). So for example, in this case you wish to modify a syntax file, you would search for something like <Package Name>/name of the resource file. If the package name is Scheme, then Scheme/Scheme.tmLanguage or Scheme/Scheme.sublime-syntax (depending on whether it is using the old syntax schema or the new one).

Once you know the file, all you have to do is create an override (meaning, you need to create a Scheme directory within the Packages directory and create that same syntax file (name and all), paste the contents of the original file and modify however you like. In this case, ST will give precedence to your override file than the installed one)



OK so I was able to view the Scheme .tmLanguage file, and it seems Sublime created the override file in the right place for me.

I think the following section is where valid parentheses are defined:


I’m guessing the regex in the string value for ‘match’ is what needs to be amended somehow to treat brackets properly. I will play with this to see if this is how I can fix the problem I’m seeing.