SublimeLinter-contrib-elixirc
Elixir linter for Sublime Text 3 based on SublimeLinter
Details
Installs
- Total 7K
- Win 2K
- Mac 4K
- Linux 2K
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 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
NOTE: This repository is no longer maintained, as I've switched to a far-superior way of linting by using JakeBecker's elixir-ls and tom564's LSP. Be sure to check it out yourself.
SublimeLinter-contrib-elixirc
This linter plugin for SublimeLinter provides an interface to check elixir syntax using elixirc. It will be used with files that have the “elixir” syntax.
Installation
SublimeLinter 3 must be installed in order to use this plugin. If SublimeLinter 3 is not installed, please follow the instructions here.
Linter installation
Before installing this plugin, you must ensure that elixir
(>= 1.0) is installed on your system. For instructions on how to install elixir, please refer to the elixir-lang docs.
Linter configuration
In order for elixir
to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. Before going any further, please read and follow the steps in “Finding a linter executable” through “Validating your PATH” in the documentation.
Once elixir
is installed and configured, you can proceed to install the SublimeLinter-contrib-elixirc plugin if it is not yet installed.
Plugin installation
Please use Package Control to install the linter plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here.
To install via Package Control, do the following:
Within Sublime Text, bring up the Command Palette and type
install
. Among the commands you should seePackage Control: Install Package
. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins.When the plugin list appears, type
elixirc
. Among the entries you should seeSublimeLinter-contrib-elixirc
. If that entry is not highlighted, use the keyboard or mouse to select it.
Settings
For general information on how SublimeLinter works with settings, please see Settings. For information on generic linter settings, please see Linter Settings.
In addition to the standard SublimeLinter settings, SublimeLinter-contrib-elixirc provides its own settings.
Setting | Description |
---|---|
pa | (list) dirs for -pa option |
require | (list) dirs/files to require |
mix_project | (bool) use mix for linting |
chdir | (string) run linter from the specified dir |
prepend | (list) will be prepended to the linter command |
append | (list) will be appended to the linter command |
In a mix project:
- set
chdir
to your mix project's root directory. - set
mix_project
totrue
Example:
In your .sublime-project file:
"SublimeLinter": {
"linters": {
"elixirc": {
"mix_project": true,
"chdir": "PROJECT_ROOT"
}
}
}
Where:
* PROJECT_ROOT
is the path to the root your project (use ${project}
if your sublime project is saved there)
Note: Currently, exs
files within a mix project (e.g. ExUnit tests) are linted for syntax errors only. This is a known issue and will be resolved in a future version.
If you also use an elixir version manager, set prepend
as per the example below
Outside a mix project:
- if a file uses macros, the beam output paths must be added to code path through
pa
- files (or directories) to require prior to linting must be added through
require
. They are required in the given order. Directories, if given, are traversed recursively and alphabetically.
Example
In your .sublime-project file:
"SublimeLinter": {
"linters": {
"elixirc": {
"pa": ["PROJECT_ROOT/_build/dev/lib/PROJECT_WITH_MACROS/ebin"],
"require": ["PROJECT_ROOT/deps/DEP1"]
}
}
}
Where:
* PROJECT_ROOT
is the path to the root of your project (use ${project}
if your sublime project is saved there)
* PROJECT_WITH_MACROS
is the project name which contains the macros. List all projects in pa
* DEP1
is a directory with files to require. If needed, list specific files first.
Command customization
The prepend
and append
options allow you to modify the executed command.
A typical use-case for this would be if you use elixir version managers (e.g. kiex), which alter certain environment variables when switching between different versions of elixir.
Since sublime is very limited in terms of user-configurable environment variables, the problem could be solved with the env
command on any typical UNIX-based OS.
Example
"SublimeLinter": {
"linters": {
"elixirc": {
"chdir": "/Users/foo/projects/myapp",
"mix_project": true,
"prepend": ["/usr/bin/env", "MIX_ARCHIVES=/Users/foo/.kiex/mix/archives/elixir-1.3.3"]
}
}
}
Contributing
If you would like to contribute enhancements or fixes, please do the following:
- Fork the plugin repository.
- Hack on a separate topic branch created from the latest
master
. - Commit and push the topic branch.
- Make a pull request.
- Be patient. ;-)
Please note that modifications should follow these coding guidelines:
- Indent is 4 spaces.
- Code should pass flake8 and pep257 linters.
- Vertical whitespace helps readability, don’t be afraid to use it.
- Please use descriptive variable names, no abbreviations unless they are very well known.
Thank you for helping out!