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

SQF Language

by JonBons ALL

Sublime Text highlighter for Bohemia Interactive's SQF Language.

Details

  • 2026.12.05.00.00.52
  • github.​com
  • github.​com
  • 1 day ago
  • 53 minutes ago
  • 14 years ago

Installs

  • Total 23K
  • Win 18K
  • Mac 3K
  • Linux 2K
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 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23
Windows 0 0 0 1 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 1 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

Readme

Source
raw.​githubusercontent.​com

Sublime Text – SQF Syntax

Sublime Text syntax highlighting for Bohemia Interactive’s SQF scripting language.

Installation

Package Control (recommended)

  1. Open Sublime Text.
  2. Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) → Package Control: Install Package.
  3. Search for SQF Language and press Enter.

Manual install

Clone into your Packages directory:

git clone https://github.com/JonBons/Sublime-SQF-Language.git "SQF Language"

Or add the repo to Package Control: 1. Ctrl/Cmd+Shift+P → Package Control: Add Repository 2. Enter https://github.com/JonBons/Sublime-SQF-Language/ 3. Then use Install Package and select SQF Language.

Definition Updates

The grammar and completions are generated from the HEMTT wiki dist branch, which is the structured SQF command/event/function reference maintained by the HEMTT project (wiki.hemtt.dev). This is the source used by the current generator.

Generated artifacts:

File Contents
SQF.tmLanguage TextMate plist consumed by Sublime Text, GitHub Linguist, and other TextMate-compatible editors.
SQF.sublime-completions SQF commands, control keywords, constants, preprocessor directives, and official Arma 3 functions (BIS_fnc_*, BIN_fnc_*), with arity/group or arity/mod annotations.
SQF-EventName.sublime-completions Event handler names from the HEMTT event reference.
SQF-EventHandlerSnippets.sublime-completions Generated event-handler snippets with HEMTT parameter names, triggered by <Event> (EH).
SQF-CommunityFunctions.sublime-completions ACE, CBA, Zen, ACRE and other community functions with mod and argument-count annotations.
tools/hemtt-source.json Source version and generation counts for auditing.

A GitHub Action runs every Saturday at 13:00 UTC (0 13 * * 6) and:

  1. Downloads the HEMTT wiki dist archive once.
  2. Regenerates the artifacts above.
  3. Validates the plist/XML, the public grammar contract, and the generated completions.
  4. Runs the generator unit tests and the tokenization tests.
  5. Commits only when something changed. The commit message includes the HEMTT wiki version and the short upstream commit hash.

To force a full rebuild and commit even when the upstream HEMTT revision is unchanged, run Actions → Update SQF grammars → Run workflow and enable force_commit. The workflow still runs the generator, validators, and tokenization tests; if the artifacts are unchanged it creates an empty commit tagged with the workflow run ID.

Large upstream drops in command/event/function counts are refused by default so a bad upstream change cannot silently truncate the grammar. A maintainer can review the diff and rerun manually with --allow-shrink.

Regenerating locally

python tools/generate_sqf_template.py

The generator uses only the Python standard library. It downloads the HEMTT wiki archive automatically. Useful options:

python tools/generate_sqf_template.py --source path/to/dist.zip   # offline/local archive
python tools/generate_sqf_template.py --output-dir /tmp/sqf-out   # write elsewhere
python tools/generate_sqf_template.py --no-community              # skip community functions
python tools/generate_sqf_template.py --allow-shrink              # override the count guard

Edit tools/template_file and regenerate; do not edit SQF.tmLanguage by hand. Entries that are no longer in the upstream reference but are still useful for existing scripts are kept in:

  • tools/legacy_commands.txt
  • tools/legacy_functions.txt
  • tools/legacy_events.txt
  • tools/key_constants.txt (completion-only DIK_* constants)

Testing

python tools/validate_artifacts.py
python -m unittest discover -s tools/tests -p "test_*.py" -v

cd tools/grammar-tests
npm ci
npm test

tools/validate_artifacts.py protects the public contract used by GitHub Linguist and downstream editors: the grammar name, source.sqf scope, UUID, file types, first-line match, command pattern, and completion ordering.

Compatibility

  • The package name, source.sqf scope, UUID, file types (sqf, sqs, sqm, ext), and firstLineMatch are unchanged.
  • Existing scope names such as keyword.control.sqf, constant.language.sqf, support.function.sqf, variable.other.sqf, comment.line.double-slash.sqf, and constant.numeric.sqf are retained. Newer sub-scopes (for example keyword.operator.comparison.sqf) only add detail.
  • GitHub Linguist can continue to consume the vendored SQF.tmLanguage without changes.

Command readability

Engine commands now carry arity-based sub-scopes (support.function.sqf.nular, support.function.sqf.unary, support.function.sqf.binary, support.function.sqf.overloaded) while remaining under the existing support.function.sqf family. Existing themes keep working because the old scope is still a prefix of each new one; themes can opt into the finer scopes to color nular/unary/binary/overloaded commands differently. See docs/THEMING.md for example Sublime color-scheme rules.

Intentional scope corrections in this generation:

  • :, !, &&, ||, and >> are now keyword.operator.* instead of being scoped as constants/control keywords.
  • Single-quoted strings are string.quoted.single.sqf (previously string.quoted.sqf).
  • TAG_fnc_name / BIS_fnc_name identifiers are entity.name.function.sqf (previously variable.function.sqf).
  • and, or, not, mod, and in are keyword.operator.word.sqf instead of control keywords/functions.

Credits

Huge thanks to the maintainers and contributors of both projects.

Contributing

Issues and PRs are welcome! If you’re tweaking keywords or scopes, please include example snippets so I can verify highlighting across common SQF patterns.