Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
Allow choosing Elm version from settings to support 0.18 and 0.19
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Anagrius committed Aug 24, 2018
1 parent 1f80632 commit d9e4313
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
"scripts": {
"lint": "eslint ."
},
"pre-commit": [
"lint"
],
"description": "Run elm-format in Atom",
"keywords": [
"elm",
"format",
"elm-format"
],
"repository": "https://github.com/triforkse/atom-elm-format",
"repository": "https://github.com/humio/atom-elm-format",
"license": "MIT",
"engines": {
"atom": ">=1.0.0 <2.0.0"
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ export default {
// Reset the error tracker.
errorLineNum = null;
const binary = atom.config.get('elm-format.binary');
const elmVersion = atom.config.get('elm-format.elmVersion') || "0.19";

const { status, stdout, stderr } = childProcess.spawnSync(
binary,
['--stdin'], { input: editor.getText() });
['--elm-version', elmVersion, '--stdin'], { input: editor.getText() });

switch (status) {
case 0: {
Expand Down
7 changes: 7 additions & 0 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ export default {
default: 'elm-format',
order: 6,
},
elmVersion: {
title: 'Elm Version',
description: 'The version of Elm to use when formatting.',
type: 'string',
default: '0.19',
enum: ['0.18', '0.19']
},
formatOnSave: {
title: 'Format on save',
description: 'Do we format when you save files?',
Expand Down

0 comments on commit d9e4313

Please sign in to comment.