elixir-editors / elixir-sublime-syntax

The most powerful Elixir for the most Sublime experience.
MIT License
45 stars 6 forks source link
elixir sublime syntax

ElixirSyntax

ElixirSyntax was initially based on the Elixir.tmbundle package but has been rewritten since, providing more accurate syntax matching as well as better syntax highlighting.

Features

Some syntax highlighting features are not immediately evident. Among them are:

The fragment and sql functions

SQL syntax is highlighted inside Ecto's fragment macro.

Add an sql macro/function to your project to enjoy SQL highlighting anywhere it's used.

The JSON ~j and ~J sigils (Jason)

Embed JSON strings in your Elixir code. Notice the interpolated Elixir code is colored correctly.

The YAML ~y and ~Y sigils (YamlElixir)

Testing

Build-files as well as commands are provided for calling mix test. The predefined shortcuts can be changed via Preferences > Package Settings > ElixirSyntax > Key Bindings.

Tip: To run specific tests in the current file, mark them with multiple cursors and/or spanning selections and press Alt+Shift+T or choose Mix Test: Selection(s) from the palette.

ElixirSyntax stores a per-project JSON settings file in the root folder that contains both the mix.exs file and the _build/ folder. They override the general settings below.

General settings example (via Preferences > Package Settings > ElixirSyntax > Settings):

{
  "mix_test": {
    "output": "tab",
    "output_mode": null,
    "args": ["--coverage"],
    "seed": null
  }
}

When a mix test command is run the first time, a mix_test.repeat.json file is stored in the _build/ folder to remember the command arguments. By pressing Alt+Shift+R or running Mix Test: Repeat from the palette you can repeat the previously executed tests.

Formatting

Use the default shortcut Alt+Shift+F or the palette command Mix Format: File to format your Elixir code. Format the whole project via Mix Format: Project / Folder. Configure auto-formatting on save via the palette command Mix Format: Toggle Auto-Formatting or via the menu Preferences > Package Settings > ElixirSyntax > Settings. There is no per-project auto-format setting yet.

{
  "mix_format": {
    "on_save": true
  }
}

Palette commands

Recommended packages

Changes

See CHANGELOG.md for the list of releases and noteworthy changes.

FAQ

Contributors/Maintainers