ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

SML (Standard ML)

by seanjames777 ST2/ST3

Resources for Standard ML in Sublime Text 2, including syntax highlighting, a build system, and snippets.

Details

  • 2014.09.03.16.02.39
  • github.​com
  • github.​com
  • 3 years ago
  • 54 minutes ago
  • 5 years ago

Installs

  • Total 12K
  • Win 5K
  • OS X 5K
  • Linux 2K
Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29
Windows 2 1 2 2 0 0 2 2 4 1 0 2 3 4 1 2 4 4 1 8 7 3 6 6 5 0 8 2 1 4 2 5 4 1 4 2 2 5 5 2 0 4 7 3 4 4
OS X 0 1 4 1 1 3 1 3 5 4 1 1 1 2 9 5 6 3 1 1 1 5 5 3 2 2 8 7 2 1 4 0 3 1 5 2 1 4 4 4 6 3 5 2 2 1
Linux 0 2 0 0 1 1 0 3 0 0 1 0 2 0 0 1 2 0 2 1 1 1 3 0 1 1 1 1 1 3 1 0 3 1 2 0 3 0 1 2 1 2 1 3 6 1

Readme

Source
raw.​githubusercontent.​com

SML

A set of Sublime Text 2 resources for SML (Standard ML).

If you had previously installed this package into your “Packages/User”, you should consider reinstalling as described below to get future updates.

Included:

  • Language definition for SML. Provides syntax highlighting in Sublime Text 2 and TextMate
  • Snippets for common SML constructions: 'let', 'case', 'fun', 'fn', 'structure', etc
  • Example theme “Son of Obsidian” that works with the SML language definiton
  • Build system: will run SML and CM files within Sublime

Installation:

The best way to install is to install the Package Control package and search for “SML”. Package control will automatically update your copy of this package when you start Sublime. To install using Package Control, press Control/Command+Shift+P in Sublime, type “Install Package”, then search “SML (Standard ML)”.

Another good way would be to clone the git repository directly inside your Sublime “Packages” directory. Due to the unfortunate naming of the git repo, you will need to clone into a specifically named directory for the build system to work:

git clone https://github.com/seanjames777/SML-Language-Definition.git “SML (Standard ML)”

This way, you'll be able to “git pull” to update the package, and Sublime will see the changes immediately. You can use the Preferences>Browse Packages menu within Sublime to get to the Packages directory.

Otherwise, clone elsewhere and copy the files into a folder called “SML (Standard ML)” in the Packages directory.

Features:

Syntax highlighing should work automatically with “.sml”, “.ml”, “.cm”, and “.sig” files. The .tmLanguage file should also work with TextMate to provide syntax highlighting.

Snippets will be available for all of the above file types. A full list can be found through the Tools>Snippets command. To use a snippet, start typing the name and press tab when the autocomplete window suggests the snippet. Currently included snippets are: 'case', 'datatype', 'fn', 'fun', 'functor', 'if', 'let', 'signature', 'structure', and 'val'.

The example theme will be available under Preferences>Color Scheme. The example theme is an example of how to create a theme that matches SML. Most existing themes should work as this package uses a common naming scheme. This example .thTheme should also work with TextMate.

The build system will use the “sml” command to execute the file currently being edited. You can also directly run CM files to use the compilation manager. The build system can be started with F7 or Control/Command+B.

On a Mac, the build system will attempt to locate SML and execute it. It will be able to find SML if it was installed via Macports or the SML installer package, or if it was installed in “/usr/bin”, “/bin”, etc. Check the “sml_mac.sh” file for a full list of locations. It will also be able to find SML if it is available on your PATH variable.

On Linux, the build system will be able to locate SML if it is available on your PATH variable.

On Windows, the build system executes the “sml.bat” file installed by the SML installer. This file should be on the PATH, so should work automatically.

The build system captures error output with a regular expression, so double clicking on an error in the output window will take you to the file and line on which the error occured. Alternatively, use F4 and Shift+F4 to cycle through errors.

Troubleshooting

First, try closing all files, quitting Sublime, deleting the .cache files in the “SML (Standard ML)” directory under “Packages”, and starting Sublime. Then reopen any files.

If your copy of the package is still not working and was installed via Package Control, start by attempting to upgrade the package. Press Command/Control+ Shift+P and search for “upgrade”.

If an upgrade does not fix the problem, try to uninstall and reinstall via Package Control.

Finally, consider opening an issue on GitHub.

Development:

Feel free to fork and contribute to this package. Any additions are appreciated.

If you intend to edit the package and have installed it via Package Control, you should switch to install option two above (clone the git repo) to avoid having your changes overwritten. You may need to uninstall the package in package control.

.JSON-* files can be used to generate the .tm* files and vice versa, if you prefer to work with JSON. You will need the “AAAPackageDev” package for the JSON build to work. Note that this package uses the .tm* files and excludes JSON files, so be sure to build the .tm files and don't commit the JSON files.

Also be sure not to commit .cache files.

Originally written by Sean James, while taking 15210 at Carnegie Mellon.