Skip to content

Latest commit

 

History

History
165 lines (136 loc) · 15.7 KB

MakingChanges.md

File metadata and controls

165 lines (136 loc) · 15.7 KB

Making Changes

Cloning the project

# 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

Running tests

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

Updating JS/JSX/TS/TSX syntax definitions

We are currently relying on Thom1729/Sublime-JS-Custom, which has significantly different syntax definitions from the upstream ones.

  1. Install Sublime Text.
  2. +Shift+P / Ctrl+Shift+P: Install Package Control
  3. +Shift+P / Ctrl+Shift+P: Package Control: Install Package -> JSCustom
  4. +Shift+P / Ctrl+Shift+P: JS Custom: Rebuild Syntaxes
  5. 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.

Adding a new language

Find an open-source .tmLanguage or .sublime-syntax file

  • 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 select Convert 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:

Create a PR to this repository

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.

License

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:

Directory License Source
All, except those specified below MIT + Common License* sublimehq/Packages
VimL/ MIT evandroforks/VimL
Puppet/ MIT russCloak/SublimePuppet
Nix/ MIT rvantonder/sublime-nix
Move/ MIT rvantonder/move-sublime-highlighting
Julia/ MIT JuliaEditorSupport/Julia-sublime
INI/ Apache-2.0 jwortmann/ini-syntax
Elm/ MIT elm-community/SublimeElmLanguageSupport
Coq/ MIT whitequark/Sublime-Coq
Zig/ MIT ziglang/sublime-zig-language
TOML/ MIT sourcegraph/TOML-syntax-highlighting
Terraform/ MIT alexlouden/Terraform.tmLanguage
GraphQL/ MIT rvantonder/gql-sublimetext-yolo
DreamMaker/ MIT Wirewraith/sublime-DM
Kotlin/ Apache License 2.0 vkostyukov/kotlin-sublime-package
Dockerfile/ Apache License 2.0 moby/moby
COBOL/ Apache License 2.0 bitlang/sublime_cobol
Dart/ BSD 3-Clause License guillermooo/dart-sublime-bundle-releases
Cuda/ BSD 3-Clause License harrism/sublimetext-cuda-cpp
Thrift/ Common License* airamare01/thrift.tmbundle
Smarty/ Common License* amitsnyderman/sublime-smarty
Postscript/ Common License* textmate/postscript.tmbundle
Plist/ Common License* textmate/property-list.tmbundle
Ninja/ Common License* textmate/ninja.tmbundle
Mediawiki/ Common License* slimsag/mediawiki.tmbundle
Maven/ Common License* textmate/maven.tmbundle
Man/ Common License* textmate/man-pages.tmbundle
Forth/ Common License* textmate/forth.tmbundle
F#/ Common License* textmate/f-sharp.tmbundle
Cython/ Common License* textmate/cython.tmbundle
Cron/ Common License* textmate/cron.tmbundle
CapnProto/ Common License* textmate/capnproto.tmbundle
CMake/ Common License* textmate/cmake.tmbundle
ASP-VB-NET/ Common License* textmate/asp.vb.net.tmbundle
Vue/ MIT License vuejs/vue-syntax-highlight
TypeScript/ MIT License rvantonder/TypeScript-Sublime-Plugin
Swift/ MIT License quiqueg/Swift-Sublime-Package
Stylus/ MIT License billymoon/Stylus
Starlark/ MIT License slimsag/vscode-bazel
Smalltalk/ MIT License textmate/smalltalk.tmbundle
SASS/ MIT License slimsag/sass-textmate-bundle
Rust/ MIT License rust-lang/rust-enhanced
Protobuf/ MIT License VcamX/protobuf-syntax-highlighting
PowerShell/ MIT License slimsag/EditorSyntax
MSBuild/ MIT License tillig/SublimeMSBuild
LESS/ MIT License textmate/less.tmbundle
JavaScript/ MIT License slimsag/Sublime-JS-Custom-Generated
HLSL/ MIT License MattSutherlin/HLSL_ST3
GLSL/ Unlicense euler0/sublime-glsl
Fish/ MIT License Phidica/sublime-fish
Ethereum/ MIT License davidhq/SublimeEthereum
Cg/ MIT License noct/sublime-shaders
Elixir/ MIT License princemaple/elixir-sublime-syntax
Cue MIT License cue-sh/vscode-cue
Apex BSD 3-Clause + MIT forcedotcom/apex-tmLanguage
VHDL BSD 3-Clause sigasi/sigasi-tmlanguage
Verilog BSD 3-Clause sigasi/sigasi-tmlanguage
RPMSpec MIT dreadatour/RPMSpec

Common License*

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.