Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 89c389c

Browse files
authored
Merge pull request #84 from mauricerkelly/support-different-mix-environments
Include mixEnv parameter and apply to environment
2 parents 333b74d + 517ed7d commit 89c389c

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Plugin should work with default settings. If not:
4040

4141
5. `always use elixirc` option - leave it disabled, unless `mix compile` is too slow.
4242

43+
6. `mix env` option - Allows changing the Mix environment for lint runs. If using IEx at the same time as Atom this can be changed to allow IEx to pick up code changes.
44+
4345
## Usage
4446

4547
If you open folder with mix project (`mix.exs` exists in project's root

lib/init.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const elixirProjectPathCache = new Map();
1313
let elixircPath;
1414
let mixPath;
1515
let forceElixirc;
16+
let mixEnv;
1617

1718
function regexp(string, flags) {
1819
return new RegExp(
@@ -243,6 +244,7 @@ const getOpts = async filePath => ({
243244
throwOnStdErr: false,
244245
stream: 'both',
245246
allowEmptyStderr: true,
247+
env: { MIX_ENV: mixEnv },
246248
});
247249

248250
const getDepsPa = async (filePath) => {
@@ -322,6 +324,11 @@ export default {
322324
forceElixirc = value;
323325
}),
324326
);
327+
this.subscriptions.add(
328+
atom.config.observe('linter-elixirc.mixEnv', (value) => {
329+
mixEnv = value;
330+
}),
331+
);
325332
},
326333

327334
deactivate() {

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
"title": "Always use elixirc",
2626
"description": "Activating this will force the plugin to never use `mix compile` and always use `elixirc`.",
2727
"default": false
28+
},
29+
"mixEnv": {
30+
"type": "string",
31+
"title": "Mix environment to use for linting",
32+
"description": "Setting the Mix environment can avoid collisions between linter compiles and IEx sessions.",
33+
"default": "dev"
2834
}
2935
},
3036
"providedServices": {

0 commit comments

Comments
 (0)