# Setup test scaffolding
wget -O st_syntax_tests.tar.xz https://download.sublimetext.com/st_syntax_tests_build_4125_x64.tar.xz
tar xf st_syntax_tests.tar.xz
rm st_syntax_tests.tar.xz
mv st_syntax_tests PackagesProject
cd PackagesProject
git clone https://github.com/sourcegraph/Packages.git
mv Packages/.* Data/Packages/
mv Packages/* Data/Packages/
ln -s Data/Packages/TestDockerfile Dockerfile
rmdir Packages
On x86_64 Linux, you should be able to directly run ./syntax_tests
.
On a Mac, Docker is needed since the testing binary is only available for x86_64 Linux. Once Docker is running:
docker image build --platform linux/x86_64 --tag st-packages-tests .
docker run --platform linux/x86_64 st-packages-tests
If you want to log into the container and manually run the tests
docker run --platform linux/x86_64 --interactive --tty st-packages-tests /bin/sh
We are currently relying on Thom1729/Sublime-JS-Custom, which has significantly different syntax definitions from the upstream ones.
- Install Sublime Text.
- ⌘+Shift+P / Ctrl+Shift+P: Install Package Control
- ⌘+Shift+P / Ctrl+Shift+P: Package Control: Install Package -> JSCustom
- ⌘+Shift+P / Ctrl+Shift+P: JS Custom: Rebuild Syntaxes
- Run the
./update-js.sh
script (on Linux, you need to tweak the path to Sublime's packages).
When running into merge conflicts in the future, we should directly overwrite with the latest version of the syntax from Thom1729/Sublime-JS-Custom instead of trying to fix merge conflicts. Make sure to update the JavaScript/VERSION file as well.
- With a
.tmLanguage.json
,.tmLanguage.yaml
, or other, convert to.tmLanguage
first:- Install the PackageDev plugin in Sublime Text 3.
- Open the file with Sublime Text 3, press Cmd+Shift+P.
- Search for
PackageDev: Convert (YAML, JSON, PList) to
and selectConvert to: Property List
- Rename the file to just
.tmLanguage
instead of.tmLanguage.plist
(Sublime will not recognize it as a tmLanguage file otherwise). - Use Cmd+Shift+P and choose
Set Syntax: Property List (XML)
- Follow the steps below to convert the
.tmLanguage
to.sublime-syntax
- With a
.tmLanguage
file:- example: https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScript.tmLanguage
- Ensure it has exact
.tmLanguage
suffix, or else command will not be available. - Open the file with Sublime Text 3, press Cmd+Shift+P.
- Search for
Plugin Development: Convert Syntax to .sublime-syntax
command. - If nothing happens, see the console (Ctrl+`)
Your PR should include:
- A folder like https://github.com/slimsag/Packages/tree/master/GraphQL with the final
.sublime-syntax
file. - A
SOURCE
file with a URL where the syntax came from (e.g. link directly to the tmLanguage file on GitHub). - A
VERSION
file with the Git commit hash of the SOURCE. - An entry in the License table below, describing the license of the directory.
All contents are licensed under the following licenses, which allow for free commercial use and distribution of the files:
All files are licensed under the sublimehq/Packages MIT + Common License*, with different licenses for files generated by following the steps in a directory containing a SOURCE file:
This indicates a common license used in TextMate syntax/grammar bundles, which reads as follows:
If not otherwise specified (see below), files in this repository fall under the following license:
Permission to copy, use, modify, sell and distribute this software is granted. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.
An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”.
If an exception is made for the file we use, it must be noted as such in the table above.