Switch elm-format to using Executables

This commit is contained in:
Glavin Wiechert 2017-06-04 02:43:02 -03:00
parent f945c38338
commit dc5f4a20dc
5 changed files with 81 additions and 38 deletions

View File

@ -232,6 +232,23 @@ Options for Dfmt executable.
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*Dfmt*" and change it to your desired configuration.
##### [elm-format](#elm-format)
**Important**: This option is only configurable from within Atom Beautify's setting panel.
**Type**: `object`
**Description**:
Options for elm-format executable.
**How to Configure**
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*elm-format*" and change it to your desired configuration.
##### [Emacs](#emacs)
**Important**: This option is only configurable from within Atom Beautify's setting panel.

View File

@ -1,9 +1,9 @@
module Main (..) where
module Main exposing (..)
addThings x y =
x + y
x + y
main =
addThings 4 5
addThings 4 5

View File

@ -196,10 +196,10 @@ buildOptionsForExecutables = function(beautifiers) {
properties: {
path: {
key: "path",
title: "Executable Path",
title: "Binary/Script Path",
type: "string",
default: "",
description: `Absolute path to the "${cmd}" executable.`,
description: `Absolute path to the "${cmd}" executable's binary/script.`,
}
}
}

View File

@ -7,7 +7,18 @@ Beautifier = require('./beautifier')
module.exports = class ElmFormat extends Beautifier
name: "elm-format"
link: "https://github.com/avh4/elm-format"
isPreInstalled: false
executables: [
{
name: "elm-format"
cmd: "elm-format"
homepage: "https://github.com/avh4/elm-format"
installation: "https://github.com/avh4/elm-format#installation-"
version: {
args: ['--help']
parse: (text) -> text.match(/elm-format-\d+.\d+ (\d+\.\d+\.\d+)/)[1]
}
}
]
options: {
Elm: true
@ -16,11 +27,10 @@ module.exports = class ElmFormat extends Beautifier
beautify: (text, language, options) ->
tempfile = @tempFile("input", text, ".elm")
.then (name) =>
@run("elm-format", [
'--yes',
name
],
{ help: { link: 'https://github.com/avh4/elm-format#installation-' } }
)
.then () =>
@readFile(name)
@exe("elm-format")
.run([
'--yes',
name
])
.then () =>
@readFile(name)

View File

@ -9139,10 +9139,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"uncrustify\" executable."
"description": "Absolute path to the \"uncrustify\" executable's binary/script."
}
}
},
@ -9155,10 +9155,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"autopep8\" executable."
"description": "Absolute path to the \"autopep8\" executable's binary/script."
}
}
},
@ -9171,10 +9171,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"isort\" executable."
"description": "Absolute path to the \"isort\" executable's binary/script."
}
}
},
@ -9187,10 +9187,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"clang-format\" executable."
"description": "Absolute path to the \"clang-format\" executable's binary/script."
}
}
},
@ -9203,10 +9203,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"crystal\" executable."
"description": "Absolute path to the \"crystal\" executable's binary/script."
}
}
},
@ -9219,10 +9219,26 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"dfmt\" executable."
"description": "Absolute path to the \"dfmt\" executable's binary/script."
}
}
},
"elm-format": {
"key": "elm-format",
"title": "elm-format",
"type": "object",
"collapsed": true,
"description": "Options for elm-format executable.",
"properties": {
"path": {
"key": "path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"elm-format\" executable's binary/script."
}
}
},
@ -9235,10 +9251,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"emacs\" executable."
"description": "Absolute path to the \"emacs\" executable's binary/script."
}
}
},
@ -9251,10 +9267,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"php\" executable."
"description": "Absolute path to the \"php\" executable's binary/script."
}
}
},
@ -9267,10 +9283,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"php-cs-fixer\" executable."
"description": "Absolute path to the \"php-cs-fixer\" executable's binary/script."
}
}
},
@ -9283,10 +9299,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"phpcbf\" executable."
"description": "Absolute path to the \"phpcbf\" executable's binary/script."
}
}
},
@ -9299,10 +9315,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"Rscript\" executable."
"description": "Absolute path to the \"Rscript\" executable's binary/script."
}
}
},
@ -9315,10 +9331,10 @@
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"title": "Binary/Script Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"beautysh\" executable."
"description": "Absolute path to the \"beautysh\" executable's binary/script."
}
}
}