Adding Clojure executable options

This commit is contained in:
eskemojoe007 2019-03-20 14:27:41 -04:00
parent a3fc41a9db
commit 5d81ad073a
4 changed files with 81 additions and 2 deletions

View File

@ -1642,6 +1642,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff)
| `disabled` | :white_check_mark: | | `disabled` | :white_check_mark: |
| `default_beautifier` | :white_check_mark: | | `default_beautifier` | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: |
| `executable_path` | :white_check_mark: |
**Description**: **Description**:
@ -1702,6 +1703,32 @@ Automatically beautify Clojure files on save
2. Go into *Packages* and search for "*Atom Beautify*" package. 2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*Beautify On Save*" and change it to your desired configuration. 3. Find the option "*Beautify On Save*" and change it to your desired configuration.
##### [Executable path](#executable-path)
**Namespace**: `clj`
**Key**: `executable_path`
**Default**: `C:\Users\david\Documents\GitHub\node_modules\.bin\cljfmt`
**Type**: `string`
**Supported Beautifiers**: [`cljfmt`](#cljfmt)
**Description**:
The path to the cljfmt executable to use (Supported by cljfmt)
**Example `.jsbeautifyrc` Configuration**
```json
{
"clj": {
"executable_path": "C:\\Users\\david\\Documents\\GitHub\\node_modules\\.bin\\cljfmt"
}
}
```
#### [CoffeeScript](#coffeescript) #### [CoffeeScript](#coffeescript)
**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) **Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt)
@ -20376,6 +20403,35 @@ Path to clang-format config file. i.e. clang-format.cfg (Supported by clang-form
``` ```
### cljfmt
##### [Executable path](#executable-path)
**Namespace**: `clj`
**Key**: `executable_path`
**Default**: `C:\Users\david\Documents\GitHub\node_modules\.bin\cljfmt`
**Type**: `string`
**Supported Beautifiers**: [`cljfmt`](#cljfmt)
**Description**:
The path to the cljfmt executable to use (Supported by cljfmt)
**Example `.jsbeautifyrc` Configuration**
```json
{
"clj": {
"executable_path": "C:\\Users\\david\\Documents\\GitHub\\node_modules\\.bin\\cljfmt"
}
}
```
### coffee-fmt ### coffee-fmt
##### [Indent size](#indent-size) ##### [Indent size](#indent-size)

View File

@ -8,12 +8,13 @@ module.exports = class Cljfmt extends Beautifier
link: "https://github.com/snoe/node-cljfmt" link: "https://github.com/snoe/node-cljfmt"
options: { options: {
Clojure: false Clojure:
executable_path: true
} }
beautify: (text, language, options) -> beautify: (text, language, options) ->
formatPath = path.resolve(__dirname, "fmt.edn") formatPath = path.resolve(__dirname, "fmt.edn")
cljfmt = path.resolve(__dirname, "..", "..", "..", "node_modules/.bin/cljfmt") cljfmt = options.executable_path
@tempFile("input", text).then((filePath) => @tempFile("input", text).then((filePath) =>
@run(cljfmt, [ @run(cljfmt, [
filePath, filePath,

View File

@ -1,3 +1,4 @@
path = require('path')
module.exports = { module.exports = {
name: "Clojure" name: "Clojure"
@ -18,4 +19,11 @@ module.exports = {
] ]
defaultBeautifier: "cljfmt" defaultBeautifier: "cljfmt"
options: {
executable_path:
type: 'string'
default: path.resolve(__dirname, "..", "..", "..", "node_modules/.bin/cljfmt")
description: "The path to the cljfmt executable to use"
}
} }

View File

@ -669,6 +669,20 @@
"edn" "edn"
], ],
"properties": { "properties": {
"executable_path": {
"type": "string",
"default": "C:\\Users\\david\\Documents\\GitHub\\node_modules\\.bin\\cljfmt",
"description": "The path to the cljfmt executable to use (Supported by cljfmt)",
"title": "Executable path",
"beautifiers": [
"cljfmt"
],
"key": "executable_path",
"language": {
"name": "Clojure",
"namespace": "clj"
}
},
"disabled": { "disabled": {
"title": "Disable Beautifying Language", "title": "Disable Beautifying Language",
"order": -3, "order": -3,