From 4f8f4d68f8ca5941cc4b9015f1df067c93eb1399 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sun, 23 Jul 2017 13:49:07 -0500 Subject: [PATCH 001/103] Improved Rubocop configuration and temp files --- src/beautifiers/executable.coffee | 5 +- src/beautifiers/rubocop.coffee | 98 +++++++++++++++++++------------ 2 files changed, 61 insertions(+), 42 deletions(-) diff --git a/src/beautifiers/executable.coffee b/src/beautifiers/executable.coffee index 61f42b3..6a9b315 100644 --- a/src/beautifiers/executable.coffee +++ b/src/beautifiers/executable.coffee @@ -153,7 +153,7 @@ class Executable @debug('env:', env) @debug('PATH:', env.PATH) @debug('args', args) - args = this.relativizePaths(args) + args = this.relativizePaths(args, cwd) @debug('relativized args', args) exe = exePath ? exeName @@ -212,8 +212,7 @@ class Executable args = _.flatten(args) Promise.all(args) - relativizePaths: (args) -> - tmpDir = os.tmpDir() + relativizePaths: (args, tmpDir) -> newArgs = args.map((arg) -> isTmpFile = (typeof arg is 'string' and not arg.includes(':') and \ path.isAbsolute(arg) and path.dirname(arg).startsWith(tmpDir)) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index deafffa..3ff9f2f 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -4,6 +4,9 @@ Requires https://github.com/bbatsov/rubocop "use strict" Beautifier = require('./beautifier') +path = require('path') +fs = require('fs') +temp = require('temp').track() module.exports = class Rubocop extends Beautifier name: "Rubocop" @@ -16,53 +19,70 @@ module.exports = class Rubocop extends Beautifier rubocop_path: true } + createTempFile: (originalFile) -> + new @Promise((resolve, reject) => + tempOptions = { + prefix: "_beautify", + suffix: path.basename(originalFile), + dir: path.dirname(originalFile)} + temp.open(tempOptions, (err, info) => + return reject(err) if err? + @debug('rubocopTempFile', info.path) + resolve(info.path) + ) + ).disposer((filename) => + if fs.existsSync(filename) + @debug("unlinking rubocop temp file", filename) + fs.unlink(filename) + ) + beautify: (text, language, options) -> + editor = atom?.workspace?.getActiveTextEditor() + if editor? + fullPath = editor.getPath() + projectPath = atom.project.relativizePath(fullPath)[0] + else + throw new Error("No active editor found!") + + # Find the rubocop path + rubocopPath = "rubocop" @Promise.all([ @which(options.rubocop_path) if options.rubocop_path @which('rubocop') - ]).then((paths) => + ]) + .then((paths) => @debug('rubocop paths', paths) - _ = require 'lodash' - path = require 'path' # Get first valid, absolute path - rubocopPath = _.find(paths, (p) -> p and path.isAbsolute(p) ) + rubocopPath = paths.find((p) -> p and path.isAbsolute(p)) @verbose('rubocopPath', rubocopPath) @debug('rubocopPath', rubocopPath, paths) + ) - configFile = path.join(atom.project.getPaths()[0], ".rubocop.yml") + # Find or generate a config file if non exists + configFile = @findFile(path.dirname(fullPath), ".rubocop.yml") + if !configFile? + yaml = require("yaml-front-matter") + config = { + "Style/IndentationWidth": + "Width": options.indent_size + } + tempConfig = @tempFile("rubocop-config", yaml.safeDump(config)) - fs = require 'fs' - - if fs.existsSync(configFile) - @debug("rubocop", config, fs.readFileSync(configFile, 'utf8')) - else - yaml = require("yaml-front-matter") - # Generate config file - config = { - "Style/IndentationWidth": - "Width": options.indent_size - } - - configFile = @tempFile("rubocop-config", yaml.safeDump(config)) - @debug("rubocop", config, configFile) - - # Check if PHP-CS-Fixer path was found - if rubocopPath? - @run(rubocopPath, [ + @Promise.using(@createTempFile(fullPath), (tempFileName) => + new @Promise((resolve, reject) -> + fs.writeFile(tempFileName, text, 'utf8', (err) -> + return reject(err) if err? + resolve tempFileName + ) + ) + .then(=> + rubocopArguments = [ "--auto-correct" - "--config", configFile - tempFile = @tempFile("temp", text, '.rb') - ], {ignoreReturnCode: true}) - .then(=> - @readFile(tempFile) - ) - else - @run("rubocop", [ - "--auto-correct" - "--config", configFile - tempFile = @tempFile("temp", text, '.rb') - ], {ignoreReturnCode: true}) - .then(=> - @readFile(tempFile) - ) -) + "--force-exclusion" + tempFileName + ] + rubocopArguments.push("--config", tempConfig) if tempConfig? + @run(rubocopPath, rubocopArguments, {ignoreReturnCode: true, cwd: projectPath}) + ) + .then(=> @readFile(tempFileName)) + ) From de21bc64129c1d754f86c86545ca19bb0606e33e Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sun, 23 Jul 2017 18:23:30 -0500 Subject: [PATCH 002/103] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 352c8fc..fa7c34e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Next - Fixes #1638. update type-formatter and Fixes indent size not supported - Add support for rustfmt-nightly +- Fixes #1773 and #793. ruby-beautify with Rubocop now respects `Exclude` settings, and properly loads inherited config files (like `~/.rubocop.yml`) # v0.30.4 (2017-07-14) - Fixes #1732. Improve deprecation message for old options for new Executables From 82706a4dc89dfb7175067315a6983e187d7d707c Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Tue, 25 Jul 2017 11:52:03 -0500 Subject: [PATCH 003/103] Performance and experience refactor --- src/beautifiers/rubocop.coffee | 54 +++++++++++----------------------- 1 file changed, 17 insertions(+), 37 deletions(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index 3ff9f2f..34406a0 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -5,8 +5,6 @@ Requires https://github.com/bbatsov/rubocop "use strict" Beautifier = require('./beautifier') path = require('path') -fs = require('fs') -temp = require('temp').track() module.exports = class Rubocop extends Beautifier name: "Rubocop" @@ -19,28 +17,11 @@ module.exports = class Rubocop extends Beautifier rubocop_path: true } - createTempFile: (originalFile) -> - new @Promise((resolve, reject) => - tempOptions = { - prefix: "_beautify", - suffix: path.basename(originalFile), - dir: path.dirname(originalFile)} - temp.open(tempOptions, (err, info) => - return reject(err) if err? - @debug('rubocopTempFile', info.path) - resolve(info.path) - ) - ).disposer((filename) => - if fs.existsSync(filename) - @debug("unlinking rubocop temp file", filename) - fs.unlink(filename) - ) - beautify: (text, language, options) -> editor = atom?.workspace?.getActiveTextEditor() if editor? fullPath = editor.getPath() - projectPath = atom.project.relativizePath(fullPath)[0] + [projectPath, relativePath] = atom.project.relativizePath(fullPath) else throw new Error("No active editor found!") @@ -68,21 +49,20 @@ module.exports = class Rubocop extends Beautifier } tempConfig = @tempFile("rubocop-config", yaml.safeDump(config)) - @Promise.using(@createTempFile(fullPath), (tempFileName) => - new @Promise((resolve, reject) -> - fs.writeFile(tempFileName, text, 'utf8', (err) -> - return reject(err) if err? - resolve tempFileName - ) - ) - .then(=> - rubocopArguments = [ - "--auto-correct" - "--force-exclusion" - tempFileName - ] - rubocopArguments.push("--config", tempConfig) if tempConfig? - @run(rubocopPath, rubocopArguments, {ignoreReturnCode: true, cwd: projectPath}) - ) - .then(=> @readFile(tempFileName)) + rubocopArguments = [ + "--auto-correct" + "--force-exclusion" + "--stdin", relativePath + ] + rubocopArguments.push("--config", tempConfig) if tempConfig? + @debug("rubocop arguments", rubocopArguments) + + @run(rubocopPath, rubocopArguments, { + ignoreReturnCode: true, + cwd: projectPath, + onStdin: (stdin) -> stdin.end text + }).then((stdout) => + @debug("rubocop output", stdout) + result = stdout.split("====================\n") + result[result.length - 1] ) From ea0e0677e51f48e9483c54981dfb2c026ad3210b Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Tue, 25 Jul 2017 11:58:28 -0500 Subject: [PATCH 004/103] Reverted relativizePaths change --- src/beautifiers/executable.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/beautifiers/executable.coffee b/src/beautifiers/executable.coffee index 6a9b315..61f42b3 100644 --- a/src/beautifiers/executable.coffee +++ b/src/beautifiers/executable.coffee @@ -153,7 +153,7 @@ class Executable @debug('env:', env) @debug('PATH:', env.PATH) @debug('args', args) - args = this.relativizePaths(args, cwd) + args = this.relativizePaths(args) @debug('relativized args', args) exe = exePath ? exeName @@ -212,7 +212,8 @@ class Executable args = _.flatten(args) Promise.all(args) - relativizePaths: (args, tmpDir) -> + relativizePaths: (args) -> + tmpDir = os.tmpDir() newArgs = args.map((arg) -> isTmpFile = (typeof arg is 'string' and not arg.includes(':') and \ path.isAbsolute(arg) and path.dirname(arg).startsWith(tmpDir)) From a719fa224174d6b12d1142a249a883e2db4e7e28 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Wed, 2 Aug 2017 14:12:08 -0500 Subject: [PATCH 005/103] Handles rubocop internal error --- src/beautifiers/rubocop.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index 34406a0..5d63c21 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -63,6 +63,9 @@ module.exports = class Rubocop extends Beautifier onStdin: (stdin) -> stdin.end text }).then((stdout) => @debug("rubocop output", stdout) + # Rubocop output an error if stdout is empty + return text if stdout.length == 0 + result = stdout.split("====================\n") result[result.length - 1] ) From 851a24f16037d26f4afef480f470403dd0071797 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sat, 7 Oct 2017 15:28:39 -0500 Subject: [PATCH 006/103] Removed getActiveTextEditor() --- src/beautifiers/rubocop.coffee | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index 5d63c21..68a2a04 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -17,13 +17,9 @@ module.exports = class Rubocop extends Beautifier rubocop_path: true } - beautify: (text, language, options) -> - editor = atom?.workspace?.getActiveTextEditor() - if editor? - fullPath = editor.getPath() - [projectPath, relativePath] = atom.project.relativizePath(fullPath) - else - throw new Error("No active editor found!") + beautify: (text, language, options, context) -> + fullPath = context.filePath + [projectPath, relativePath] = atom.project.relativizePath(fullPath) # Find the rubocop path rubocopPath = "rubocop" From c842af63bc8096201d3e0489c8d652a40f424b59 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sat, 7 Oct 2017 15:51:19 -0500 Subject: [PATCH 007/103] Removed configFile variable definition --- src/beautifiers/rubocop.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index 68a2a04..d5b74ef 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -36,8 +36,7 @@ module.exports = class Rubocop extends Beautifier ) # Find or generate a config file if non exists - configFile = @findFile(path.dirname(fullPath), ".rubocop.yml") - if !configFile? + if !@findFile(path.dirname(fullPath), ".rubocop.yml")? yaml = require("yaml-front-matter") config = { "Style/IndentationWidth": From 8188719685ac8cda4c5fd701074144638081cc83 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sat, 7 Oct 2017 16:13:49 -0500 Subject: [PATCH 008/103] Fixed beautify handling when context.filePath is not set --- src/beautifiers/rubocop.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index d5b74ef..c73d5e1 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -5,6 +5,7 @@ Requires https://github.com/bbatsov/rubocop "use strict" Beautifier = require('./beautifier') path = require('path') +temp = require('temp').track() module.exports = class Rubocop extends Beautifier name: "Rubocop" @@ -47,7 +48,7 @@ module.exports = class Rubocop extends Beautifier rubocopArguments = [ "--auto-correct" "--force-exclusion" - "--stdin", relativePath + "--stdin", relativePath || temp.path({suffix: '.rb'}) ] rubocopArguments.push("--config", tempConfig) if tempConfig? @debug("rubocop arguments", rubocopArguments) From bd93afa64c5d4a91fdf3767afe058ea2d0af5449 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sat, 7 Oct 2017 20:01:47 -0500 Subject: [PATCH 009/103] Restored !configFile? --- src/beautifiers/rubocop.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index c73d5e1..7b7f298 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -37,7 +37,8 @@ module.exports = class Rubocop extends Beautifier ) # Find or generate a config file if non exists - if !@findFile(path.dirname(fullPath), ".rubocop.yml")? + configFile = @findFile(path.dirname(fullPath), ".rubocop.yml") + if !configFile? yaml = require("yaml-front-matter") config = { "Style/IndentationWidth": From 2d595f2a20e917b68490a5d98866f8f2e7f61c9f Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sat, 7 Oct 2017 21:08:35 -0500 Subject: [PATCH 010/103] Fixed fallback for rubocop executable --- src/beautifiers/rubocop.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index 7b7f298..72b4522 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -23,7 +23,6 @@ module.exports = class Rubocop extends Beautifier [projectPath, relativePath] = atom.project.relativizePath(fullPath) # Find the rubocop path - rubocopPath = "rubocop" @Promise.all([ @which(options.rubocop_path) if options.rubocop_path @which('rubocop') @@ -31,7 +30,7 @@ module.exports = class Rubocop extends Beautifier .then((paths) => @debug('rubocop paths', paths) # Get first valid, absolute path - rubocopPath = paths.find((p) -> p and path.isAbsolute(p)) + rubocopPath = paths.find((p) -> p and path.isAbsolute(p)) or "rubocop" @verbose('rubocopPath', rubocopPath) @debug('rubocopPath', rubocopPath, paths) ) From 5f36431b1d70310a7e70ee6f1580084c875f6d8b Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sat, 7 Oct 2017 21:26:34 -0500 Subject: [PATCH 011/103] Moved main code into then() for actual promise resolution --- src/beautifiers/rubocop.coffee | 62 +++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index 72b4522..b0dc0fb 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -33,35 +33,35 @@ module.exports = class Rubocop extends Beautifier rubocopPath = paths.find((p) -> p and path.isAbsolute(p)) or "rubocop" @verbose('rubocopPath', rubocopPath) @debug('rubocopPath', rubocopPath, paths) - ) - - # Find or generate a config file if non exists - configFile = @findFile(path.dirname(fullPath), ".rubocop.yml") - if !configFile? - yaml = require("yaml-front-matter") - config = { - "Style/IndentationWidth": - "Width": options.indent_size - } - tempConfig = @tempFile("rubocop-config", yaml.safeDump(config)) - - rubocopArguments = [ - "--auto-correct" - "--force-exclusion" - "--stdin", relativePath || temp.path({suffix: '.rb'}) - ] - rubocopArguments.push("--config", tempConfig) if tempConfig? - @debug("rubocop arguments", rubocopArguments) - - @run(rubocopPath, rubocopArguments, { - ignoreReturnCode: true, - cwd: projectPath, - onStdin: (stdin) -> stdin.end text - }).then((stdout) => - @debug("rubocop output", stdout) - # Rubocop output an error if stdout is empty - return text if stdout.length == 0 - - result = stdout.split("====================\n") - result[result.length - 1] + + # Find or generate a config file if non exists + configFile = @findFile(path.dirname(fullPath), ".rubocop.yml") + if !configFile? + yaml = require("yaml-front-matter") + config = { + "Style/IndentationWidth": + "Width": options.indent_size + } + tempConfig = @tempFile("rubocop-config", yaml.safeDump(config)) + + rubocopArguments = [ + "--auto-correct" + "--force-exclusion" + "--stdin", relativePath || temp.path({suffix: '.rb'}) + ] + rubocopArguments.push("--config", tempConfig) if tempConfig? + @debug("rubocop arguments", rubocopArguments) + + @run(rubocopPath, rubocopArguments, { + ignoreReturnCode: true, + cwd: projectPath, + onStdin: (stdin) -> stdin.end text + }).then((stdout) => + @debug("rubocop output", stdout) + # Rubocop output an error if stdout is empty + return text if stdout.length == 0 + + result = stdout.split("====================\n") + result[result.length - 1] + ) ) From 6f8036ba7adb058d9ce718858236f2b329e9d298 Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sat, 7 Oct 2017 21:33:41 -0500 Subject: [PATCH 012/103] Replaced unnecessary filename/temp file with hard coded value --- src/beautifiers/rubocop.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index b0dc0fb..86d3fb4 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -5,7 +5,6 @@ Requires https://github.com/bbatsov/rubocop "use strict" Beautifier = require('./beautifier') path = require('path') -temp = require('temp').track() module.exports = class Rubocop extends Beautifier name: "Rubocop" @@ -20,7 +19,7 @@ module.exports = class Rubocop extends Beautifier beautify: (text, language, options, context) -> fullPath = context.filePath - [projectPath, relativePath] = atom.project.relativizePath(fullPath) + [projectPath, _relativePath] = atom.project.relativizePath(fullPath) # Find the rubocop path @Promise.all([ @@ -47,7 +46,7 @@ module.exports = class Rubocop extends Beautifier rubocopArguments = [ "--auto-correct" "--force-exclusion" - "--stdin", relativePath || temp.path({suffix: '.rb'}) + "--stdin", "atom-beautify.rb" # filename is required but not used ] rubocopArguments.push("--config", tempConfig) if tempConfig? @debug("rubocop arguments", rubocopArguments) From d4db0089237cdd3d4bc6658c79a12127a7ae61bc Mon Sep 17 00:00:00 2001 From: Brian Bugh Date: Sun, 8 Oct 2017 07:29:26 -0500 Subject: [PATCH 013/103] Fixed deprecation warning: path.dirname requires string --- src/beautifiers/rubocop.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index 86d3fb4..138dfb5 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -18,7 +18,7 @@ module.exports = class Rubocop extends Beautifier } beautify: (text, language, options, context) -> - fullPath = context.filePath + fullPath = context.filePath or "" [projectPath, _relativePath] = atom.project.relativizePath(fullPath) # Find the rubocop path From 42183d1b5e3e3c9d1074d608ca7645d80c332e2e Mon Sep 17 00:00:00 2001 From: nathdwek Date: Thu, 19 Oct 2017 17:41:26 +0200 Subject: [PATCH 014/103] Python: formater->formatter --- docs/options.md | 20 ++++++++++---------- package.json | 2 +- src/beautifiers/pybeautifier.coffee | 20 ++++++++++---------- src/languages/python.coffee | 2 +- src/options.json | 6 +++--- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/options.md b/docs/options.md index 19e54ff..d58f472 100644 --- a/docs/options.md +++ b/docs/options.md @@ -10262,7 +10262,7 @@ Automatically beautify Puppet files on save | `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `formater` | :white_check_mark: | :white_check_mark: | :x: | +| `formatter` | :white_check_mark: | :white_check_mark: | :x: | | `ignore` | :white_check_mark: | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | :x: | | `max_line_length` | :white_check_mark: | :white_check_mark: | :x: | @@ -10329,11 +10329,11 @@ Automatically beautify Python files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Formater](#formater) +##### [Formatter](#formatter) **Namespace**: `python` -**Key**: `formater` +**Key**: `formatter` **Default**: `autopep8` @@ -10352,7 +10352,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier) ```json { "python": { - "formater": "autopep8" + "formatter": "autopep8" } } ``` @@ -19982,11 +19982,11 @@ do not fix these errors/warnings (Supported by autopep8, pybeautifier) } ``` -##### [Formater](#formater) +##### [Formatter](#formatter) **Namespace**: `python` -**Key**: `formater` +**Key**: `formatter` **Default**: `autopep8` @@ -20005,7 +20005,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier) ```json { "python": { - "formater": "autopep8" + "formatter": "autopep8" } } ``` @@ -20335,11 +20335,11 @@ do not fix these errors/warnings (Supported by autopep8, pybeautifier) } ``` -##### [Formater](#formater) +##### [Formatter](#formatter) **Namespace**: `python` -**Key**: `formater` +**Key**: `formatter` **Default**: `autopep8` @@ -20358,7 +20358,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier) ```json { "python": { - "formater": "autopep8" + "formatter": "autopep8" } } ``` diff --git a/package.json b/package.json index 17b14a7..9f3edb5 100644 --- a/package.json +++ b/package.json @@ -445,4 +445,4 @@ "prettydiff2" ] } -} +} \ No newline at end of file diff --git a/src/beautifiers/pybeautifier.coffee b/src/beautifiers/pybeautifier.coffee index 696428e..f91ed29 100644 --- a/src/beautifiers/pybeautifier.coffee +++ b/src/beautifiers/pybeautifier.coffee @@ -14,7 +14,7 @@ MULTI_LINE_OUTPUT_TABLE = { 'NOQA': 6 } -format = (data, formaters) -> +format = (data, formatters) -> return new Promise (resolve, reject) -> client = new net.Socket() client.on 'error', (error) -> @@ -22,7 +22,7 @@ format = (data, formaters) -> reject(error) client.connect PORT, HOST, -> client.setEncoding('utf8') - client.write(JSON.stringify({'data': data, 'formaters': formaters})) + client.write(JSON.stringify({'data': data, 'formatters': formatters})) response = '' client.on 'data', (chunk) -> response += chunk @@ -45,22 +45,22 @@ module.exports = class PythonBeautifier extends Beautifier } beautify: (text, language, options) -> - formater = {'name': options.formater} - if options.formater == 'autopep8' - formater.config = { + formatter = {'name': options.formatter} + if options.formatter == 'autopep8' + formatter.config = { 'ignore': options.ignore 'max_line_length': options.max_line_length } - else if options.formater == 'yapf' - formater.config = {'style_config': options.style_config} - formaters = [formater] + else if options.formatter == 'yapf' + formatter.config = {'style_config': options.style_config} + formatters = [formatter] if options.sort_imports multi_line_output = MULTI_LINE_OUTPUT_TABLE[options.multi_line_output] - formaters.push + formatters.push 'name': 'isort' 'config': {'multi_line_output': multi_line_output} return new @Promise (resolve, reject) -> - format(text, formaters) + format(text, formatters) .then (data) -> resolve(data) .catch (error) -> diff --git a/src/languages/python.coffee b/src/languages/python.coffee index b8d8f4d..0ec16bb 100644 --- a/src/languages/python.coffee +++ b/src/languages/python.coffee @@ -34,7 +34,7 @@ module.exports = { items: type: 'string' description: "do not fix these errors/warnings" - formater: + formatter: type: 'string' default: 'autopep8' enum: ['autopep8', 'yapf'] diff --git a/src/options.json b/src/options.json index 8767e0d..e33d14b 100644 --- a/src/options.json +++ b/src/options.json @@ -6108,7 +6108,7 @@ "namespace": "python" } }, - "formater": { + "formatter": { "type": "string", "default": "autopep8", "enum": [ @@ -6116,12 +6116,12 @@ "yapf" ], "description": "formatter used by pybeautifier (Supported by autopep8, pybeautifier)", - "title": "Formater", + "title": "Formatter", "beautifiers": [ "autopep8", "pybeautifier" ], - "key": "formater", + "key": "formatter", "language": { "name": "Python", "namespace": "python" From 0044fab6255ea90888df9c42b57a3b2b6fdab2ed Mon Sep 17 00:00:00 2001 From: Christian Kjaer Laustsen Date: Sat, 28 Oct 2017 12:41:20 +0200 Subject: [PATCH 015/103] Add hindent and brittany beautifiers for haskell --- CHANGELOG.md | 2 +- docs/code/alphabetical_index.html | 30 ++- docs/code/class/Beautifiers.html | 40 ++-- docs/code/class/Brittany.html | 204 ++++++++++++++++++ docs/code/class/Hindent.html | 204 ++++++++++++++++++ .../file/src/beautifiers/brittany.coffee.html | 123 +++++++++++ .../file/src/beautifiers/hindent.coffee.html | 123 +++++++++++ docs/code/file_list.html | 38 +++- package.json | 9 +- src/beautifiers/brittany.coffee | 24 +++ src/beautifiers/hindent.coffee | 27 +++ src/beautifiers/index.coffee | 2 + src/options.json | 10 +- 13 files changed, 799 insertions(+), 37 deletions(-) create mode 100644 docs/code/class/Brittany.html create mode 100644 docs/code/class/Hindent.html create mode 100644 docs/code/file/src/beautifiers/brittany.coffee.html create mode 100644 docs/code/file/src/beautifiers/hindent.coffee.html create mode 100644 src/beautifiers/brittany.coffee create mode 100644 src/beautifiers/hindent.coffee diff --git a/CHANGELOG.md b/CHANGELOG.md index 171b381..ac1e0a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Next - See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2! - Fix for [#1888](https://github.com/Glavin001/atom-beautify/issues/1888). Allow 0 for minor and patch versions of Docker -- ... +- Add hindent and brittany beautifiers for haskell # v0.30.5 (2017-08-11) - Fix for [#1721](https://github.com/Glavin001/atom-beautify/issues/1721). Changes required due to TextBuffer.save becoming async in Atom 1.19 diff --git a/docs/code/alphabetical_index.html b/docs/code/alphabetical_index.html index bee2772..3fb9fa7 100644 --- a/docs/code/alphabetical_index.html +++ b/docs/code/alphabetical_index.html @@ -60,6 +60,11 @@ Beautifiers +
  • + + Brittany + +
    • @@ -1412,4 +1440,4 @@
    - \ No newline at end of file + diff --git a/docs/code/class/Beautifiers.html b/docs/code/class/Beautifiers.html index 8d4fc39..4ab3fd7 100644 --- a/docs/code/class/Beautifiers.html +++ b/docs/code/class/Beautifiers.html @@ -46,7 +46,7 @@ =
    -
    ['uncrustify', 'autopep8', 'coffee-formatter', 'coffee-fmt', 'cljfmt', 'clang-format', 'crystal', 'dfmt', 'elm-format', 'htmlbeautifier', 'csscomb', 'gherkin', 'gofmt', 'latex-beautify', 'fortran-beautifier', 'js-beautify', 'jscs', 'lua-beautifier', 'ocp-indent', 'perltidy', 'php-cs-fixer', 'phpcbf', 'prettydiff', 'pug-beautify', 'puppet-fix', 'remark', 'rubocop', 'ruby-beautify', 'rustfmt', 'sass-convert', 'sqlformat', 'stylish-haskell', 'tidy-markdown', 'typescript-formatter', 'vue-beautifier', 'yapf', 'erl_tidy', 'marko-beautifier', 'formatR', 'beautysh']
    +
    ['uncrustify', 'autopep8', 'brittany', 'coffee-formatter', 'coffee-fmt', 'cljfmt', 'clang-format', 'crystal', 'dfmt', 'elm-format', 'htmlbeautifier', 'csscomb', 'gherkin', 'gofmt', 'latex-beautify', 'fortran-beautifier', 'hindent', 'js-beautify', 'jscs', 'lua-beautifier', 'ocp-indent', 'perltidy', 'php-cs-fixer', 'phpcbf', 'prettydiff', 'pug-beautify', 'puppet-fix', 'remark', 'rubocop', 'ruby-beautify', 'rustfmt', 'sass-convert', 'sqlformat', 'stylish-haskell', 'tidy-markdown', 'typescript-formatter', 'vue-beautifier', 'yapf', 'erl_tidy', 'marko-beautifier', 'formatR', 'beautysh']

    List of beautifier names

    To register a beautifier add its name here

    @@ -83,7 +83,7 @@
    {}
    - +

    Instance Method Summary

    @@ -97,7 +97,7 @@ - From https://github.com/atom/notifications/blob/01779ade79e7196f1603b8c1fa31716aa4a33911/lib/notification-issue.coffee#L130 + From https://github.com/atom/notifications/blob/01779ade79e7196f1603b8c1fa31716aa4a33911/lib/notification-issue.coffee#L130
  • @@ -208,7 +208,7 @@ - CLI + CLI
  • @@ -269,7 +269,7 @@ lookups when liniting an entire project - Look for .jsbeautifierrc in file and home path, check env variables + Look for .jsbeautifierrc in file and home path, check env variables
  • @@ -345,7 +345,7 @@ lookups when liniting an entire project getBeautifiers(language)

    - +

    @@ -354,7 +354,7 @@ lookups when liniting an entire project getBeautifierForLanguage(language)

    - +

    @@ -363,7 +363,7 @@ lookups when liniting an entire project getLanguage(grammar, filePath)

    - +

    @@ -372,7 +372,7 @@ lookups when liniting an entire project getOptionsForLanguage(allOptions, language)

    - +

    @@ -381,7 +381,7 @@ lookups when liniting an entire project transformOptions(beautifier, languageName, options)

    - +

    @@ -390,7 +390,7 @@ lookups when liniting an entire project trackEvent(payload)

    - +

    @@ -399,7 +399,7 @@ lookups when liniting an entire project trackTiming(payload)

    - +

    @@ -408,7 +408,7 @@ lookups when liniting an entire project track(type, payload)

    - +

    @@ -417,7 +417,7 @@ lookups when liniting an entire project beautify(text, allOptions, grammar, filePath, {onSave} = {})

    - +

    @@ -439,7 +439,7 @@ lookups when liniting an entire project verifyExists(fullPath)

    - +

    @@ -511,7 +511,7 @@ or in the home directory. Configuration files are named getConfigOptionsFromSettings(langs)

    - +

    @@ -533,7 +533,7 @@ or in the home directory. Configuration files are named getOptionsForPath(editedFilePath, editor)

    - +

    @@ -542,7 +542,7 @@ or in the home directory. Configuration files are named isNestedOptions(currOptions)

    - +

    @@ -552,7 +552,7 @@ or in the home directory. Configuration files are named Bound

    - +
    @@ -628,4 +628,4 @@ or in the home directory. Configuration files are named - \ No newline at end of file + diff --git a/docs/code/class/Brittany.html b/docs/code/class/Brittany.html new file mode 100644 index 0000000..95b2bac --- /dev/null +++ b/docs/code/class/Brittany.html @@ -0,0 +1,204 @@ + + + + + Atom-Beautify Documentation + + + + + +
    + +
    +

    + Class: + Brittany +

    + + + + + + + + + +
    Defined in:src/beautifiers/brittany.coffee
    Inherits: + Beautifier +
    +

    Variables Summary

    +
    +
    + name + = +
    +
    +
    "brittany"
    + +
    + +
    +
    "https://github.com/lspitzner/brittany"
    + +
    +
    + options + = +
    +
    +
    {
    +  Haskell: true
    +}
    + +
    +
    +

    + Variable inherited from + Beautifier +

    +

    + Promise + name + options + languages + beautify + _envCache + _envCacheDate + _envCacheExpiry + logger +

    +

    Instance Method Summary

    + +

    + Inherited Method Summary +

    + Methods inherited from + Beautifier +

    +

    + #deprecate + #tempFile + #readFile + #findFile + #getShellEnvironment + #which + #commandNotFoundError + #run + #spawn + #setupLogger +

    + +

    Instance Method Details

    +
    +
    +

    + # +(void) +beautify(text, language, options) +
    +

    + +
    +
    +
    + + +
    + +
      +
      +
      +

      + Quickly fuzzy find classes, mixins, methods, file: +

      +
        +
      • + T + Open fuzzy finder dialog +
      • +
      +

      + Control the navigation frame: +

      +
        +
      • + L + Toggle list view +
      • +
      • + C + Show class list +
      • +
      • + I + Show mixin list +
      • +
      • + F + Show file list +
      • +
      • + M + Show method list +
      • +
      • + E + Show extras list +
      • +
      +

      + You can focus and blur the search input: +

      +
        +
      • + S + Focus search input +
      • +
      • + Esc + Blur search input +
      • +
      +
      + + diff --git a/docs/code/class/Hindent.html b/docs/code/class/Hindent.html new file mode 100644 index 0000000..23767f2 --- /dev/null +++ b/docs/code/class/Hindent.html @@ -0,0 +1,204 @@ + + + + + Atom-Beautify Documentation + + + + + +
      + +
      +

      + Class: + Hindent +

      + + + + + + + + + +
      Defined in:src/beautifiers/hindent.coffee
      Inherits: + Beautifier +
      +

      Variables Summary

      +
      +
      + name + = +
      +
      +
      "hindent"
      + +
      + +
      +
      "https://github.com/commercialhaskell/hindent"
      + +
      +
      + options + = +
      +
      +
      {
      +  Haskell: true
      +}
      + +
      +
      +

      + Variable inherited from + Beautifier +

      +

      + Promise + name + options + languages + beautify + _envCache + _envCacheDate + _envCacheExpiry + logger +

      +

      Instance Method Summary

      + +

      + Inherited Method Summary +

      + Methods inherited from + Beautifier +

      +

      + #deprecate + #tempFile + #readFile + #findFile + #getShellEnvironment + #which + #commandNotFoundError + #run + #spawn + #setupLogger +

      + +

      Instance Method Details

      +
      +
      +

      + # +(void) +beautify(text, language, options) +
      +

      + +
      +
      +
      + + +
      + +
        +
        +
        +

        + Quickly fuzzy find classes, mixins, methods, file: +

        +
          +
        • + T + Open fuzzy finder dialog +
        • +
        +

        + Control the navigation frame: +

        +
          +
        • + L + Toggle list view +
        • +
        • + C + Show class list +
        • +
        • + I + Show mixin list +
        • +
        • + F + Show file list +
        • +
        • + M + Show method list +
        • +
        • + E + Show extras list +
        • +
        +

        + You can focus and blur the search input: +

        +
          +
        • + S + Focus search input +
        • +
        • + Esc + Blur search input +
        • +
        +
        + + diff --git a/docs/code/file/src/beautifiers/brittany.coffee.html b/docs/code/file/src/beautifiers/brittany.coffee.html new file mode 100644 index 0000000..759b6c3 --- /dev/null +++ b/docs/code/file/src/beautifiers/brittany.coffee.html @@ -0,0 +1,123 @@ + + + + + Atom-Beautify Documentation + + + + + +
        + +
        +

        + File: + brittany.coffee +

        + + + + + + + + + +
        Defined in:src/beautifiers
        + Classes: + + + StylishHaskell + +
        +
        + + +
        + +
          +
          +
          +

          + Quickly fuzzy find classes, mixins, methods, file: +

          +
            +
          • + T + Open fuzzy finder dialog +
          • +
          +

          + Control the navigation frame: +

          +
            +
          • + L + Toggle list view +
          • +
          • + C + Show class list +
          • +
          • + I + Show mixin list +
          • +
          • + F + Show file list +
          • +
          • + M + Show method list +
          • +
          • + E + Show extras list +
          • +
          +

          + You can focus and blur the search input: +

          +
            +
          • + S + Focus search input +
          • +
          • + Esc + Blur search input +
          • +
          +
          + + diff --git a/docs/code/file/src/beautifiers/hindent.coffee.html b/docs/code/file/src/beautifiers/hindent.coffee.html new file mode 100644 index 0000000..2a23412 --- /dev/null +++ b/docs/code/file/src/beautifiers/hindent.coffee.html @@ -0,0 +1,123 @@ + + + + + Atom-Beautify Documentation + + + + + +
          + +
          +

          + File: + hindent.coffee +

          + + + + + + + + + +
          Defined in:src/beautifiers
          + Classes: + + + StylishHaskell + +
          +
          + + +
          + +
            +
            +
            +

            + Quickly fuzzy find classes, mixins, methods, file: +

            +
              +
            • + T + Open fuzzy finder dialog +
            • +
            +

            + Control the navigation frame: +

            +
              +
            • + L + Toggle list view +
            • +
            • + C + Show class list +
            • +
            • + I + Show mixin list +
            • +
            • + F + Show file list +
            • +
            • + M + Show method list +
            • +
            • + E + Show extras list +
            • +
            +

            + You can focus and blur the search input: +

            +
              +
            • + S + Focus search input +
            • +
            • + Esc + Blur search input +
            • +
            +
            + + diff --git a/docs/code/file_list.html b/docs/code/file_list.html index 2ce9f23..4481c80 100644 --- a/docs/code/file_list.html +++ b/docs/code/file_list.html @@ -65,6 +65,14 @@ src/beautifiers
          1. +
          2. + + brittany.coffee + + + src/beautifiers + +
          3. clang-format.coffee @@ -88,7 +96,7 @@
          4. - +
          5. coffee-fmt.coffee @@ -160,7 +168,7 @@
          6. - +
          7. fortran-beautifier @@ -176,7 +184,7 @@
          8. - +
          9. gherkin.coffee @@ -193,6 +201,14 @@ src/beautifiers
          10. +
          11. + + hindent.coffee + + + src/beautifiers + +
          12. htmlbeautifier.coffee @@ -248,7 +264,7 @@
          13. - +
          14. marko-beautifier.coffee @@ -408,7 +424,7 @@
          15. - +
          16. vue-beautifier.coffee @@ -426,7 +442,7 @@
          17. - +
          18. beautify.coffee @@ -946,7 +962,7 @@
          19. - +
          20. views @@ -970,11 +986,11 @@
          21. - + - + - + - \ No newline at end of file + diff --git a/package.json b/package.json index 17b14a7..c3b9b1d 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,11 @@ { "name": "Steven Zeck", "url": "https://github.com/szeck87" + }, + { + "name": "Christian Kjær Laustsen", + "email": "ckl@codetalk.io", + "url": "https://github.com/Tehnix" } ], "engines": { @@ -340,6 +345,8 @@ "gherkin", "fortran", "haskell", + "hindent", + "brittany", "jade", "jsx", "latex", @@ -445,4 +452,4 @@ "prettydiff2" ] } -} +} \ No newline at end of file diff --git a/src/beautifiers/brittany.coffee b/src/beautifiers/brittany.coffee new file mode 100644 index 0000000..1f4445c --- /dev/null +++ b/src/beautifiers/brittany.coffee @@ -0,0 +1,24 @@ +### +Requires https://github.com/lspitzner/brittany +### + +"use strict" +Beautifier = require('./beautifier') + +module.exports = class Brittany extends Beautifier + name: "brittany" + link: "https://github.com/lspitzner/brittany" + isPreInstalled: false + + options: { + Haskell: true + } + + beautify: (text, language, options) -> + @run("brittany", [ + @tempFile("input", text) + ], { + help: { + link: "https://github.com/lspitzner/brittany" + } + }) diff --git a/src/beautifiers/hindent.coffee b/src/beautifiers/hindent.coffee new file mode 100644 index 0000000..c1b9756 --- /dev/null +++ b/src/beautifiers/hindent.coffee @@ -0,0 +1,27 @@ +### +Requires https://github.com/commercialhaskell/hindent +### + +"use strict" +Beautifier = require('./beautifier') + +module.exports = class Hindent extends Beautifier + name: "hindent" + link: "https://github.com/commercialhaskell/hindent" + isPreInstalled: false + + options: { + Haskell: true + } + + beautify: (text, language, options) -> + @run("hindent", [ + tempFile = @tempFile("temp", text) + ], { + help: { + link: "https://github.com/commercialhaskell/hindent" + } + }) + .then(=> + @readFile(tempFile) + ) diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index b3e630c..816bcf4 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -37,6 +37,7 @@ module.exports = class Beautifiers extends EventEmitter 'uncrustify' 'align-yaml' 'autopep8' + 'brittany' 'coffee-formatter' 'coffee-fmt' 'cljfmt' @@ -52,6 +53,7 @@ module.exports = class Beautifiers extends EventEmitter 'goimports' 'latex-beautify' 'fortran-beautifier' + 'hindent' 'js-beautify' 'jscs' 'eslint' diff --git a/src/options.json b/src/options.json index 8767e0d..c39c914 100644 --- a/src/options.json +++ b/src/options.json @@ -2632,7 +2632,9 @@ "description": "Options for language Haskell", "collapsed": true, "beautifiers": [ - "stylish-haskell" + "stylish-haskell", + "hindent", + "brittany" ], "grammars": [ "Haskell" @@ -2655,7 +2657,9 @@ "default": "stylish-haskell", "description": "Default Beautifier to be used for Haskell", "enum": [ - "stylish-haskell" + "stylish-haskell", + "hindent", + "brittany" ] }, "beautify_on_save": { @@ -9377,4 +9381,4 @@ } } } -} \ No newline at end of file +} From 7121eef0be7f255c4454e3ea2a5ec5db767c6794 Mon Sep 17 00:00:00 2001 From: Christian Kjaer Laustsen Date: Sat, 28 Oct 2017 12:53:31 +0200 Subject: [PATCH 016/103] Run docs and add examples --- README.md | 4 +- docs/options.md | 16 ++++---- .../haskell/expected/test.hs | 10 ----- .../haskell/expected/test_brittany.hs | 33 ++++++++++++++++ .../haskell/expected/test_hindent.hs | 38 +++++++++++++++++++ .../haskell/expected/test_stylishhaskell.hs | 36 ++++++++++++++++++ .../haskell/original/_test.hs | 30 ++++++++++++++- src/options.json | 12 +++--- 8 files changed, 152 insertions(+), 27 deletions(-) delete mode 100644 examples/nested-jsbeautifyrc/haskell/expected/test.hs create mode 100644 examples/nested-jsbeautifyrc/haskell/expected/test_brittany.hs create mode 100644 examples/nested-jsbeautifyrc/haskell/expected/test_hindent.hs create mode 100644 examples/nested-jsbeautifyrc/haskell/expected/test_stylishhaskell.hs diff --git a/README.md b/README.md index c33233e..5b80850 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall | align-yaml | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | autopep8 | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [autopep8 (`autopep8`)](https://github.com/hhatto/autopep8) with `docker pull unibeautify/autopep8`

            :bookmark_tabs: Manually:
            1. Install [autopep8 (`autopep8`)](https://github.com/hhatto/autopep8) by following https://github.com/hhatto/autopep8#installation
            2. Install [isort (`isort`)](https://github.com/timothycrosley/isort) by following https://github.com/timothycrosley/isort#installing-isort
            | | beautysh | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [beautysh (`beautysh`)](https://github.com/bemeurer/beautysh) with `docker pull unibeautify/beautysh`

            :bookmark_tabs: Manually:
            1. Install [beautysh (`beautysh`)](https://github.com/bemeurer/beautysh) by following https://github.com/bemeurer/beautysh#installation
            | +| brittany | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/lspitzner/brittany and follow the instructions. | | clang-format | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [ClangFormat (`clang-format`)](https://clang.llvm.org/docs/ClangFormat.html) with `docker pull unibeautify/clang-format`

            :bookmark_tabs: Manually:
            1. Install [ClangFormat (`clang-format`)](https://clang.llvm.org/docs/ClangFormat.html) by following https://clang.llvm.org/docs/ClangFormat.html
            | | cljfmt | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Coffee Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | @@ -89,6 +90,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall | gofmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://golang.org/cmd/gofmt/ and follow the instructions. | | goimports | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [goimports (`goimports`)](https://godoc.org/golang.org/x/tools/cmd/goimports) with `docker pull unibeautify/goimports`

            :bookmark_tabs: Manually:
            1. Install [goimports (`goimports`)](https://godoc.org/golang.org/x/tools/cmd/goimports) by following https://godoc.org/golang.org/x/tools/cmd/goimports
            | | hh_format | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://hhvm.com/ and follow the instructions. | +| hindent | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/commercialhaskell/hindent and follow the instructions. | | HTML Beautifier | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/threedaymonk/htmlbeautifier and follow the instructions. | | JS Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | JSCS Fixer | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | @@ -146,7 +148,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | Go | `Go` |`.go` | **[`gofmt`](https://golang.org/cmd/gofmt/)**, [`goimports`](https://godoc.org/golang.org/x/tools/cmd/goimports) | | Golang Template | `HTML (Go)`, `Go Template` |`.gohtml` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | Handlebars | `Handlebars`, `HTML (Handlebars)` |`.hbs`, `.handlebars` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | -| Haskell | `Haskell` |`.hs` | **[`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell)** | +| Haskell | `Haskell` |`.hs` | **[`brittany`](https://github.com/lspitzner/brittany)**, [`hindent`](https://github.com/commercialhaskell/hindent), [`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell) | | HTML | `HTML` |`.html` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | Jade | `Jade`, `Pug` |`.jade`, `.pug` | **[`Pug Beautify`](https://github.com/vingorius/pug-beautify)** | | Java | `Java` |`.java` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)** | diff --git a/docs/options.md b/docs/options.md index 19e54ff..1532ad5 100644 --- a/docs/options.md +++ b/docs/options.md @@ -4678,13 +4678,13 @@ Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff) #### [Haskell](#haskell) -**Supported Beautifiers**: [`stylish-haskell`](#stylish-haskell) +**Supported Beautifiers**: [`brittany`](#brittany) [`hindent`](#hindent) [`stylish-haskell`](#stylish-haskell) -| Option | stylish-haskell | -| --- | --- | -| `disabled` | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | +| Option | brittany | hindent | stylish-haskell | +| --- | --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | **Description**: @@ -4711,11 +4711,11 @@ Disable Haskell Beautification **Important**: This option is only configurable from within Atom Beautify's setting panel. -**Default**: `stylish-haskell` +**Default**: `brittany` **Type**: `string` -**Enum**: `stylish-haskell` +**Enum**: `brittany` `hindent` `stylish-haskell` **Description**: diff --git a/examples/nested-jsbeautifyrc/haskell/expected/test.hs b/examples/nested-jsbeautifyrc/haskell/expected/test.hs deleted file mode 100644 index 7db6a80..0000000 --- a/examples/nested-jsbeautifyrc/haskell/expected/test.hs +++ /dev/null @@ -1,10 +0,0 @@ -{-# LANGUAGE Wat #-} -import Bar -import Foo - -import qualified Baz as Bang - -data Person = Person { - name :: String, - address :: String -} diff --git a/examples/nested-jsbeautifyrc/haskell/expected/test_brittany.hs b/examples/nested-jsbeautifyrc/haskell/expected/test_brittany.hs new file mode 100644 index 0000000..0a89dd8 --- /dev/null +++ b/examples/nested-jsbeautifyrc/haskell/expected/test_brittany.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE OverloadedStrings #-} +module TypeFun where +import Foo +import Bar +import qualified Baz as Bang +import Data.Typeable + +data Person = Person { + name :: String, + address :: String +} + +main :: IO () +main = do + doSomethingOnType 'c' + doSomethingOnType (35 :: Integer) + doSomethingOnType "a string" + +doSomethingOnType :: Typeable a => a -> IO () +doSomethingOnType a = case show (typeOf a) of + "Char" -> print $ performActionOnChar a + "Integer" -> print $ performActionOnInt a + _ -> print "undefined!" + +performActionOnChar :: Typeable a => a -> String +performActionOnChar a = case cast a :: Maybe Char of + Just c -> "Concatenating with string: " ++ [c] + Nothing -> "Cast went wrong..." + +performActionOnInt :: Typeable a => a -> String +performActionOnInt a = case cast a :: Maybe Integer of + Just i -> "Concatenating with string: " ++ show (i + 10) + Nothing -> "Cast went wrong..." diff --git a/examples/nested-jsbeautifyrc/haskell/expected/test_hindent.hs b/examples/nested-jsbeautifyrc/haskell/expected/test_hindent.hs new file mode 100644 index 0000000..e757c02 --- /dev/null +++ b/examples/nested-jsbeautifyrc/haskell/expected/test_hindent.hs @@ -0,0 +1,38 @@ +{-# LANGUAGE OverloadedStrings #-} + +module TypeFun where + +import Bar +import qualified Baz as Bang +import Data.Typeable +import Foo + +data Person = Person + { name :: String + , address :: String + } + +main :: IO () +main = do + doSomethingOnType 'c' + doSomethingOnType (35 :: Integer) + doSomethingOnType "a string" + +doSomethingOnType :: Typeable a => a -> IO () +doSomethingOnType a = + case show (typeOf a) of + "Char" -> print $ performActionOnChar a + "Integer" -> print $ performActionOnInt a + _ -> print "undefined!" + +performActionOnChar :: Typeable a => a -> String +performActionOnChar a = + case cast a :: Maybe Char of + Just c -> "Concatenating with string: " ++ [c] + Nothing -> "Cast went wrong..." + +performActionOnInt :: Typeable a => a -> String +performActionOnInt a = + case cast a :: Maybe Integer of + Just i -> "Concatenating with string: " ++ show (i + 10) + Nothing -> "Cast went wrong..." diff --git a/examples/nested-jsbeautifyrc/haskell/expected/test_stylishhaskell.hs b/examples/nested-jsbeautifyrc/haskell/expected/test_stylishhaskell.hs new file mode 100644 index 0000000..3f2339f --- /dev/null +++ b/examples/nested-jsbeautifyrc/haskell/expected/test_stylishhaskell.hs @@ -0,0 +1,36 @@ +{-# LANGUAGE OverloadedStrings #-} +module TypeFun where +import Bar +import qualified Baz as Bang +import Data.Typeable +import Foo + +data Person = Person { + name :: String, + address :: String +} + +main :: IO () +main = do + doSomethingOnType 'c' + doSomethingOnType (35 :: Integer) + doSomethingOnType "a string" + +doSomethingOnType :: Typeable a => a -> IO () +doSomethingOnType a = + case show (typeOf a) of + "Char" -> print $ performActionOnChar a + "Integer" -> print $ performActionOnInt a + _ -> print "undefined!" + +performActionOnChar :: Typeable a => a -> String +performActionOnChar a = + case cast a :: Maybe Char of + Just c -> "Concatenating with string: " ++ [c] + Nothing -> "Cast went wrong..." + +performActionOnInt :: Typeable a => a -> String +performActionOnInt a = + case cast a :: Maybe Integer of + Just i -> "Concatenating with string: " ++ show (i + 10) + Nothing -> "Cast went wrong..." diff --git a/examples/nested-jsbeautifyrc/haskell/original/_test.hs b/examples/nested-jsbeautifyrc/haskell/original/_test.hs index 7d9267c..9298c1e 100644 --- a/examples/nested-jsbeautifyrc/haskell/original/_test.hs +++ b/examples/nested-jsbeautifyrc/haskell/original/_test.hs @@ -1,10 +1,36 @@ -{-# LANGUAGE Wat #-} +{-# LANGUAGE OverloadedStrings #-} +module TypeFun where import Foo import Bar - import qualified Baz as Bang +import Data.Typeable data Person = Person { name :: String, address :: String } + +main :: IO () +main = do + doSomethingOnType 'c' + doSomethingOnType (35 :: Integer) + doSomethingOnType "a string" + +doSomethingOnType :: Typeable a => a -> IO () +doSomethingOnType a = + case show (typeOf a) of + "Char" -> print $ performActionOnChar a + "Integer" -> print $ performActionOnInt a + _ -> print "undefined!" + +performActionOnChar :: Typeable a => a -> String +performActionOnChar a = + case cast a :: Maybe Char of + Just c -> "Concatenating with string: " ++ [c] + Nothing -> "Cast went wrong..." + +performActionOnInt :: Typeable a => a -> String +performActionOnInt a = + case cast a :: Maybe Integer of + Just i -> "Concatenating with string: " ++ show (i + 10) + Nothing -> "Cast went wrong..." diff --git a/src/options.json b/src/options.json index c39c914..28d587d 100644 --- a/src/options.json +++ b/src/options.json @@ -2632,9 +2632,9 @@ "description": "Options for language Haskell", "collapsed": true, "beautifiers": [ - "stylish-haskell", + "brittany", "hindent", - "brittany" + "stylish-haskell" ], "grammars": [ "Haskell" @@ -2654,12 +2654,12 @@ "title": "Default Beautifier", "order": -2, "type": "string", - "default": "stylish-haskell", + "default": "brittany", "description": "Default Beautifier to be used for Haskell", "enum": [ - "stylish-haskell", + "brittany", "hindent", - "brittany" + "stylish-haskell" ] }, "beautify_on_save": { @@ -9381,4 +9381,4 @@ } } } -} +} \ No newline at end of file From 93aae32f8c0bbb4bb693f04438dae50d61aba588 Mon Sep 17 00:00:00 2001 From: Faheel Ahmad Date: Fri, 3 Nov 2017 20:11:32 +0530 Subject: [PATCH 017/103] Add option for sqlformat to re-indent --- src/beautifiers/sqlformat.coffee | 2 +- src/languages/sql.coffee | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/beautifiers/sqlformat.coffee b/src/beautifiers/sqlformat.coffee index e6b0058..02c5333 100644 --- a/src/beautifiers/sqlformat.coffee +++ b/src/beautifiers/sqlformat.coffee @@ -17,7 +17,7 @@ module.exports = class Sqlformat extends Beautifier beautify: (text, language, options) -> @run("sqlformat", [ @tempFile("input", text) - "--reindent" + "--reindent=#{options.reindent}" if options.reindent? "--indent_width=#{options.indent_size}" if options.indent_size? "--keywords=#{options.keywords}" if (options.keywords? && options.keywords != 'unchanged') "--identifiers=#{options.identifiers}" if (options.identifiers? && options.identifiers != 'unchanged') diff --git a/src/languages/sql.coffee b/src/languages/sql.coffee index c8e8192..b6079c4 100644 --- a/src/languages/sql.coffee +++ b/src/languages/sql.coffee @@ -26,6 +26,10 @@ module.exports = { default: null minimum: 0 description: "Indentation size/length" + reindent: + type: 'boolean' + default: true + description: "Change indentations of the statements. Uncheck this option to preserve indentation" keywords: type: 'string' default: "upper" From d2b92d2b8a991b47d41a2c7c1be2c55edb8c7afe Mon Sep 17 00:00:00 2001 From: Faheel Ahmad Date: Fri, 3 Nov 2017 20:12:18 +0530 Subject: [PATCH 018/103] Update options and docs --- docs/options.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ src/options.json | 16 ++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/docs/options.md b/docs/options.md index 7f3311d..a8fd58b 100644 --- a/docs/options.md +++ b/docs/options.md @@ -11692,6 +11692,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `identifiers` | :white_check_mark: | | `indent_size` | :white_check_mark: | | `keywords` | :white_check_mark: | +| `reindent` | :white_check_mark: | **Description**: @@ -11834,6 +11835,32 @@ Change case of keywords (Supported by sqlformat) } ``` +##### [Reindent](#reindent) + +**Namespace**: `sql` + +**Key**: `reindent` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`sqlformat`](#sqlformat) + +**Description**: + +Change indentations of the statements. Uncheck this option to preserve indentation (Supported by sqlformat) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "sql": { + "reindent": true + } +} +``` + #### [SVG](#svg) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -20583,6 +20610,32 @@ Indentation size/length (Supported by sqlformat) } ``` +##### [Reindent](#reindent) + +**Namespace**: `sql` + +**Key**: `reindent` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`sqlformat`](#sqlformat) + +**Description**: + +Change indentations of the statements. Uncheck this option to preserve indentation (Supported by sqlformat) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "sql": { + "reindent": true + } +} +``` + ##### [Keywords](#keywords) **Namespace**: `sql` diff --git a/src/options.json b/src/options.json index 0eca25e..798b234 100644 --- a/src/options.json +++ b/src/options.json @@ -6914,6 +6914,20 @@ "namespace": "sql" } }, + "reindent": { + "type": "boolean", + "default": true, + "description": "Change indentations of the statements. Uncheck this option to preserve indentation (Supported by sqlformat)", + "title": "Reindent", + "beautifiers": [ + "sqlformat" + ], + "key": "reindent", + "language": { + "name": "SQL", + "namespace": "sql" + } + }, "keywords": { "type": "string", "default": "upper", @@ -9434,4 +9448,4 @@ } } } -} \ No newline at end of file +} From 2f4f0c125c0cf10be5c8bbc5537f8d192e1b405c Mon Sep 17 00:00:00 2001 From: Faheel Ahmad Date: Fri, 3 Nov 2017 20:13:41 +0530 Subject: [PATCH 019/103] Add contributor --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 394f8ce..89e9db5 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,10 @@ { "name": "Steven Zeck", "url": "https://github.com/szeck87" + }, + { + "name": "Faheel Ahmad", + "url": "https://github.com/faheel" } ], "engines": { From 2b914224a88b2efa02bdd6d30620ba73f57eee51 Mon Sep 17 00:00:00 2001 From: Faheel Ahmad Date: Fri, 3 Nov 2017 20:21:07 +0530 Subject: [PATCH 020/103] Update CHANGELOG add option for sqlformat to re-indent --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e79819..4dffef0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Next -- ... +- Add "Reindent" option for sqlformat. See #1926. # v0.30.6 (2017-10-30) - See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt. From d122715840e9d410289df5365497886cbf3708ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kj=C3=A6r?= Date: Wed, 8 Nov 2017 09:12:25 +0900 Subject: [PATCH 021/103] Move changelog entry to "next" section --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a0318d..c97538e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Next -- ... +- Add hindent and brittany beautifiers for haskell # v0.30.6 (2017-10-30) - See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt. @@ -9,7 +9,6 @@ - Add `.ttslua` file extension to Lua language - Fix [#1638]. Update TypeScript Formatter dependency - Fix [#1833] `os.tmpDir` deprecation warning -- Add hindent and brittany beautifiers for haskell # v0.30.5 (2017-08-11) - Fix for [#1721](https://github.com/Glavin001/atom-beautify/issues/1721). Changes required due to TextBuffer.save becoming async in Atom 1.19 From b3c9c3c2ab6d8744da3eb0a6fbfa6e245d27aba6 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sat, 11 Nov 2017 13:45:30 -0600 Subject: [PATCH 022/103] Add support for ocp-indent as an executable and Docker image docs --- README.md | 2 +- docs/options.md | 17 +++++++++++++++++ src/beautifiers/ocp-indent.coffee | 21 +++++++++++++++++++-- src/options.json | 16 ++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c47e015..a29dd9f 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall | Lua beautifier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Marko Beautifier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Nginx Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | -| ocp-indent | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://www.typerex.org/ocp-indent.html and follow the instructions. | +| ocp-indent | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [ocp-indent (`ocp-indent`)](https://www.typerex.org/ocp-indent.html) with `docker pull unibeautify/ocp-indent`

            :bookmark_tabs: Manually:
            1. Install [ocp-indent (`ocp-indent`)](https://www.typerex.org/ocp-indent.html) by following https://www.typerex.org/ocp-indent.html#installation
            | | Perltidy | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://perltidy.sourceforge.net/ and follow the instructions. | | PHP-CS-Fixer | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [PHP-CS-Fixer (`php-cs-fixer`)](https://github.com/FriendsOfPHP/PHP-CS-Fixer) with `docker pull unibeautify/php-cs-fixer`

            :bookmark_tabs: Manually:
            1. Install [PHP (`php`)](http://php.net/) by following http://php.net/manual/en/install.php
            2. Install [PHP-CS-Fixer (`php-cs-fixer`)](https://github.com/FriendsOfPHP/PHP-CS-Fixer) by following https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation
            | | PHPCBF | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [PHPCBF (`phpcbf`)](https://github.com/squizlabs/PHP_CodeSniffer) with `docker pull unibeautify/phpcbf`

            :bookmark_tabs: Manually:
            1. Install [PHP (`php`)](http://php.net/) by following http://php.net/manual/en/install.php
            2. Install [PHPCBF (`phpcbf`)](https://github.com/squizlabs/PHP_CodeSniffer) by following https://github.com/squizlabs/PHP_CodeSniffer#installation
            | diff --git a/docs/options.md b/docs/options.md index 7f3311d..e385be6 100644 --- a/docs/options.md +++ b/docs/options.md @@ -283,6 +283,23 @@ Options for isort executable. 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*isort*" and change it to your desired configuration. +##### [ocp-indent](#ocp-indent) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `object` + +**Description**: + +Options for ocp-indent 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 "*ocp-indent*" and change it to your desired configuration. + ##### [PHP](#php) **Important**: This option is only configurable from within Atom Beautify's setting panel. diff --git a/src/beautifiers/ocp-indent.coffee b/src/beautifiers/ocp-indent.coffee index 22c0463..49c6c55 100644 --- a/src/beautifiers/ocp-indent.coffee +++ b/src/beautifiers/ocp-indent.coffee @@ -8,7 +8,24 @@ Beautifier = require('./beautifier') module.exports = class OCPIndent extends Beautifier name: "ocp-indent" link: "https://www.typerex.org/ocp-indent.html" - isPreInstalled: false + executables: [ + { + name: "ocp-indent" + cmd: "ocp-indent" + homepage: "https://www.typerex.org/ocp-indent.html" + installation: "https://www.typerex.org/ocp-indent.html#installation" + version: { + parse: (text) -> + try + text.match(/version (\d+\.\d+\.\d+)/)[1] + catch + text.match(/version (\d+\.\d+)/)[1] + ".0" + } + docker: { + image: "unibeautify/ocp-indent" + } + } + ] options: { OCaml: true @@ -21,4 +38,4 @@ module.exports = class OCPIndent extends Beautifier help: { link: "https://www.typerex.org/ocp-indent.html" } - }) + }) \ No newline at end of file diff --git a/src/options.json b/src/options.json index 0eca25e..604a477 100644 --- a/src/options.json +++ b/src/options.json @@ -9320,6 +9320,22 @@ } } }, + "ocp-indent": { + "key": "ocp-indent", + "title": "ocp-indent", + "type": "object", + "collapsed": true, + "description": "Options for ocp-indent executable.", + "properties": { + "path": { + "key": "path", + "title": "Binary/Script Path", + "type": "string", + "default": "", + "description": "Absolute path to the \"ocp-indent\" executable's binary/script." + } + } + }, "php": { "key": "php", "title": "PHP", From f079330f8031fefa4c9aff0b07fec3cc6c202713 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sat, 11 Nov 2017 13:46:13 -0600 Subject: [PATCH 023/103] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e79819..2598c19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Next -- ... +- Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable # v0.30.6 (2017-10-30) - See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt. From 9db06679431c1fde71c5e0559578385c4a8fec12 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sat, 11 Nov 2017 13:47:20 -0600 Subject: [PATCH 024/103] Fix unit test error --- src/beautifiers/ocp-indent.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/beautifiers/ocp-indent.coffee b/src/beautifiers/ocp-indent.coffee index 49c6c55..7c196de 100644 --- a/src/beautifiers/ocp-indent.coffee +++ b/src/beautifiers/ocp-indent.coffee @@ -17,9 +17,9 @@ module.exports = class OCPIndent extends Beautifier version: { parse: (text) -> try - text.match(/version (\d+\.\d+\.\d+)/)[1] + text.match(/(\d+\.\d+\.\d+)/)[1] catch - text.match(/version (\d+\.\d+)/)[1] + ".0" + text.match(/(\d+\.\d+)/)[1] + ".0" } docker: { image: "unibeautify/ocp-indent" From a5c5d339a56dc356e9e86b59df0cf627954e02f4 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 21 Nov 2017 21:08:06 -0600 Subject: [PATCH 025/103] Refactor handleSaveEvent to use onWillSave async (#1924) * Update handleSaveEvent to use onWillSave and refactor * Remove old handleSaveEvent function * Specify minimum version of Atom of 1.21.0 --- package.json | 2 +- src/beautify.coffee | 29 +++++++---------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 394f8ce..7ea09f2 100644 --- a/package.json +++ b/package.json @@ -153,7 +153,7 @@ } ], "engines": { - "atom": ">=1.6.0 <2.0.0" + "atom": ">=1.21.0 <2.0.0" }, "dependencies": { "align-yaml": "^0.1.8", diff --git a/src/beautify.coffee b/src/beautify.coffee index 3a850a4..9b9aba9 100644 --- a/src/beautify.coffee +++ b/src/beautify.coffee @@ -506,20 +506,17 @@ debug = () -> handleSaveEvent = -> atom.workspace.observeTextEditors (editor) -> - pendingPaths = {} beautifyOnSaveHandler = ({path: filePath}) -> - logger.verbose('Should beautify on this save?') - if pendingPaths[filePath] - logger.verbose("Editor with file path #{filePath} already beautified!") - return - buffer = editor.getBuffer() path ?= require('path') - # Get Grammar - grammar = editor.getGrammar().name # Get file extension fileExtension = path.extname(filePath) # Remove prefix "." (period) in fileExtension fileExtension = fileExtension.substr(1) + # Set path of buffer for unsaved files + if editor.getPath() is undefined + editor.getBuffer().setPath(filePath) + # Get Grammar from the editor + grammar = editor.getGrammar().name # Get language languages = beautifier.languages.getLanguages({grammar, extension: fileExtension}) if languages.length < 1 @@ -535,23 +532,11 @@ handleSaveEvent = -> beautify({editor, onSave: true}) .then(() -> logger.verbose('Done beautifying file', filePath) - if editor.isAlive() is true - logger.verbose('Saving TextEditor...') - # Store the filePath to prevent infinite looping - # When Whitespace package has option "Ensure Single Trailing Newline" enabled - # It will add a newline and keep the file from converging on a beautified form - # and saving without emitting onDidSave event, because there were no changes. - pendingPaths[filePath] = true - Promise.resolve(editor.save()).then(() -> - delete pendingPaths[filePath] - logger.verbose('Saved TextEditor.') - ) ) .catch((error) -> return showError(error) ) - disposable = editor.onDidSave(({path : filePath}) -> - # TODO: Implement debouncing + disposable = editor.getBuffer().onWillSave(({path: filePath}) -> beautifyOnSaveHandler({path: filePath}) ) plugin.subscriptions.add disposable @@ -632,4 +617,4 @@ plugin.activate = -> @addLanguageCommands() plugin.deactivate = -> - @subscriptions.dispose() + @subscriptions.dispose() \ No newline at end of file From 159f6c1a132c30e2a93a59fd1637e9b07213a00f Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 21 Nov 2017 23:13:56 -0400 Subject: [PATCH 026/103] See #1895, #1924. Update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e79819..b1c57e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Next - ... +# v0.30.7 (2017-11-21) +- Refactor handleSaveEvent to use onWillSave async ([#1924](https://github.com/Glavin001/atom-beautify/pull/1924), [#1895](https://github.com/Glavin001/atom-beautify/issues/1895)) + # v0.30.6 (2017-10-30) - See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt. - See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2! From 6043983c70b055215acd3029a385263a5b830fc6 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 21 Nov 2017 23:14:53 -0400 Subject: [PATCH 027/103] 0.30.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ea09f2..fc48160 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.6", + "version": "0.30.7", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 8eee55bf2d62afb4f9f6a7e59c4a15bea7f56a27 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 21 Nov 2017 23:15:30 -0400 Subject: [PATCH 028/103] Revert to v0.30.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc48160..7ea09f2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.7", + "version": "0.30.6", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 2c87c50f2fc0d4c455352d5729cc733086d18ff0 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 21 Nov 2017 23:15:42 -0400 Subject: [PATCH 029/103] Prepare 0.30.7 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ea09f2..fc48160 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.6", + "version": "0.30.7", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From e167e6881a0053de44ab83457d833175e92b9fb1 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 21 Nov 2017 23:20:49 -0400 Subject: [PATCH 030/103] Revert to v0.30.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc48160..7ea09f2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.7", + "version": "0.30.6", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 2690d2665b0ace3b836b6a0628fa34914d5b70c3 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 21 Nov 2017 23:20:57 -0400 Subject: [PATCH 031/103] Prepare 0.30.7 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ea09f2..fc48160 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.6", + "version": "0.30.7", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 63c50ec7b3c4e9b006c2bae9ff5d2664c0325b62 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 09:56:43 -0400 Subject: [PATCH 032/103] Fix #1948, #1949. Fix beautify on save when text has not changed --- src/beautify.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautify.coffee b/src/beautify.coffee index 9b9aba9..bae3f81 100644 --- a/src/beautify.coffee +++ b/src/beautify.coffee @@ -135,7 +135,7 @@ beautify = ({ editor, onSave, language }) -> else error = new Error("Unsupported beautification result '#{text}'.") showError(error) - return reject(error) + return setTimeout(-> resolve(text), 0) # else # console.log "Already Beautiful!" From ab208351dd4a7ebc810acc19062d9583bf930f2b Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 09:58:26 -0400 Subject: [PATCH 033/103] #1948, #1949. Update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c57e7..08a4359 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Next - ... +# v0.30.8 (2017-11-22) +- Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed. + # v0.30.7 (2017-11-21) - Refactor handleSaveEvent to use onWillSave async ([#1924](https://github.com/Glavin001/atom-beautify/pull/1924), [#1895](https://github.com/Glavin001/atom-beautify/issues/1895)) From 56d1f48bada8e38519701044da3d43d9c9489920 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 09:58:33 -0400 Subject: [PATCH 034/103] Prepare 0.30.8 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc48160..49ae598 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.7", + "version": "0.30.8", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From fafd8c2991a78610e05587dfa7d5862a2451a827 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 09:59:03 -0400 Subject: [PATCH 035/103] Prepare 0.30.9 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49ae598..c8c62a3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.8", + "version": "0.30.9", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 5e8ee37b07e8152270d7d0f43fa9d6ebdd64add5 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:00:29 -0400 Subject: [PATCH 036/103] Prepare 0.30.10 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8c62a3..7b20c1d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.9", + "version": "0.30.10", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From b806475d9f7756f78911af7b2fcce316a8d937f8 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:03:36 -0400 Subject: [PATCH 037/103] Prepare 0.30.11 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b20c1d..81ef630 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.10", + "version": "0.30.11", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 948671fe8a49d505f246ffe6a798ffc619d1ab28 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:07:25 -0400 Subject: [PATCH 038/103] Prepare 0.30.12 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 81ef630..81b677f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.11", + "version": "0.30.12", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 386924e59fd2237f5c10fcda5f31ecbd8d2285fb Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:11:31 -0400 Subject: [PATCH 039/103] Revert to v0.30.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 81b677f..fc48160 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.12", + "version": "0.30.7", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From ffc94e92baeaeb52000a9ca9163a3ce4c5ad3209 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:11:40 -0400 Subject: [PATCH 040/103] Prepare 0.30.8 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc48160..49ae598 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.7", + "version": "0.30.8", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From ef35eec706a2c74bddfa84fe558c6df5879e7316 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:12:58 -0400 Subject: [PATCH 041/103] Prepare 0.30.9 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49ae598..c8c62a3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.8", + "version": "0.30.9", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From b86c2bec483a522e7767751b6eaacf69c0a0c2fa Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:17:11 -0400 Subject: [PATCH 042/103] Revert to v0.30.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8c62a3..fc48160 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.9", + "version": "0.30.7", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 1b223e3e4c6cd1c1d3f6e7f88e9f45411e9b30e2 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:17:21 -0400 Subject: [PATCH 043/103] Prepare 0.30.8 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc48160..49ae598 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.7", + "version": "0.30.8", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 6713d20780e8e9c7155085152aa184d2883d04b5 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:35:44 -0400 Subject: [PATCH 044/103] Prepare 0.30.8 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc48160..49ae598 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.7", + "version": "0.30.8", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From c6760ef3fea927d0e996bf2aaa201e4c73f46f38 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:50:47 -0400 Subject: [PATCH 045/103] Fix #1948, #1949. Fix beautify on save when text has not changed --- CHANGELOG.md | 3 +++ src/beautify.coffee | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08a4359..a674ec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Next - ... +# v0.30.9 (2017-11-22) +- Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed. + # v0.30.8 (2017-11-22) - Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed. diff --git a/src/beautify.coffee b/src/beautify.coffee index bae3f81..af517ec 100644 --- a/src/beautify.coffee +++ b/src/beautify.coffee @@ -96,9 +96,10 @@ beautify = ({ editor, onSave, language }) -> if not text? # Do nothing, is undefined # console.log 'beautifyCompleted' + return resolve(text) else if text instanceof Error showError(text) - return reject(text) + return resolve(text) else if typeof text is "string" if oldText isnt text @@ -127,15 +128,18 @@ beautify = ({ editor, onSave, language }) -> # otherwise setScrollTop is not working, probably because the cursor # addition happens asynchronously setTimeout ( -> - # console.log "setScrollTop" setScrollTop editor, origScrollTop return resolve(text) ), 0 + else + return setTimeout(() -> + resolve(text) + , 0) else error = new Error("Unsupported beautification result '#{text}'.") showError(error) - return setTimeout(-> resolve(text), 0) + return resolve(text) # else # console.log "Already Beautiful!" From 03c2a03cb18d6b89bf76abeb40fa5dfe23ea34bf Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:51:59 -0400 Subject: [PATCH 046/103] Change repository to using git instead of https --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49ae598..c27bd1f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { "type": "git", - "url": "https://github.com/Glavin001/atom-beautify" + "url": "git@github.com:Glavin001/atom-beautify.git" }, "bugs": { "url": "https://github.com/Glavin001/atom-beautify/issues" From 0ba7fc58175f3b3b7e3701e8b286cdaaa1169c5c Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 22 Nov 2017 10:52:23 -0400 Subject: [PATCH 047/103] Prepare 0.30.9 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c27bd1f..8898cdd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.30.8", + "version": "0.30.9", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom", "repository": { From 1659aa8ec0eb469fe9e39e858d22233159476ff9 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Fri, 15 Dec 2017 23:12:58 -0600 Subject: [PATCH 048/103] Add ensurepip flag for Travis build issues --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 0b2e4ca..6cd3b4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,6 +88,7 @@ cache: before_install: # Install Homebrew on Linux + - python -m ensurepip - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git clone --depth=1 https://github.com/Linuxbrew/brew.git ~/.linuxbrew || true; fi From 8722279281184c7656d18163268ca86c09c99a93 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Fri, 15 Dec 2017 23:19:35 -0600 Subject: [PATCH 049/103] Revert addition of ensurepip --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6cd3b4f..0b2e4ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,6 @@ cache: before_install: # Install Homebrew on Linux - - python -m ensurepip - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git clone --depth=1 https://github.com/Linuxbrew/brew.git ~/.linuxbrew || true; fi From cae8a76651a5f4942dc4fda5d3726febe0a7984e Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 25 Dec 2017 04:54:49 -0400 Subject: [PATCH 050/103] Add poll about cloud service to README --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index c47e015..014a00d 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,18 @@ Thank you. Atom-Beautify is going to be completely rewritten with [Unibeautify](https://github.com/Unibeautify/unibeautify) at its core! See [`unibeautify` branch](../../tree/unibeautify) for work in progress and [Issue #1174](https://github.com/Glavin001/atom-beautify/issues/1174). +### Poll: Improving installation of third-party beautifiers + +Many users are experiencing issues when installing third party beautifiers (e.g. Uncrustify, PHP-CS-Fixer, and many more). +A possible solution is a "cloud" service which provides remote access to these beautifiers. Atom-Beautify would then communicate with these services, allowing for zero-installation beautification. + +Please let us know what you think! + +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet/vote) + ## Beautifiers Some of the supported beautifiers are developed for Node.js and are automatically installed when Atom-Beautify is installed. However, other beautifiers are command-line interface (CLI) applications and require you to manually install them. From f201a0a026062b3c51b53788f98f657cccba7697 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 25 Dec 2017 04:55:19 -0400 Subject: [PATCH 051/103] Add poll about cloud service to README-template --- README-template.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README-template.md b/README-template.md index 911743d..fa7e9c9 100644 --- a/README-template.md +++ b/README-template.md @@ -65,6 +65,18 @@ Thank you. Atom-Beautify is going to be completely rewritten with [Unibeautify](https://github.com/Unibeautify/unibeautify) at its core! See [`unibeautify` branch](../../tree/unibeautify) for work in progress and [Issue #1174](https://github.com/Glavin001/atom-beautify/issues/1174). +### Poll: Improving installation of third-party beautifiers + +Many users are experiencing issues when installing third party beautifiers (e.g. Uncrustify, PHP-CS-Fixer, and many more). +A possible solution is a "cloud" service which provides remote access to these beautifiers. Atom-Beautify would then communicate with these services, allowing for zero-installation beautification. + +Please let us know what you think! + +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet/vote) + ## Beautifiers Some of the supported beautifiers are developed for Node.js and are automatically installed when Atom-Beautify is installed. However, other beautifiers are command-line interface (CLI) applications and require you to manually install them. From 62cc0696121e694cb48d0d55052ca44e926767d6 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 25 Dec 2017 06:06:03 -0400 Subject: [PATCH 052/103] Add link to questionnaire --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 014a00d..601c4b1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ [![Bountysource](https://img.shields.io/bountysource/team/atom-beautify/activity.svg?style=flat-square)](https://www.bountysource.com/teams/atom-beautify) [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) +**Help improve Atom-Beautify by completing the questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** + | Mac OS and | | | --- | --- | | [Travis CI: ![Build Status](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master)](https://travis-ci.org/Glavin001/atom-beautify) | [AppVeyor: ![Build status](https://ci.appveyor.com/api/projects/status/himnq7tjxl2fdc8u/branch/master?svg=true)](https://ci.appveyor.com/project/Glavin001/atom-beautify/branch/master) | From 8de12b97775ca33c8a2427af43445df647ede16e Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 25 Dec 2017 06:06:31 -0400 Subject: [PATCH 053/103] Add link to questionnaire to README-template --- README-template.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README-template.md b/README-template.md index fa7e9c9..bd514f3 100644 --- a/README-template.md +++ b/README-template.md @@ -7,6 +7,8 @@ [![Bountysource](https://img.shields.io/bountysource/team/atom-beautify/activity.svg?style=flat-square)](https://www.bountysource.com/teams/atom-beautify) [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) +**Help improve Atom-Beautify by completing the questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** + | Mac OS and | | | --- | --- | | [Travis CI: ![Build Status](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master)](https://travis-ci.org/Glavin001/atom-beautify) | [AppVeyor: ![Build status](https://ci.appveyor.com/api/projects/status/himnq7tjxl2fdc8u/branch/master?svg=true)](https://ci.appveyor.com/project/Glavin001/atom-beautify/branch/master) | From a60ba02a7a1c4a36dbd60fcf68cf8e93a7e17fdb Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 2 Jan 2018 23:32:49 -0600 Subject: [PATCH 054/103] Use pip2 for OSX, php 7.2 for Windows --- .travis.yml | 10 +++++----- appveyor.yml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b2e4ca..f12cc1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,15 +113,15 @@ before_install: pip install --user --upgrade autopep8; pip install --user --upgrade isort; else - pip install --upgrade pip; - pip install --upgrade autopep8; - pip install --upgrade isort; + pip2 install --upgrade pip2; + pip2 install --upgrade autopep8; + pip2 install --upgrade isort; fi # SQL language support - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pip install --user --upgrade sqlparse; else - pip install --upgrade sqlparse; + pip2 install --upgrade sqlparse; fi # Java, C, C++, C#, Objective-C, D, Pawn, Vala - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then @@ -184,7 +184,7 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pip install --user beautysh; else - pip install beautysh; + pip2 install beautysh; fi # terraform - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then diff --git a/appveyor.yml b/appveyor.yml index bf21dfb..e3fb5d8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -107,8 +107,8 @@ install: # PHP - ps: Set-Service wuauserv -StartupType Manual - cinst php -y - - ps: "ls \"C:\\tools\\php71\"" - - "SET PATH=C:\\tools\\php71;%PATH%" + - ps: "ls \"C:\\tools\\php72\"" + - "SET PATH=C:\\tools\\php72;%PATH%" - where php # PHP-CS-Fixer - cinst curl -y # Use cURL to download file from URL From 05669035fc9d80e13524d540baeb8315a7b94c05 Mon Sep 17 00:00:00 2001 From: Colin Hebert Date: Mon, 8 Jan 2018 12:06:06 +0100 Subject: [PATCH 055/103] Use docker image to run puppet-lint Use unibeautify/puppet-lint that provides puppet-lint in docker. --- src/beautifiers/puppet-fix.coffee | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/beautifiers/puppet-fix.coffee b/src/beautifiers/puppet-fix.coffee index 4ae96ed..cd01021 100644 --- a/src/beautifiers/puppet-fix.coffee +++ b/src/beautifiers/puppet-fix.coffee @@ -8,21 +8,28 @@ module.exports = class PuppetFix extends Beautifier # this is what displays as your Default Beautifier in Language Config name: "puppet-lint" link: "http://puppet-lint.com/" - isPreInstalled: false options: { Puppet: true } - cli: (options) -> - if not options.puppet_path? - return new Error("'puppet-lint' path is not set!" + - " Please set this in the Atom Beautify package settings.") - else - return options.puppet_path + executables: [ + { + name: "puppet-lint" + cmd: "puppet-lint" + homepage: "http://puppet-lint.com/" + installation: "http://puppet-lint.com/" + version: { + parse: (text) -> text.match(/puppet-lint (\d+\.\d+\.\d+)/)[1] + } + docker: { + image: "unibeautify/puppet-lint" + } + } + ] beautify: (text, language, options) -> - @run("puppet-lint", [ + @exe("puppet-lint", [ '--fix' tempFile = @tempFile("input", text) ], { From a0ae81f51965ac89d119da8fc2d91778e3d4b458 Mon Sep 17 00:00:00 2001 From: Colin Hebert Date: Mon, 8 Jan 2018 20:31:30 +0100 Subject: [PATCH 056/103] Run npm run docs --- README.md | 2 +- docs/options.md | 17 +++++++++++++++++ src/options.json | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 601c4b1..c81cb1d 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall | PHPCBF | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [PHPCBF (`phpcbf`)](https://github.com/squizlabs/PHP_CodeSniffer) with `docker pull unibeautify/phpcbf`

            :bookmark_tabs: Manually:
            1. Install [PHP (`php`)](http://php.net/) by following http://php.net/manual/en/install.php
            2. Install [PHPCBF (`phpcbf`)](https://github.com/squizlabs/PHP_CodeSniffer) by following https://github.com/squizlabs/PHP_CodeSniffer#installation
            | | Pretty Diff | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Pug Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | -| puppet-lint | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://puppet-lint.com/ and follow the instructions. | +| puppet-lint | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) with `docker pull unibeautify/puppet-lint`

            :bookmark_tabs: Manually:
            1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) by following http://puppet-lint.com/
            | | pybeautifier | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/guyskk/pybeautifier and follow the instructions. | | Remark | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Rubocop | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/bbatsov/rubocop and follow the instructions. | diff --git a/docs/options.md b/docs/options.md index 7f3311d..273168a 100644 --- a/docs/options.md +++ b/docs/options.md @@ -334,6 +334,23 @@ Options for PHPCBF executable. 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*PHPCBF*" and change it to your desired configuration. +##### [puppet-lint](#puppet-lint) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `object` + +**Description**: + +Options for puppet-lint 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 "*puppet-lint*" and change it to your desired configuration. + ##### [Rscript](#rscript) **Important**: This option is only configurable from within Atom Beautify's setting panel. diff --git a/src/options.json b/src/options.json index 0eca25e..d82a0c8 100644 --- a/src/options.json +++ b/src/options.json @@ -9368,6 +9368,22 @@ } } }, + "puppet-lint": { + "key": "puppet-lint", + "title": "puppet-lint", + "type": "object", + "collapsed": true, + "description": "Options for puppet-lint executable.", + "properties": { + "path": { + "key": "path", + "title": "Binary/Script Path", + "type": "string", + "default": "", + "description": "Absolute path to the \"puppet-lint\" executable's binary/script." + } + } + }, "sass-convert": { "key": "sass-convert", "title": "SassConvert", From 999f57630fc0a14597ee7eb4aa0c855c9cd0a865 Mon Sep 17 00:00:00 2001 From: Colin Hebert Date: Mon, 8 Jan 2018 20:45:02 +0100 Subject: [PATCH 057/103] Fix exe.run notation --- src/beautifiers/puppet-fix.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/puppet-fix.coffee b/src/beautifiers/puppet-fix.coffee index cd01021..4a22325 100644 --- a/src/beautifiers/puppet-fix.coffee +++ b/src/beautifiers/puppet-fix.coffee @@ -29,7 +29,7 @@ module.exports = class PuppetFix extends Beautifier ] beautify: (text, language, options) -> - @exe("puppet-lint", [ + @exe("puppet-lint").run([ '--fix' tempFile = @tempFile("input", text) ], { From 2fb54ce7172069566fa3e6d9b284bacd9c7ae2cf Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 9 Jan 2018 14:55:53 -0400 Subject: [PATCH 058/103] Add Twitter badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 951a101..040ec4e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Gitter](https://img.shields.io/gitter/room/Glavin001/atom-beautify.svg?style=flat-square)](https://gitter.im/Glavin001/atom-beautify) [![Bountysource](https://img.shields.io/bountysource/team/atom-beautify/activity.svg?style=flat-square)](https://www.bountysource.com/teams/atom-beautify) [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) +[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) **Help improve Atom-Beautify by completing the questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** From 3a4f982bfe8f9f0e123f0039b182a882440db7d9 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 9 Jan 2018 14:58:50 -0400 Subject: [PATCH 059/103] Add Twitter badge to README-template --- README-template.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README-template.md b/README-template.md index bd514f3..ec5ab35 100644 --- a/README-template.md +++ b/README-template.md @@ -6,6 +6,7 @@ [![Gitter](https://img.shields.io/gitter/room/Glavin001/atom-beautify.svg?style=flat-square)](https://gitter.im/Glavin001/atom-beautify) [![Bountysource](https://img.shields.io/bountysource/team/atom-beautify/activity.svg?style=flat-square)](https://www.bountysource.com/teams/atom-beautify) [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) +[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) **Help improve Atom-Beautify by completing the questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** From 615f4cff783e5f4a0aa05134cfe9a8d8ed4af10b Mon Sep 17 00:00:00 2001 From: Stephen Date: Fri, 5 Jan 2018 21:04:01 -0800 Subject: [PATCH 060/103] Cleanup build --- .travis.yml | 166 +++++++---------------------------- Brewfile | 12 +++ Gemfile | 6 ++ appveyor.yml | 123 +++----------------------- appveyor/install.ps1 | 180 -------------------------------------- appveyor/run_with_env.cmd | 47 ---------- atom-packages.txt | 9 ++ build-package.sh | 60 ++----------- composer.json | 5 ++ packages.config | 9 ++ requirements.txt | 4 + 11 files changed, 95 insertions(+), 526 deletions(-) create mode 100644 Brewfile create mode 100644 Gemfile delete mode 100644 appveyor/install.ps1 delete mode 100644 appveyor/run_with_env.cmd create mode 100644 atom-packages.txt create mode 100644 composer.json create mode 100644 packages.config create mode 100644 requirements.txt diff --git a/.travis.yml b/.travis.yml index f12cc1e..5da898d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,53 +11,22 @@ notifications: script: sh build-package.sh +cache: + timeout: 1000 + git: - depth: 10 + depth: 1 -php: - - '5.6' -python: - - '2.7' -go: - - release - -matrix: - include: - - os: linux - dist: trusty - sudo: required - services: - - docker - env: - - ATOM_CHANNEL=stable - - os: linux - dist: trusty - sudo: required - services: - - docker - env: - - ATOM_CHANNEL=beta - # - os: linux - # dist: trusty - # sudo: require - # env: - # - ATOM_CHANNEL=stable - # - os: linux - # dist: trusty - # sudo: require - # env: - # - ATOM_CHANNEL=beta - - os: osx - env: - - ATOM_CHANNEL=stable - # - os: osx - # env: - # - ATOM_CHANNEL=beta +os: + - linux + - osx +sudo: required env: global: - - APM_TEST_PACKAGES="language-marko language-html-swig language-svg language-d mavensmate-atom language-lua language-puppet fuse" - - PATH="/home/travis/gopath/bin:$HOME/.linuxbrew/bin:$PATH" + matrix: + - ATOM_SCRIPT_NAME=atom-beta APM_SCRIPT_NAME=apm-beta + - ATOM_SCRIPT_NAME=atom APM_SCRIPT_NAME=apm addons: apt: @@ -71,9 +40,7 @@ addons: - libgnome-keyring-dev - fakeroot - crystal - - ocaml - camlp4 - - opam - php5-cli - golang @@ -84,111 +51,38 @@ cache: - vendor/bundle # gems are installed here, https://docs.travis-ci.com/user/languages/ruby/#Dependency-Management - node_modules - $HOME/.atom - - $HOME/.stack + - $HOME/.opam before_install: - # Install Homebrew on Linux + # linux: Install Nix, Nix packages, upgrade pip, and install python packages + # osx: Update Homebrew, remove conflicting cask, brew bundle, symlink elm-format, + # upgrade pip, and install python packages - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - git clone --depth=1 https://github.com/Linuxbrew/brew.git ~/.linuxbrew || true; + curl https://nixos.org/nix/install | sh && + . ~/.nix-profile/etc/profile.d/nix.sh && + nix-env -i uncrustify R elm-format terraform atom atom-beta opam && + pip install --upgrade pip && + pip install --user -r requirements.txt; + elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew update && brew cask zap oclint && brew bundle && + ln -s /usr/local/bin/elm-format-0.17 /usr/local/bin/elm-format && + pip2 install --upgrade pip && + pip2 install -r requirements.txt; + else + echo Error:TRAVIS_OS_NAME && exit 1; fi - # Update Homebrew - - brew update - - brew tap homebrew/dupes - - brew tap homebrew/versions # Ruby language support - # - gem install ruby-beautify --verbose - # - gem install rubocop - - gem install htmlbeautifier - - gem install puppet-lint - # Sass language support - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - gem install sass; - else - docker pull unibeautify/sass-convert; - fi - # Python language support - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - sudo chmod 777 -R /opt/python; - pip install --upgrade pip; - pip install --user --upgrade autopep8; - pip install --user --upgrade isort; - else - pip2 install --upgrade pip2; - pip2 install --upgrade autopep8; - pip2 install --upgrade isort; - fi - # SQL language support - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - pip install --user --upgrade sqlparse; - else - pip2 install --upgrade sqlparse; - fi - # Java, C, C++, C#, Objective-C, D, Pawn, Vala - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install uncrustify; - else - docker pull unibeautify/uncrustify; - fi + - bundle install # R - - brew tap homebrew/science - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install r; - rscript --version; - else - docker pull unibeautify/rscript; - fi + - Rscript --version # PHP - - brew tap homebrew/homebrew-php - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install php56 || true; - brew gist-logs php56 || true; - echo -e "\n[Phar]\nphar.readonly = Off\n" >> /usr/local/etc/php/5.6/php.ini; - brew install php-cs-fixer || true; - brew gist-logs php-cs-fixer || true; - fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - wget http://get.sensiolabs.org/php-cs-fixer.phar -O php-cs-fixer; - chmod a+x php-cs-fixer; - mv php-cs-fixer $HOME/.linuxbrew/bin/php-cs-fixer; - fi + - composer install # CoffeeScript - npm install coffee-formatter - # Haskell - # - brew install haskell-stack - # - stack setup - # - stack install stylish-haskell - # Elm - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - curl -L -o /tmp/elm-format.tgz - https://github.com/avh4/elm-format/releases/download/0.7.0-exp/elm-format-0.17-0.7.0-exp-mac-x64.tgz; - tar xvzf /tmp/elm-format.tgz -C /usr/local/bin; - fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - curl -L -o /tmp/elm-format.tgz https://github.com/avh4/elm-format/releases/download/0.7.0-exp/elm-format-0.17-0.7.0-exp-linux-x64.tgz; - tar xvzf /tmp/elm-format.tgz -C $HOME/.linuxbrew/bin; - fi # OCaml - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install ocaml; - brew install opam; - fi - opam init --auto-setup # Init environment variables for opam - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; fi - opam install --yes ocp-indent - # Crystal - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install crystal-lang; fi - # Bash - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - pip install --user beautysh; - else - pip2 install beautysh; - fi - # terraform - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install terraform; - else - docker pull hashicorp/terraform; - fi diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..486f415 --- /dev/null +++ b/Brewfile @@ -0,0 +1,12 @@ +tap 'homebrew/science' +tap 'homebrew/php' +tap 'caskroom/versions' +brew 'uncrustify' +brew 'r' +brew 'composer' +brew 'opam' +brew 'crystal-lang' +brew 'terraform' +brew 'elm-format' +cask 'atom' +cask 'atom-beta' diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..4805589 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "rubocop" +gem "htmlbeautifier" +gem "puppet-lint" +gem "sass" diff --git a/appveyor.yml b/appveyor.yml index e3fb5d8..d82f7f6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,136 +10,35 @@ environment: # /E:ON and /V:ON options are not enabled in the batch script intepreter # See: http://stackoverflow.com/a/13751649/163740 CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" - - matrix: - - PYTHON: "C:\\Python27" - PYTHON_VERSION: "2.7.8" - PYTHON_ARCH: "32" - RUBY_VERSION: 23 - - # - PYTHON: "C:\\Python27-x64" - # PYTHON_VERSION: "2.7.8" - # PYTHON_ARCH: "64" - # - # - PYTHON: "C:\\Python33" - # PYTHON_VERSION: "3.3.5" - # PYTHON_ARCH: "32" - # - # - PYTHON: "C:\\Python33-x64" - # PYTHON_VERSION: "3.3.5" - # PYTHON_ARCH: "64" - # - # - PYTHON: "C:\\Python34" - # PYTHON_VERSION: "3.4.1" - # PYTHON_ARCH: "32" - # - # - PYTHON: "C:\\Python34-x64" - # PYTHON_VERSION: "3.4.1" - # PYTHON_ARCH: "64" + PATH: C:\Ruby23\bin;C:\Ruby23-x64\DevKit\mingw\bin;C:\Python27;C:\Python27\Scripts;%PATH% init: - cmd: rd /s /q %CHOCOLATEYINSTALL% - ps: iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) install: - - - ECHO "Filesystem root:" - - ps: "ls \"C:/\"" - - - cinst atom -y - - cd %APPVEYOR_BUILD_FOLDER% - # Add Atom's bin (apm, etc) to PATH - - SET PATH=%LOCALAPPDATA%\atom\bin;%PATH% + - cinst packages.config -y + - refreshenv - apm install - # Install CLI beautifiers + # https://packaging.python.org/guides/supporting-windows-using-appveyor/ + - pip install -r requirements.txt - # Install Python (from the official .msi of http://python.org) and pip when - # not already installed. - - "powershell ./appveyor/install.ps1" + # Gemfile Install + - bundle install - # Prepend newly installed Python to the PATH of this build (this cannot be - # done from inside the powershell script as it would require to restart - # the parent CMD process). - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - # Check that we have the expected version and architecture for Python - - "python --version" - - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - - # Install the build dependencies of the project. If some dependencies contain - # compiled extensions and are not provided as pre-built wheel packages, - # pip will build them from source using the MSVC compiler matching the - # target Python version and architecture - - "%CMD_IN_ENV% pip install --upgrade autopep8" - - where autopep8 - - - "%CMD_IN_ENV% pip install --upgrade isort" - - where isort - - - "%CMD_IN_ENV% pip install --upgrade sqlparse" - - # Ruby & Gem - - SET PATH=C:\Ruby%RUBY_VERSION%\bin;C:\Ruby23-x64\DevKit\mingw\bin;%PATH% - # Rubocop - - gem install rubocop - - where rubocop - # HTMLBeautifier - - gem install htmlbeautifier - - where htmlbeautifier - # Puppet-Lint - - gem install puppet-lint - - where puppet-lint - # Sass - - gem install sass - - where sass-convert - - # emacs - - cinst emacs -y - - where emacs - - # terraform - - cinst terraform -y - - where terraform - - # FIXME: Enable allowEmptyChecksums, until someone fixes the checksum issue of php - - choco feature enable -n allowEmptyChecksums # PHP - ps: Set-Service wuauserv -StartupType Manual - - cinst php -y - - ps: "ls \"C:\\tools\\php72\"" - - "SET PATH=C:\\tools\\php72;%PATH%" - - where php # PHP-CS-Fixer - - cinst curl -y # Use cURL to download file from URL - - curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer - - "SET PATH=%cd%;%PATH%" # Add current working directory to PATH - - where php-cs-fixer - - # Uncrustify - - curl -k -L https://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.65/uncrustify-0.65-win32.zip/download -o uncrustify.zip - - cinst 7zip.commandline -y - - 7za e uncrustify.zip -ouncrustify-d - - "SET PATH=%cd%\\uncrustify-d;%PATH%" - - where uncrustify + - composer install # elm-format - - curl -k -L https://github.com/avh4/elm-format/releases/download/0.7.0-exp/elm-format-0.18-0.7.0-exp-win-i386.zip -o elm-format.zip - - 7za e elm-format.zip -oelm-format-d - - "SET PATH=%cd%\\elm-format-d;%PATH%" - - where elm-format - - # Beautysh - - pip install beautysh - - where beautysh - + - npm install -g elm-format@exp + build_script: - - cd %APPVEYOR_BUILD_FOLDER% # Install languages to Atom - - apm install language-marko language-html-swig language-svg language-elm language-d mavensmate-atom language-lua language-puppet fuse - # Show current PATH - - echo %PATH% + - apm install --packages-file atom-packages.txt # Run tests on package #- "%LOCALAPPDATA%\\atom\\bin\\atom.cmd --test spec" - apm test --path %LOCALAPPDATA%/atom/bin/atom.cmd diff --git a/appveyor/install.ps1 b/appveyor/install.ps1 deleted file mode 100644 index 0f165d8..0000000 --- a/appveyor/install.ps1 +++ /dev/null @@ -1,180 +0,0 @@ -# Sample script to install Python and pip under Windows -# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner -# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ - -$MINICONDA_URL = "http://repo.continuum.io/miniconda/" -$BASE_URL = "https://www.python.org/ftp/python/" -$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" -$GET_PIP_PATH = "C:\get-pip.py" - - -function DownloadPython ($python_version, $platform_suffix) { - $webclient = New-Object System.Net.WebClient - $filename = "python-" + $python_version + $platform_suffix + ".msi" - $url = $BASE_URL + $python_version + "/" + $filename - - $basedir = $pwd.Path + "\" - $filepath = $basedir + $filename - if (Test-Path $filename) { - Write-Host "Reusing" $filepath - return $filepath - } - - # Download and retry up to 3 times in case of network transient errors. - Write-Host "Downloading" $filename "from" $url - $retry_attempts = 2 - for($i=0; $i -lt $retry_attempts; $i++){ - try { - $webclient.DownloadFile($url, $filepath) - break - } - Catch [Exception]{ - Start-Sleep 1 - } - } - if (Test-Path $filepath) { - Write-Host "File saved at" $filepath - } else { - # Retry once to get the error message if any at the last try - $webclient.DownloadFile($url, $filepath) - } - return $filepath -} - - -function InstallPython ($python_version, $architecture, $python_home) { - Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home - if (Test-Path $python_home) { - Write-Host $python_home "already exists, skipping." - return $false - } - if ($architecture -eq "32") { - $platform_suffix = "" - } else { - $platform_suffix = ".amd64" - } - $msipath = DownloadPython $python_version $platform_suffix - Write-Host "Installing" $msipath "to" $python_home - $install_log = $python_home + ".log" - $install_args = "/qn /log $install_log /i $msipath TARGETDIR=$python_home" - $uninstall_args = "/qn /x $msipath" - RunCommand "msiexec.exe" $install_args - if (-not(Test-Path $python_home)) { - Write-Host "Python seems to be installed else-where, reinstalling." - RunCommand "msiexec.exe" $uninstall_args - RunCommand "msiexec.exe" $install_args - } - if (Test-Path $python_home) { - Write-Host "Python $python_version ($architecture) installation complete" - } else { - Write-Host "Failed to install Python in $python_home" - Get-Content -Path $install_log - Exit 1 - } -} - -function RunCommand ($command, $command_args) { - Write-Host $command $command_args - Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru -} - - -function InstallPip ($python_home) { - $pip_path = $python_home + "\Scripts\pip.exe" - $python_path = $python_home + "\python.exe" - if (-not(Test-Path $pip_path)) { - Write-Host "Installing pip..." - $webclient = New-Object System.Net.WebClient - $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) - Write-Host "Executing:" $python_path $GET_PIP_PATH - Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru - } else { - Write-Host "pip already installed." - } -} - - -function DownloadMiniconda ($python_version, $platform_suffix) { - $webclient = New-Object System.Net.WebClient - if ($python_version -eq "3.4") { - $filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe" - } else { - $filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe" - } - $url = $MINICONDA_URL + $filename - - $basedir = $pwd.Path + "\" - $filepath = $basedir + $filename - if (Test-Path $filename) { - Write-Host "Reusing" $filepath - return $filepath - } - - # Download and retry up to 3 times in case of network transient errors. - Write-Host "Downloading" $filename "from" $url - $retry_attempts = 2 - for($i=0; $i -lt $retry_attempts; $i++){ - try { - $webclient.DownloadFile($url, $filepath) - break - } - Catch [Exception]{ - Start-Sleep 1 - } - } - if (Test-Path $filepath) { - Write-Host "File saved at" $filepath - } else { - # Retry once to get the error message if any at the last try - $webclient.DownloadFile($url, $filepath) - } - return $filepath -} - - -function InstallMiniconda ($python_version, $architecture, $python_home) { - Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home - if (Test-Path $python_home) { - Write-Host $python_home "already exists, skipping." - return $false - } - if ($architecture -eq "32") { - $platform_suffix = "x86" - } else { - $platform_suffix = "x86_64" - } - $filepath = DownloadMiniconda $python_version $platform_suffix - Write-Host "Installing" $filepath "to" $python_home - $install_log = $python_home + ".log" - $args = "/S /D=$python_home" - Write-Host $filepath $args - Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru - if (Test-Path $python_home) { - Write-Host "Python $python_version ($architecture) installation complete" - } else { - Write-Host "Failed to install Python in $python_home" - Get-Content -Path $install_log - Exit 1 - } -} - - -function InstallMinicondaPip ($python_home) { - $pip_path = $python_home + "\Scripts\pip.exe" - $conda_path = $python_home + "\Scripts\conda.exe" - if (-not(Test-Path $pip_path)) { - Write-Host "Installing pip..." - $args = "install --yes pip" - Write-Host $conda_path $args - Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru - } else { - Write-Host "pip already installed." - } -} - -function main () { - InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON - InstallPip $env:PYTHON -} - -main diff --git a/appveyor/run_with_env.cmd b/appveyor/run_with_env.cmd deleted file mode 100644 index 3a472bc..0000000 --- a/appveyor/run_with_env.cmd +++ /dev/null @@ -1,47 +0,0 @@ -:: To build extensions for 64 bit Python 3, we need to configure environment -:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) -:: -:: To build extensions for 64 bit Python 2, we need to configure environment -:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) -:: -:: 32 bit builds do not require specific environment configurations. -:: -:: Note: this script needs to be run with the /E:ON and /V:ON flags for the -:: cmd interpreter, at least for (SDK v7.0) -:: -:: More details at: -:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows -:: http://stackoverflow.com/a/13751649/163740 -:: -:: Author: Olivier Grisel -:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ -@ECHO OFF - -SET COMMAND_TO_RUN=%* -SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows - -SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" -IF %MAJOR_PYTHON_VERSION% == "2" ( - SET WINDOWS_SDK_VERSION="v7.0" -) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( - SET WINDOWS_SDK_VERSION="v7.1" -) ELSE ( - ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" - EXIT 1 -) - -IF "%PYTHON_ARCH%"=="64" ( - ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture - SET DISTUTILS_USE_SDK=1 - SET MSSdk=1 - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) ELSE ( - ECHO Using default MSVC build environment for 32 bit architecture - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) diff --git a/atom-packages.txt b/atom-packages.txt new file mode 100644 index 0000000..aa032ad --- /dev/null +++ b/atom-packages.txt @@ -0,0 +1,9 @@ +language-marko +language-html-swig +language-svg +language-d +mavensmate-atom +language-lua +language-elm +language-puppet +fuse diff --git a/build-package.sh b/build-package.sh index 98674d1..eaade9a 100644 --- a/build-package.sh +++ b/build-package.sh @@ -1,63 +1,21 @@ #!/bin/sh -echo "Downloading latest Atom release..." -ATOM_CHANNEL="${ATOM_CHANNEL:=stable}" - -if [ "$TRAVIS_OS_NAME" = "osx" ]; then - curl -s -L "https://atom.io/download/mac?channel=$ATOM_CHANNEL" \ - -H 'Accept: application/octet-stream' \ - -o "atom.zip" - mkdir atom - unzip -q atom.zip -d atom - if [ "$ATOM_CHANNEL" = "stable" ]; then - export ATOM_APP_NAME="Atom.app" - export ATOM_SCRIPT_NAME="atom.sh" - export ATOM_SCRIPT_PATH="./atom/${ATOM_APP_NAME}/Contents/Resources/app/atom.sh" - else - export ATOM_APP_NAME="Atom ${ATOM_CHANNEL}.app" - export ATOM_SCRIPT_NAME="atom-${ATOM_CHANNEL}" - export ATOM_SCRIPT_PATH="./atom-${ATOM_CHANNEL}" - ln -s "./atom/${ATOM_APP_NAME}/Contents/Resources/app/atom.sh" "${ATOM_SCRIPT_PATH}" - fi - export PATH="$PWD/atom/${ATOM_APP_NAME}/Contents/Resources/app/apm/bin:$PATH" - export ATOM_PATH="./atom" - export APM_SCRIPT_PATH="./atom/${ATOM_APP_NAME}/Contents/Resources/app/apm/node_modules/.bin/apm" -else - curl -s -L "https://atom.io/download/deb?channel=$ATOM_CHANNEL" \ - -H 'Accept: application/octet-stream' \ - -o "atom.deb" +if [ "$TRAVIS_OS_NAME" != "osx" ]; then /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 export DISPLAY=":99" - dpkg-deb -x atom.deb "$HOME/atom" - if [ "$ATOM_CHANNEL" = "stable" ]; then - export ATOM_SCRIPT_NAME="atom" - export APM_SCRIPT_NAME="apm" - else - export ATOM_SCRIPT_NAME="atom-$ATOM_CHANNEL" - export APM_SCRIPT_NAME="apm-$ATOM_CHANNEL" - fi - export ATOM_SCRIPT_PATH="$HOME/atom/usr/bin/$ATOM_SCRIPT_NAME" - export APM_SCRIPT_PATH="$HOME/atom/usr/bin/$APM_SCRIPT_NAME" fi - echo "Using Atom version:" -"$ATOM_SCRIPT_PATH" -v +"$ATOM_SCRIPT_NAME" -v echo "Using APM version:" -"$APM_SCRIPT_PATH" -v +"$APM_SCRIPT_NAME" -v echo "Downloading package dependencies..." -"$APM_SCRIPT_PATH" clean -"$APM_SCRIPT_PATH" install +"$APM_SCRIPT_NAME" clean +"$APM_SCRIPT_NAME" install -TEST_PACKAGES="${APM_TEST_PACKAGES:=none}" - -if [ "$TEST_PACKAGES" != "none" ]; then - echo "Installing atom package dependencies..." - for pack in $TEST_PACKAGES ; do - "$APM_SCRIPT_PATH" install $pack - done -fi +echo "Installing atom package dependencies..." +"$APM_SCRIPT_NAME" install --packages-file atom-packages.txt if [ -f ./node_modules/.bin/coffeelint ]; then if [ -d ./src ]; then @@ -100,9 +58,9 @@ fi if [ -d ./spec ]; then echo "Running specs..." - "$ATOM_SCRIPT_PATH" --test spec + "$ATOM_SCRIPT_NAME" --test spec else echo "Missing spec folder! Please consider adding a test suite in `./spec`" exit 1 fi -exit \ No newline at end of file +exit diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..5c33245 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "friendsofphp/php-cs-fixer": ">0" + } +} diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..0c544bc --- /dev/null +++ b/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e3d1477 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +autopep8 +isort +sqlparse +beautysh From 78a927992c1e6257df5afa6e333a65d700432e71 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Wed, 17 Jan 2018 13:08:36 -0600 Subject: [PATCH 061/103] Add language generic for Travis builds --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5da898d..07c27c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ notifications: script: sh build-package.sh +language: generic + cache: timeout: 1000 From 39deb8e534acdea3acb09cb0f4467a12b09a6ae5 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 17 Jan 2018 22:49:01 -0400 Subject: [PATCH 062/103] Add link to Unibeautify Bot form --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 040ec4e..2dde5f0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) -**Help improve Atom-Beautify by completing the questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** +**Sign up for Unibeautify Bot: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** + +**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** | Mac OS and | | | --- | --- | From 7f43e9613a85a2b059128dbb619796d4d10e2df5 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 17 Jan 2018 22:50:48 -0400 Subject: [PATCH 063/103] Add Unibeautify Bot link to README-template --- README-template.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README-template.md b/README-template.md index ec5ab35..ac4abb3 100644 --- a/README-template.md +++ b/README-template.md @@ -8,7 +8,9 @@ [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) -**Help improve Atom-Beautify by completing the questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** +**Sign up for Unibeautify Bot: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** + +**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** | Mac OS and | | | --- | --- | From eb4f9248f272879bf2469801d883190d95529c4f Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 21 Jan 2018 22:47:54 -0600 Subject: [PATCH 064/103] Updates editorconfig, season, semver, typescript, which, winston deps --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8898cdd..1ccfd89 100644 --- a/package.json +++ b/package.json @@ -166,7 +166,7 @@ "coffee-script": "^1.12.6", "csscomb": "^4.2.0", "diff": "^3.2.0", - "editorconfig": "^0.13.2", + "editorconfig": "^0.15.0", "eslint": "^4.0.0", "event-kit": "^2.3.0", "expand-home-dir": "0.0.3", @@ -186,19 +186,19 @@ "prettydiff2": "^2.2.7", "pug-beautify": "^0.1.1", "remark": "6.0.1", - "season": "6.0.0", - "semver": "^5.3.0", + "season": "^6.0.2", + "semver": "^5.5.0", "shell-env": "^0.3.0", "space-pen": "5.1.2", "strip-json-comments": "^2.0.1", "temp": "^0.8.3", "tidy-markdown": "2.0.3", - "typescript": "2.4.1", + "typescript": "^2.6.1", "typescript-formatter": "5.2.0", "underscore-plus": "^1.6.6", - "universal-analytics": "0.4.13", - "which": "1.2.14", - "winston": "2.3.1", + "universal-analytics": "^0.4.16", + "which": "^1.3.0", + "winston": "2.4.0", "yaml-front-matter": "3.4.0" }, "activationHooks": [ From 811e44e7c1744a320085fc8905ac7d181dcc0f5e Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 21 Jan 2018 22:55:40 -0600 Subject: [PATCH 065/103] Update js-beautify and marko-prettyprint deps --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1ccfd89..36a94eb 100644 --- a/package.json +++ b/package.json @@ -173,11 +173,11 @@ "extend": "^3.0.1", "gherkin": "^2.12.2", "handlebars": "^4.0.10", - "js-beautify": "^1.6.14", + "js-beautify": "^1.7.5", "jscs": "^3.0.7", "lodash": "^4.17.4", "loophole": "^1.1.0", - "marko-prettyprint": "^1.3.6", + "marko-prettyprint": "^1.4.0", "nginxbeautify": "^2.0.1", "node-cljfmt": "0.5.3", "node-dir": "0.1.17", From 2cc7c2ee218d0204c5287cc312e6199511cf494c Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 21 Jan 2018 22:59:33 -0600 Subject: [PATCH 066/103] Add caret to Winston dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 36a94eb..be9aa97 100644 --- a/package.json +++ b/package.json @@ -198,7 +198,7 @@ "underscore-plus": "^1.6.6", "universal-analytics": "^0.4.16", "which": "^1.3.0", - "winston": "2.4.0", + "winston": "^2.4.0", "yaml-front-matter": "3.4.0" }, "activationHooks": [ From 2ef6dbbabbc1ae9c1853b82fcedd5cdf565809a3 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Sun, 21 Jan 2018 23:05:51 -0600 Subject: [PATCH 067/103] Update typescript-formatter --- package.json | 2 +- src/beautifiers/typescript-formatter.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8898cdd..5a1734f 100644 --- a/package.json +++ b/package.json @@ -194,7 +194,7 @@ "temp": "^0.8.3", "tidy-markdown": "2.0.3", "typescript": "2.4.1", - "typescript-formatter": "5.2.0", + "typescript-formatter": "^7.0.0", "underscore-plus": "^1.6.6", "universal-analytics": "0.4.13", "which": "1.2.14", diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index 1a0f204..1cbfd8c 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -12,7 +12,7 @@ module.exports = class TypeScriptFormatter extends Beautifier return new @Promise((resolve, reject) => try - format = require("typescript-formatter/lib/formatter").default + format = require("typescript-formatter/lib/formatter").format formatterUtils = require("typescript-formatter/lib/utils") # @verbose('format', format, formatterUtils) From c2dd151147c308c46c3c59e48ce4430a63d7095b Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 22 Jan 2018 13:04:23 -0600 Subject: [PATCH 068/103] Update eslint --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be9aa97..982c605 100644 --- a/package.json +++ b/package.json @@ -167,7 +167,7 @@ "csscomb": "^4.2.0", "diff": "^3.2.0", "editorconfig": "^0.15.0", - "eslint": "^4.0.0", + "eslint": "^4.16.0", "event-kit": "^2.3.0", "expand-home-dir": "0.0.3", "extend": "^3.0.1", From e359cd3eea0e34bf5831f18ce7340b580da88b1d Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 22 Jan 2018 13:18:47 -0600 Subject: [PATCH 069/103] Update minor versions of beautifiers, rest of non-beautifiers --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 982c605..0018bb8 100644 --- a/package.json +++ b/package.json @@ -157,22 +157,22 @@ }, "dependencies": { "align-yaml": "^0.1.8", - "async": "^2.4.1", + "async": "^2.6.0", "atom-message-panel": "^1.3.0", "atom-space-pen-views": "^2.2.0", - "bluebird": "^3.5.0", + "bluebird": "^3.5.1", "coffee-fmt": "^0.12.0", "coffee-formatter": "^0.1.2", "coffee-script": "^1.12.6", "csscomb": "^4.2.0", - "diff": "^3.2.0", + "diff": "^3.4.0", "editorconfig": "^0.15.0", "eslint": "^4.16.0", - "event-kit": "^2.3.0", + "event-kit": "^2.4.0", "expand-home-dir": "0.0.3", "extend": "^3.0.1", "gherkin": "^2.12.2", - "handlebars": "^4.0.10", + "handlebars": "^4.0.11", "js-beautify": "^1.7.5", "jscs": "^3.0.7", "lodash": "^4.17.4", @@ -192,8 +192,8 @@ "space-pen": "5.1.2", "strip-json-comments": "^2.0.1", "temp": "^0.8.3", - "tidy-markdown": "2.0.3", - "typescript": "^2.6.1", + "tidy-markdown": "2.0.5", + "typescript": "^2.6.2", "typescript-formatter": "5.2.0", "underscore-plus": "^1.6.6", "universal-analytics": "^0.4.16", From cac600d88acb451963cffb3dbc4c669529b134e6 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 22 Jan 2018 13:37:36 -0600 Subject: [PATCH 070/103] Revert tidy-markdown to 2.0.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0018bb8..42f9559 100644 --- a/package.json +++ b/package.json @@ -192,7 +192,7 @@ "space-pen": "5.1.2", "strip-json-comments": "^2.0.1", "temp": "^0.8.3", - "tidy-markdown": "2.0.5", + "tidy-markdown": "2.0.4", "typescript": "^2.6.2", "typescript-formatter": "5.2.0", "underscore-plus": "^1.6.6", From 1987f7d81fbed61a21b4d3ccc967f63b2547cfdc Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Fri, 26 Jan 2018 13:28:23 -0600 Subject: [PATCH 071/103] Output gem info during build --- build-package.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-package.sh b/build-package.sh index eaade9a..e32fc28 100644 --- a/build-package.sh +++ b/build-package.sh @@ -5,6 +5,10 @@ if [ "$TRAVIS_OS_NAME" != "osx" ]; then export DISPLAY=":99" fi +echo "Gem Info" +bundle info puppet-lint +bundle info sass + echo "Using Atom version:" "$ATOM_SCRIPT_NAME" -v echo "Using APM version:" From 5d0a33868470328dfd1fc9fb68499267a260d9a7 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sun, 28 Jan 2018 17:52:02 -0400 Subject: [PATCH 072/103] Change Unibeautify Bot to Unibeautify CI in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2dde5f0..0a75b7a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) -**Sign up for Unibeautify Bot: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** +**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** **Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** From 7ee1b193f786d0e26b69b734b30a5fb4281b4bdb Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sun, 28 Jan 2018 17:52:31 -0400 Subject: [PATCH 073/103] Change Unibeautify Bot to Unibeautify CI in README-template --- README-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-template.md b/README-template.md index ac4abb3..2d743ef 100644 --- a/README-template.md +++ b/README-template.md @@ -8,7 +8,7 @@ [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) -**Sign up for Unibeautify Bot: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** +**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** **Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** From 328e21b1e6ab97e9cae2b0297e73957562346af0 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 29 Jan 2018 17:47:33 -0600 Subject: [PATCH 074/103] Remove gem info --- build-package.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build-package.sh b/build-package.sh index e32fc28..eaade9a 100644 --- a/build-package.sh +++ b/build-package.sh @@ -5,10 +5,6 @@ if [ "$TRAVIS_OS_NAME" != "osx" ]; then export DISPLAY=":99" fi -echo "Gem Info" -bundle info puppet-lint -bundle info sass - echo "Using Atom version:" "$ATOM_SCRIPT_NAME" -v echo "Using APM version:" From aefb7794d669ad853490e005b1ea7b075c96f099 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 30 Jan 2018 17:35:23 -0600 Subject: [PATCH 075/103] Add new language tsx, add tsx support to typescript-formatter --- README.md | 1 + docs/options.md | 69 +++++++++++++++++++ .../simple-jsbeautifyrc/tsx/expected/test.tsx | 12 ++++ .../simple-jsbeautifyrc/tsx/original/test.tsx | 12 ++++ package.json | 8 ++- src/beautifiers/typescript-formatter.coffee | 1 + src/languages/index.coffee | 1 + src/languages/tsx.coffee | 21 ++++++ src/options.json | 41 +++++++++++ 9 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 examples/simple-jsbeautifyrc/tsx/expected/test.tsx create mode 100644 examples/simple-jsbeautifyrc/tsx/original/test.tsx create mode 100644 src/languages/tsx.coffee diff --git a/README.md b/README.md index 2dde5f0..4d6f0ae 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | Swig | `HTML (Swig)`, `SWIG` |`.swig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | Terraform | `Terraform` |`.tf` | **[`terraformfmt`](https://www.terraform.io/docs/commands/fmt.html)** | | TSS | `TSS` |`.tss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | +| TSX | `TypeScriptReact` |`.tsx` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** | | Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** | | UX Markup | `UX` |`.ux` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | diff --git a/docs/options.md b/docs/options.md index 0ae2840..6047ede 100644 --- a/docs/options.md +++ b/docs/options.md @@ -12622,6 +12622,75 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) } ``` +#### [TSX](#tsx) + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +| Option | TypeScript Formatter | +| --- | --- | +| `disabled` | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | + +**Description**: + +Options for language TSX + +##### [Disable Beautifying Language](#disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable TSX Beautification + +**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 "*Disable Beautifying Language*" and change it to your desired configuration. + +##### [Default Beautifier](#default-beautifier) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Default**: `TypeScript Formatter` + +**Type**: `string` + +**Enum**: `TypeScript Formatter` + +**Description**: + +Default Beautifier to be used for TSX + +**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 "*Default Beautifier*" and change it to your desired configuration. + +##### [Beautify On Save](#beautify-on-save) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Automatically beautify TSX files on save + +**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 "*Beautify On Save*" and change it to your desired configuration. + #### [Twig](#twig) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) diff --git a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx new file mode 100644 index 0000000..273dd06 --- /dev/null +++ b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx @@ -0,0 +1,12 @@ +class Test extends React.Component { + render() { + return ( +
            +

            + { this.foo.bar } + < /h2> + { this.foo.bar.children } +

            + ); + } +} \ No newline at end of file diff --git a/examples/simple-jsbeautifyrc/tsx/original/test.tsx b/examples/simple-jsbeautifyrc/tsx/original/test.tsx new file mode 100644 index 0000000..a974f18 --- /dev/null +++ b/examples/simple-jsbeautifyrc/tsx/original/test.tsx @@ -0,0 +1,12 @@ +class Test extends React.Component { + render() { + return ( +
            +

            + {this.foo.bar} +

            + {this.foo.bar.children} +
            + ); + } +} \ No newline at end of file diff --git a/package.json b/package.json index 5a1734f..af5e4da 100644 --- a/package.json +++ b/package.json @@ -277,7 +277,8 @@ "atom-beautify:beautify-language-xml", "atom-beautify:beautify-language-xtemplate", "atom-beautify:beautify-language-yaml", - "atom-beautify:beautify-language-terraform" + "atom-beautify:beautify-language-terraform", + "atom-beautify:beautify-language-tsx" ], ".tree-view .file .name": [ "atom-beautify:beautify-file" @@ -412,7 +413,8 @@ "align-yaml", "goimports", "terraform", - "terraformfmt" + "terraformfmt", + "tsx" ], "devDependencies": { "coffeelint": "1.16.0" @@ -449,4 +451,4 @@ "prettydiff2" ] } -} +} \ No newline at end of file diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index 1cbfd8c..a5081ea 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -6,6 +6,7 @@ module.exports = class TypeScriptFormatter extends Beautifier link: "https://github.com/vvakame/typescript-formatter" options: { TypeScript: true + TSX: true } beautify: (text, language, options) -> diff --git a/src/languages/index.coffee b/src/languages/index.coffee index 7cc1e5c..69c14a8 100644 --- a/src/languages/index.coffee +++ b/src/languages/index.coffee @@ -68,6 +68,7 @@ module.exports = class Languages "svg" "swig" "tss" + "tsx" "twig" "typescript" "ux_markup" diff --git a/src/languages/tsx.coffee b/src/languages/tsx.coffee new file mode 100644 index 0000000..7625b88 --- /dev/null +++ b/src/languages/tsx.coffee @@ -0,0 +1,21 @@ +module.exports = { + + name: "TSX" + namespace: "tsx" + fallback: ['ts'] + + ### + Supported Grammars + ### + grammars: [ + "TypeScriptReact" + ] + + ### + Supported extensions + ### + extensions: [ + "tsx" + ] + +} diff --git a/src/options.json b/src/options.json index 35bda1b..d545bd3 100644 --- a/src/options.json +++ b/src/options.json @@ -7365,6 +7365,47 @@ } } }, + "tsx": { + "title": "TSX", + "type": "object", + "description": "Options for language TSX", + "collapsed": true, + "beautifiers": [ + "TypeScript Formatter" + ], + "grammars": [ + "TypeScriptReact" + ], + "extensions": [ + "tsx" + ], + "properties": { + "disabled": { + "title": "Disable Beautifying Language", + "order": -3, + "type": "boolean", + "default": false, + "description": "Disable TSX Beautification" + }, + "default_beautifier": { + "title": "Default Beautifier", + "order": -2, + "type": "string", + "default": "TypeScript Formatter", + "description": "Default Beautifier to be used for TSX", + "enum": [ + "TypeScript Formatter" + ] + }, + "beautify_on_save": { + "title": "Beautify On Save", + "order": -1, + "type": "boolean", + "default": false, + "description": "Automatically beautify TSX files on save" + } + } + }, "twig": { "title": "Twig", "type": "object", From 6765faf09b9c7e29cb32e780de1d9c0003991e2e Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Wed, 31 Jan 2018 10:08:48 -0600 Subject: [PATCH 076/103] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3284e8d..e51a050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Next - Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable +- See [#601](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for tsx files # v0.30.9 (2017-11-22) - Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed. From c54a0400fefd9b0d0321d03d93247c6c38723b68 Mon Sep 17 00:00:00 2001 From: Faheel Ahmad Date: Sun, 4 Feb 2018 08:01:24 +0530 Subject: [PATCH 077/103] Merge changes with latest master branch --- .github/stale.yml | 19 ++++ .travis.yml | 168 ++++++---------------------- Brewfile | 12 ++ Gemfile | 6 + README-template.md | 20 ++++ README.md | 24 +++- appveyor.yml | 123 ++------------------ appveyor/install.ps1 | 180 ------------------------------ appveyor/run_with_env.cmd | 47 -------- atom-packages.txt | 9 ++ build-package.sh | 60 ++-------- composer.json | 5 + docs/troubleshooting.md | 6 + packages.config | 9 ++ requirements.txt | 4 + src/beautifiers/ocp-indent.coffee | 21 +++- src/beautifiers/puppet-fix.coffee | 23 ++-- src/beautify.coffee | 39 +++---- src/options.json | 2 +- 19 files changed, 213 insertions(+), 564 deletions(-) create mode 100644 .github/stale.yml create mode 100644 Brewfile create mode 100644 Gemfile delete mode 100644 appveyor/install.ps1 delete mode 100644 appveyor/run_with_env.cmd create mode 100644 atom-packages.txt create mode 100644 composer.json create mode 100644 packages.config create mode 100644 requirements.txt diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..f951363 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,19 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - high priority + - pending-publication + - add-language + - add-beautifier +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/.travis.yml b/.travis.yml index 0b2e4ca..07c27c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,53 +11,24 @@ notifications: script: sh build-package.sh +language: generic + +cache: + timeout: 1000 + git: - depth: 10 + depth: 1 -php: - - '5.6' -python: - - '2.7' -go: - - release - -matrix: - include: - - os: linux - dist: trusty - sudo: required - services: - - docker - env: - - ATOM_CHANNEL=stable - - os: linux - dist: trusty - sudo: required - services: - - docker - env: - - ATOM_CHANNEL=beta - # - os: linux - # dist: trusty - # sudo: require - # env: - # - ATOM_CHANNEL=stable - # - os: linux - # dist: trusty - # sudo: require - # env: - # - ATOM_CHANNEL=beta - - os: osx - env: - - ATOM_CHANNEL=stable - # - os: osx - # env: - # - ATOM_CHANNEL=beta +os: + - linux + - osx +sudo: required env: global: - - APM_TEST_PACKAGES="language-marko language-html-swig language-svg language-d mavensmate-atom language-lua language-puppet fuse" - - PATH="/home/travis/gopath/bin:$HOME/.linuxbrew/bin:$PATH" + matrix: + - ATOM_SCRIPT_NAME=atom-beta APM_SCRIPT_NAME=apm-beta + - ATOM_SCRIPT_NAME=atom APM_SCRIPT_NAME=apm addons: apt: @@ -71,9 +42,7 @@ addons: - libgnome-keyring-dev - fakeroot - crystal - - ocaml - camlp4 - - opam - php5-cli - golang @@ -84,111 +53,38 @@ cache: - vendor/bundle # gems are installed here, https://docs.travis-ci.com/user/languages/ruby/#Dependency-Management - node_modules - $HOME/.atom - - $HOME/.stack + - $HOME/.opam before_install: - # Install Homebrew on Linux + # linux: Install Nix, Nix packages, upgrade pip, and install python packages + # osx: Update Homebrew, remove conflicting cask, brew bundle, symlink elm-format, + # upgrade pip, and install python packages - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - git clone --depth=1 https://github.com/Linuxbrew/brew.git ~/.linuxbrew || true; + curl https://nixos.org/nix/install | sh && + . ~/.nix-profile/etc/profile.d/nix.sh && + nix-env -i uncrustify R elm-format terraform atom atom-beta opam && + pip install --upgrade pip && + pip install --user -r requirements.txt; + elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew update && brew cask zap oclint && brew bundle && + ln -s /usr/local/bin/elm-format-0.17 /usr/local/bin/elm-format && + pip2 install --upgrade pip && + pip2 install -r requirements.txt; + else + echo Error:TRAVIS_OS_NAME && exit 1; fi - # Update Homebrew - - brew update - - brew tap homebrew/dupes - - brew tap homebrew/versions # Ruby language support - # - gem install ruby-beautify --verbose - # - gem install rubocop - - gem install htmlbeautifier - - gem install puppet-lint - # Sass language support - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - gem install sass; - else - docker pull unibeautify/sass-convert; - fi - # Python language support - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - sudo chmod 777 -R /opt/python; - pip install --upgrade pip; - pip install --user --upgrade autopep8; - pip install --user --upgrade isort; - else - pip install --upgrade pip; - pip install --upgrade autopep8; - pip install --upgrade isort; - fi - # SQL language support - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - pip install --user --upgrade sqlparse; - else - pip install --upgrade sqlparse; - fi - # Java, C, C++, C#, Objective-C, D, Pawn, Vala - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install uncrustify; - else - docker pull unibeautify/uncrustify; - fi + - bundle install # R - - brew tap homebrew/science - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install r; - rscript --version; - else - docker pull unibeautify/rscript; - fi + - Rscript --version # PHP - - brew tap homebrew/homebrew-php - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install php56 || true; - brew gist-logs php56 || true; - echo -e "\n[Phar]\nphar.readonly = Off\n" >> /usr/local/etc/php/5.6/php.ini; - brew install php-cs-fixer || true; - brew gist-logs php-cs-fixer || true; - fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - wget http://get.sensiolabs.org/php-cs-fixer.phar -O php-cs-fixer; - chmod a+x php-cs-fixer; - mv php-cs-fixer $HOME/.linuxbrew/bin/php-cs-fixer; - fi + - composer install # CoffeeScript - npm install coffee-formatter - # Haskell - # - brew install haskell-stack - # - stack setup - # - stack install stylish-haskell - # Elm - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - curl -L -o /tmp/elm-format.tgz - https://github.com/avh4/elm-format/releases/download/0.7.0-exp/elm-format-0.17-0.7.0-exp-mac-x64.tgz; - tar xvzf /tmp/elm-format.tgz -C /usr/local/bin; - fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - curl -L -o /tmp/elm-format.tgz https://github.com/avh4/elm-format/releases/download/0.7.0-exp/elm-format-0.17-0.7.0-exp-linux-x64.tgz; - tar xvzf /tmp/elm-format.tgz -C $HOME/.linuxbrew/bin; - fi # OCaml - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install ocaml; - brew install opam; - fi - opam init --auto-setup # Init environment variables for opam - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; fi - opam install --yes ocp-indent - # Crystal - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install crystal-lang; fi - # Bash - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - pip install --user beautysh; - else - pip install beautysh; - fi - # terraform - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install terraform; - else - docker pull hashicorp/terraform; - fi diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..486f415 --- /dev/null +++ b/Brewfile @@ -0,0 +1,12 @@ +tap 'homebrew/science' +tap 'homebrew/php' +tap 'caskroom/versions' +brew 'uncrustify' +brew 'r' +brew 'composer' +brew 'opam' +brew 'crystal-lang' +brew 'terraform' +brew 'elm-format' +cask 'atom' +cask 'atom-beta' diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..4805589 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "rubocop" +gem "htmlbeautifier" +gem "puppet-lint" +gem "sass" diff --git a/README-template.md b/README-template.md index 1726007..2d743ef 100644 --- a/README-template.md +++ b/README-template.md @@ -1,10 +1,16 @@ # :lipstick: [{{package.name}}](https://github.com/Glavin001/atom-beautify) +[![apm](https://img.shields.io/apm/dm/atom-beautify.svg)](https://atom.io/packages/atom-beautify) [![Greenkeeper badge](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg)](https://greenkeeper.io/) [![GitHub issues](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/issues) [![GitHub stars](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/stargazers) [![Gitter](https://img.shields.io/gitter/room/Glavin001/atom-beautify.svg?style=flat-square)](https://gitter.im/Glavin001/atom-beautify) [![Bountysource](https://img.shields.io/bountysource/team/atom-beautify/activity.svg?style=flat-square)](https://www.bountysource.com/teams/atom-beautify) [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) +[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) + +**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** + +**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** | Mac OS and | | | --- | --- | @@ -64,6 +70,18 @@ Thank you. Atom-Beautify is going to be completely rewritten with [Unibeautify](https://github.com/Unibeautify/unibeautify) at its core! See [`unibeautify` branch](../../tree/unibeautify) for work in progress and [Issue #1174](https://github.com/Glavin001/atom-beautify/issues/1174). +### Poll: Improving installation of third-party beautifiers + +Many users are experiencing issues when installing third party beautifiers (e.g. Uncrustify, PHP-CS-Fixer, and many more). +A possible solution is a "cloud" service which provides remote access to these beautifiers. Atom-Beautify would then communicate with these services, allowing for zero-installation beautification. + +Please let us know what you think! + +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet/vote) + ## Beautifiers Some of the supported beautifiers are developed for Node.js and are automatically installed when Atom-Beautify is installed. However, other beautifiers are command-line interface (CLI) applications and require you to manually install them. @@ -203,6 +221,8 @@ See [`docs/troubleshooting.md`](docs/troubleshooting.md). ## Contributing +See [`CONTRIBUTING.md`](CONTRIBUTING.md). + [See all contributors on GitHub](../../graphs/contributors). Please update the [CHANGELOG.md](CHANGELOG.md), diff --git a/README.md b/README.md index ee00544..0a75b7a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ # :lipstick: [atom-beautify](https://github.com/Glavin001/atom-beautify) +[![apm](https://img.shields.io/apm/dm/atom-beautify.svg)](https://atom.io/packages/atom-beautify) [![Greenkeeper badge](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg)](https://greenkeeper.io/) [![GitHub issues](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/issues) [![GitHub stars](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/stargazers) [![Gitter](https://img.shields.io/gitter/room/Glavin001/atom-beautify.svg?style=flat-square)](https://gitter.im/Glavin001/atom-beautify) [![Bountysource](https://img.shields.io/bountysource/team/atom-beautify/activity.svg?style=flat-square)](https://www.bountysource.com/teams/atom-beautify) [![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) +[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify) + +**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)** + +**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)** | Mac OS and | | | --- | --- | @@ -64,6 +70,18 @@ Thank you. Atom-Beautify is going to be completely rewritten with [Unibeautify](https://github.com/Unibeautify/unibeautify) at its core! See [`unibeautify` branch](../../tree/unibeautify) for work in progress and [Issue #1174](https://github.com/Glavin001/atom-beautify/issues/1174). +### Poll: Improving installation of third-party beautifiers + +Many users are experiencing issues when installing third party beautifiers (e.g. Uncrustify, PHP-CS-Fixer, and many more). +A possible solution is a "cloud" service which provides remote access to these beautifiers. Atom-Beautify would then communicate with these services, allowing for zero-installation beautification. + +Please let us know what you think! + +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker/vote) +[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet/vote) + ## Beautifiers Some of the supported beautifiers are developed for Node.js and are automatically installed when Atom-Beautify is installed. However, other beautifiers are command-line interface (CLI) applications and require you to manually install them. @@ -96,13 +114,13 @@ Some of the supported beautifiers are developed for Node.js and are automaticall | Lua beautifier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Marko Beautifier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Nginx Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | -| ocp-indent | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://www.typerex.org/ocp-indent.html and follow the instructions. | +| ocp-indent | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [ocp-indent (`ocp-indent`)](https://www.typerex.org/ocp-indent.html) with `docker pull unibeautify/ocp-indent`

            :bookmark_tabs: Manually:
            1. Install [ocp-indent (`ocp-indent`)](https://www.typerex.org/ocp-indent.html) by following https://www.typerex.org/ocp-indent.html#installation
            | | Perltidy | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://perltidy.sourceforge.net/ and follow the instructions. | | PHP-CS-Fixer | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [PHP-CS-Fixer (`php-cs-fixer`)](https://github.com/FriendsOfPHP/PHP-CS-Fixer) with `docker pull unibeautify/php-cs-fixer`

            :bookmark_tabs: Manually:
            1. Install [PHP (`php`)](http://php.net/) by following http://php.net/manual/en/install.php
            2. Install [PHP-CS-Fixer (`php-cs-fixer`)](https://github.com/FriendsOfPHP/PHP-CS-Fixer) by following https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation
            | | PHPCBF | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [PHPCBF (`phpcbf`)](https://github.com/squizlabs/PHP_CodeSniffer) with `docker pull unibeautify/phpcbf`

            :bookmark_tabs: Manually:
            1. Install [PHP (`php`)](http://php.net/) by following http://php.net/manual/en/install.php
            2. Install [PHPCBF (`phpcbf`)](https://github.com/squizlabs/PHP_CodeSniffer) by following https://github.com/squizlabs/PHP_CodeSniffer#installation
            | | Pretty Diff | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Pug Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | -| puppet-lint | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://puppet-lint.com/ and follow the instructions. | +| puppet-lint | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) with `docker pull unibeautify/puppet-lint`

            :bookmark_tabs: Manually:
            1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) by following http://puppet-lint.com/
            | | pybeautifier | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/guyskk/pybeautifier and follow the instructions. | | Remark | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Rubocop | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/bbatsov/rubocop and follow the instructions. | @@ -318,6 +336,8 @@ See [`docs/troubleshooting.md`](docs/troubleshooting.md). ## Contributing +See [`CONTRIBUTING.md`](CONTRIBUTING.md). + [See all contributors on GitHub](../../graphs/contributors). Please update the [CHANGELOG.md](CHANGELOG.md), diff --git a/appveyor.yml b/appveyor.yml index bf21dfb..d82f7f6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,136 +10,35 @@ environment: # /E:ON and /V:ON options are not enabled in the batch script intepreter # See: http://stackoverflow.com/a/13751649/163740 CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" - - matrix: - - PYTHON: "C:\\Python27" - PYTHON_VERSION: "2.7.8" - PYTHON_ARCH: "32" - RUBY_VERSION: 23 - - # - PYTHON: "C:\\Python27-x64" - # PYTHON_VERSION: "2.7.8" - # PYTHON_ARCH: "64" - # - # - PYTHON: "C:\\Python33" - # PYTHON_VERSION: "3.3.5" - # PYTHON_ARCH: "32" - # - # - PYTHON: "C:\\Python33-x64" - # PYTHON_VERSION: "3.3.5" - # PYTHON_ARCH: "64" - # - # - PYTHON: "C:\\Python34" - # PYTHON_VERSION: "3.4.1" - # PYTHON_ARCH: "32" - # - # - PYTHON: "C:\\Python34-x64" - # PYTHON_VERSION: "3.4.1" - # PYTHON_ARCH: "64" + PATH: C:\Ruby23\bin;C:\Ruby23-x64\DevKit\mingw\bin;C:\Python27;C:\Python27\Scripts;%PATH% init: - cmd: rd /s /q %CHOCOLATEYINSTALL% - ps: iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) install: - - - ECHO "Filesystem root:" - - ps: "ls \"C:/\"" - - - cinst atom -y - - cd %APPVEYOR_BUILD_FOLDER% - # Add Atom's bin (apm, etc) to PATH - - SET PATH=%LOCALAPPDATA%\atom\bin;%PATH% + - cinst packages.config -y + - refreshenv - apm install - # Install CLI beautifiers + # https://packaging.python.org/guides/supporting-windows-using-appveyor/ + - pip install -r requirements.txt - # Install Python (from the official .msi of http://python.org) and pip when - # not already installed. - - "powershell ./appveyor/install.ps1" + # Gemfile Install + - bundle install - # Prepend newly installed Python to the PATH of this build (this cannot be - # done from inside the powershell script as it would require to restart - # the parent CMD process). - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - # Check that we have the expected version and architecture for Python - - "python --version" - - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - - # Install the build dependencies of the project. If some dependencies contain - # compiled extensions and are not provided as pre-built wheel packages, - # pip will build them from source using the MSVC compiler matching the - # target Python version and architecture - - "%CMD_IN_ENV% pip install --upgrade autopep8" - - where autopep8 - - - "%CMD_IN_ENV% pip install --upgrade isort" - - where isort - - - "%CMD_IN_ENV% pip install --upgrade sqlparse" - - # Ruby & Gem - - SET PATH=C:\Ruby%RUBY_VERSION%\bin;C:\Ruby23-x64\DevKit\mingw\bin;%PATH% - # Rubocop - - gem install rubocop - - where rubocop - # HTMLBeautifier - - gem install htmlbeautifier - - where htmlbeautifier - # Puppet-Lint - - gem install puppet-lint - - where puppet-lint - # Sass - - gem install sass - - where sass-convert - - # emacs - - cinst emacs -y - - where emacs - - # terraform - - cinst terraform -y - - where terraform - - # FIXME: Enable allowEmptyChecksums, until someone fixes the checksum issue of php - - choco feature enable -n allowEmptyChecksums # PHP - ps: Set-Service wuauserv -StartupType Manual - - cinst php -y - - ps: "ls \"C:\\tools\\php71\"" - - "SET PATH=C:\\tools\\php71;%PATH%" - - where php # PHP-CS-Fixer - - cinst curl -y # Use cURL to download file from URL - - curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer - - "SET PATH=%cd%;%PATH%" # Add current working directory to PATH - - where php-cs-fixer - - # Uncrustify - - curl -k -L https://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.65/uncrustify-0.65-win32.zip/download -o uncrustify.zip - - cinst 7zip.commandline -y - - 7za e uncrustify.zip -ouncrustify-d - - "SET PATH=%cd%\\uncrustify-d;%PATH%" - - where uncrustify + - composer install # elm-format - - curl -k -L https://github.com/avh4/elm-format/releases/download/0.7.0-exp/elm-format-0.18-0.7.0-exp-win-i386.zip -o elm-format.zip - - 7za e elm-format.zip -oelm-format-d - - "SET PATH=%cd%\\elm-format-d;%PATH%" - - where elm-format - - # Beautysh - - pip install beautysh - - where beautysh - + - npm install -g elm-format@exp + build_script: - - cd %APPVEYOR_BUILD_FOLDER% # Install languages to Atom - - apm install language-marko language-html-swig language-svg language-elm language-d mavensmate-atom language-lua language-puppet fuse - # Show current PATH - - echo %PATH% + - apm install --packages-file atom-packages.txt # Run tests on package #- "%LOCALAPPDATA%\\atom\\bin\\atom.cmd --test spec" - apm test --path %LOCALAPPDATA%/atom/bin/atom.cmd diff --git a/appveyor/install.ps1 b/appveyor/install.ps1 deleted file mode 100644 index 0f165d8..0000000 --- a/appveyor/install.ps1 +++ /dev/null @@ -1,180 +0,0 @@ -# Sample script to install Python and pip under Windows -# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner -# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ - -$MINICONDA_URL = "http://repo.continuum.io/miniconda/" -$BASE_URL = "https://www.python.org/ftp/python/" -$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" -$GET_PIP_PATH = "C:\get-pip.py" - - -function DownloadPython ($python_version, $platform_suffix) { - $webclient = New-Object System.Net.WebClient - $filename = "python-" + $python_version + $platform_suffix + ".msi" - $url = $BASE_URL + $python_version + "/" + $filename - - $basedir = $pwd.Path + "\" - $filepath = $basedir + $filename - if (Test-Path $filename) { - Write-Host "Reusing" $filepath - return $filepath - } - - # Download and retry up to 3 times in case of network transient errors. - Write-Host "Downloading" $filename "from" $url - $retry_attempts = 2 - for($i=0; $i -lt $retry_attempts; $i++){ - try { - $webclient.DownloadFile($url, $filepath) - break - } - Catch [Exception]{ - Start-Sleep 1 - } - } - if (Test-Path $filepath) { - Write-Host "File saved at" $filepath - } else { - # Retry once to get the error message if any at the last try - $webclient.DownloadFile($url, $filepath) - } - return $filepath -} - - -function InstallPython ($python_version, $architecture, $python_home) { - Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home - if (Test-Path $python_home) { - Write-Host $python_home "already exists, skipping." - return $false - } - if ($architecture -eq "32") { - $platform_suffix = "" - } else { - $platform_suffix = ".amd64" - } - $msipath = DownloadPython $python_version $platform_suffix - Write-Host "Installing" $msipath "to" $python_home - $install_log = $python_home + ".log" - $install_args = "/qn /log $install_log /i $msipath TARGETDIR=$python_home" - $uninstall_args = "/qn /x $msipath" - RunCommand "msiexec.exe" $install_args - if (-not(Test-Path $python_home)) { - Write-Host "Python seems to be installed else-where, reinstalling." - RunCommand "msiexec.exe" $uninstall_args - RunCommand "msiexec.exe" $install_args - } - if (Test-Path $python_home) { - Write-Host "Python $python_version ($architecture) installation complete" - } else { - Write-Host "Failed to install Python in $python_home" - Get-Content -Path $install_log - Exit 1 - } -} - -function RunCommand ($command, $command_args) { - Write-Host $command $command_args - Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru -} - - -function InstallPip ($python_home) { - $pip_path = $python_home + "\Scripts\pip.exe" - $python_path = $python_home + "\python.exe" - if (-not(Test-Path $pip_path)) { - Write-Host "Installing pip..." - $webclient = New-Object System.Net.WebClient - $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) - Write-Host "Executing:" $python_path $GET_PIP_PATH - Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru - } else { - Write-Host "pip already installed." - } -} - - -function DownloadMiniconda ($python_version, $platform_suffix) { - $webclient = New-Object System.Net.WebClient - if ($python_version -eq "3.4") { - $filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe" - } else { - $filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe" - } - $url = $MINICONDA_URL + $filename - - $basedir = $pwd.Path + "\" - $filepath = $basedir + $filename - if (Test-Path $filename) { - Write-Host "Reusing" $filepath - return $filepath - } - - # Download and retry up to 3 times in case of network transient errors. - Write-Host "Downloading" $filename "from" $url - $retry_attempts = 2 - for($i=0; $i -lt $retry_attempts; $i++){ - try { - $webclient.DownloadFile($url, $filepath) - break - } - Catch [Exception]{ - Start-Sleep 1 - } - } - if (Test-Path $filepath) { - Write-Host "File saved at" $filepath - } else { - # Retry once to get the error message if any at the last try - $webclient.DownloadFile($url, $filepath) - } - return $filepath -} - - -function InstallMiniconda ($python_version, $architecture, $python_home) { - Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home - if (Test-Path $python_home) { - Write-Host $python_home "already exists, skipping." - return $false - } - if ($architecture -eq "32") { - $platform_suffix = "x86" - } else { - $platform_suffix = "x86_64" - } - $filepath = DownloadMiniconda $python_version $platform_suffix - Write-Host "Installing" $filepath "to" $python_home - $install_log = $python_home + ".log" - $args = "/S /D=$python_home" - Write-Host $filepath $args - Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru - if (Test-Path $python_home) { - Write-Host "Python $python_version ($architecture) installation complete" - } else { - Write-Host "Failed to install Python in $python_home" - Get-Content -Path $install_log - Exit 1 - } -} - - -function InstallMinicondaPip ($python_home) { - $pip_path = $python_home + "\Scripts\pip.exe" - $conda_path = $python_home + "\Scripts\conda.exe" - if (-not(Test-Path $pip_path)) { - Write-Host "Installing pip..." - $args = "install --yes pip" - Write-Host $conda_path $args - Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru - } else { - Write-Host "pip already installed." - } -} - -function main () { - InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON - InstallPip $env:PYTHON -} - -main diff --git a/appveyor/run_with_env.cmd b/appveyor/run_with_env.cmd deleted file mode 100644 index 3a472bc..0000000 --- a/appveyor/run_with_env.cmd +++ /dev/null @@ -1,47 +0,0 @@ -:: To build extensions for 64 bit Python 3, we need to configure environment -:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) -:: -:: To build extensions for 64 bit Python 2, we need to configure environment -:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) -:: -:: 32 bit builds do not require specific environment configurations. -:: -:: Note: this script needs to be run with the /E:ON and /V:ON flags for the -:: cmd interpreter, at least for (SDK v7.0) -:: -:: More details at: -:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows -:: http://stackoverflow.com/a/13751649/163740 -:: -:: Author: Olivier Grisel -:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ -@ECHO OFF - -SET COMMAND_TO_RUN=%* -SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows - -SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" -IF %MAJOR_PYTHON_VERSION% == "2" ( - SET WINDOWS_SDK_VERSION="v7.0" -) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( - SET WINDOWS_SDK_VERSION="v7.1" -) ELSE ( - ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" - EXIT 1 -) - -IF "%PYTHON_ARCH%"=="64" ( - ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture - SET DISTUTILS_USE_SDK=1 - SET MSSdk=1 - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) ELSE ( - ECHO Using default MSVC build environment for 32 bit architecture - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) diff --git a/atom-packages.txt b/atom-packages.txt new file mode 100644 index 0000000..aa032ad --- /dev/null +++ b/atom-packages.txt @@ -0,0 +1,9 @@ +language-marko +language-html-swig +language-svg +language-d +mavensmate-atom +language-lua +language-elm +language-puppet +fuse diff --git a/build-package.sh b/build-package.sh index 98674d1..eaade9a 100644 --- a/build-package.sh +++ b/build-package.sh @@ -1,63 +1,21 @@ #!/bin/sh -echo "Downloading latest Atom release..." -ATOM_CHANNEL="${ATOM_CHANNEL:=stable}" - -if [ "$TRAVIS_OS_NAME" = "osx" ]; then - curl -s -L "https://atom.io/download/mac?channel=$ATOM_CHANNEL" \ - -H 'Accept: application/octet-stream' \ - -o "atom.zip" - mkdir atom - unzip -q atom.zip -d atom - if [ "$ATOM_CHANNEL" = "stable" ]; then - export ATOM_APP_NAME="Atom.app" - export ATOM_SCRIPT_NAME="atom.sh" - export ATOM_SCRIPT_PATH="./atom/${ATOM_APP_NAME}/Contents/Resources/app/atom.sh" - else - export ATOM_APP_NAME="Atom ${ATOM_CHANNEL}.app" - export ATOM_SCRIPT_NAME="atom-${ATOM_CHANNEL}" - export ATOM_SCRIPT_PATH="./atom-${ATOM_CHANNEL}" - ln -s "./atom/${ATOM_APP_NAME}/Contents/Resources/app/atom.sh" "${ATOM_SCRIPT_PATH}" - fi - export PATH="$PWD/atom/${ATOM_APP_NAME}/Contents/Resources/app/apm/bin:$PATH" - export ATOM_PATH="./atom" - export APM_SCRIPT_PATH="./atom/${ATOM_APP_NAME}/Contents/Resources/app/apm/node_modules/.bin/apm" -else - curl -s -L "https://atom.io/download/deb?channel=$ATOM_CHANNEL" \ - -H 'Accept: application/octet-stream' \ - -o "atom.deb" +if [ "$TRAVIS_OS_NAME" != "osx" ]; then /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 export DISPLAY=":99" - dpkg-deb -x atom.deb "$HOME/atom" - if [ "$ATOM_CHANNEL" = "stable" ]; then - export ATOM_SCRIPT_NAME="atom" - export APM_SCRIPT_NAME="apm" - else - export ATOM_SCRIPT_NAME="atom-$ATOM_CHANNEL" - export APM_SCRIPT_NAME="apm-$ATOM_CHANNEL" - fi - export ATOM_SCRIPT_PATH="$HOME/atom/usr/bin/$ATOM_SCRIPT_NAME" - export APM_SCRIPT_PATH="$HOME/atom/usr/bin/$APM_SCRIPT_NAME" fi - echo "Using Atom version:" -"$ATOM_SCRIPT_PATH" -v +"$ATOM_SCRIPT_NAME" -v echo "Using APM version:" -"$APM_SCRIPT_PATH" -v +"$APM_SCRIPT_NAME" -v echo "Downloading package dependencies..." -"$APM_SCRIPT_PATH" clean -"$APM_SCRIPT_PATH" install +"$APM_SCRIPT_NAME" clean +"$APM_SCRIPT_NAME" install -TEST_PACKAGES="${APM_TEST_PACKAGES:=none}" - -if [ "$TEST_PACKAGES" != "none" ]; then - echo "Installing atom package dependencies..." - for pack in $TEST_PACKAGES ; do - "$APM_SCRIPT_PATH" install $pack - done -fi +echo "Installing atom package dependencies..." +"$APM_SCRIPT_NAME" install --packages-file atom-packages.txt if [ -f ./node_modules/.bin/coffeelint ]; then if [ -d ./src ]; then @@ -100,9 +58,9 @@ fi if [ -d ./spec ]; then echo "Running specs..." - "$ATOM_SCRIPT_PATH" --test spec + "$ATOM_SCRIPT_NAME" --test spec else echo "Missing spec folder! Please consider adding a test suite in `./spec`" exit 1 fi -exit \ No newline at end of file +exit diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..5c33245 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "friendsofphp/php-cs-fixer": ">0" + } +} diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index df99d73..b01f828 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -16,3 +16,9 @@ The debugging results will be copied to your clipboard. 3. Create a file in your new Gist called `debug.md`. 4. Paste your debugging results from Atom beautify into `debug.md` file in your Gist. 5. Add a link to your Gist in your new Issue. + +## Common Issues + +> I receive an error when I try to install or update Atom Beautify + +Run `apm clean` from your terminal, then retry \ No newline at end of file diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..0c544bc --- /dev/null +++ b/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e3d1477 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +autopep8 +isort +sqlparse +beautysh diff --git a/src/beautifiers/ocp-indent.coffee b/src/beautifiers/ocp-indent.coffee index 22c0463..7c196de 100644 --- a/src/beautifiers/ocp-indent.coffee +++ b/src/beautifiers/ocp-indent.coffee @@ -8,7 +8,24 @@ Beautifier = require('./beautifier') module.exports = class OCPIndent extends Beautifier name: "ocp-indent" link: "https://www.typerex.org/ocp-indent.html" - isPreInstalled: false + executables: [ + { + name: "ocp-indent" + cmd: "ocp-indent" + homepage: "https://www.typerex.org/ocp-indent.html" + installation: "https://www.typerex.org/ocp-indent.html#installation" + version: { + parse: (text) -> + try + text.match(/(\d+\.\d+\.\d+)/)[1] + catch + text.match(/(\d+\.\d+)/)[1] + ".0" + } + docker: { + image: "unibeautify/ocp-indent" + } + } + ] options: { OCaml: true @@ -21,4 +38,4 @@ module.exports = class OCPIndent extends Beautifier help: { link: "https://www.typerex.org/ocp-indent.html" } - }) + }) \ No newline at end of file diff --git a/src/beautifiers/puppet-fix.coffee b/src/beautifiers/puppet-fix.coffee index 4ae96ed..4a22325 100644 --- a/src/beautifiers/puppet-fix.coffee +++ b/src/beautifiers/puppet-fix.coffee @@ -8,21 +8,28 @@ module.exports = class PuppetFix extends Beautifier # this is what displays as your Default Beautifier in Language Config name: "puppet-lint" link: "http://puppet-lint.com/" - isPreInstalled: false options: { Puppet: true } - cli: (options) -> - if not options.puppet_path? - return new Error("'puppet-lint' path is not set!" + - " Please set this in the Atom Beautify package settings.") - else - return options.puppet_path + executables: [ + { + name: "puppet-lint" + cmd: "puppet-lint" + homepage: "http://puppet-lint.com/" + installation: "http://puppet-lint.com/" + version: { + parse: (text) -> text.match(/puppet-lint (\d+\.\d+\.\d+)/)[1] + } + docker: { + image: "unibeautify/puppet-lint" + } + } + ] beautify: (text, language, options) -> - @run("puppet-lint", [ + @exe("puppet-lint").run([ '--fix' tempFile = @tempFile("input", text) ], { diff --git a/src/beautify.coffee b/src/beautify.coffee index 3a850a4..af517ec 100644 --- a/src/beautify.coffee +++ b/src/beautify.coffee @@ -96,9 +96,10 @@ beautify = ({ editor, onSave, language }) -> if not text? # Do nothing, is undefined # console.log 'beautifyCompleted' + return resolve(text) else if text instanceof Error showError(text) - return reject(text) + return resolve(text) else if typeof text is "string" if oldText isnt text @@ -127,15 +128,18 @@ beautify = ({ editor, onSave, language }) -> # otherwise setScrollTop is not working, probably because the cursor # addition happens asynchronously setTimeout ( -> - # console.log "setScrollTop" setScrollTop editor, origScrollTop return resolve(text) ), 0 + else + return setTimeout(() -> + resolve(text) + , 0) else error = new Error("Unsupported beautification result '#{text}'.") showError(error) - return reject(error) + return resolve(text) # else # console.log "Already Beautiful!" @@ -506,20 +510,17 @@ debug = () -> handleSaveEvent = -> atom.workspace.observeTextEditors (editor) -> - pendingPaths = {} beautifyOnSaveHandler = ({path: filePath}) -> - logger.verbose('Should beautify on this save?') - if pendingPaths[filePath] - logger.verbose("Editor with file path #{filePath} already beautified!") - return - buffer = editor.getBuffer() path ?= require('path') - # Get Grammar - grammar = editor.getGrammar().name # Get file extension fileExtension = path.extname(filePath) # Remove prefix "." (period) in fileExtension fileExtension = fileExtension.substr(1) + # Set path of buffer for unsaved files + if editor.getPath() is undefined + editor.getBuffer().setPath(filePath) + # Get Grammar from the editor + grammar = editor.getGrammar().name # Get language languages = beautifier.languages.getLanguages({grammar, extension: fileExtension}) if languages.length < 1 @@ -535,23 +536,11 @@ handleSaveEvent = -> beautify({editor, onSave: true}) .then(() -> logger.verbose('Done beautifying file', filePath) - if editor.isAlive() is true - logger.verbose('Saving TextEditor...') - # Store the filePath to prevent infinite looping - # When Whitespace package has option "Ensure Single Trailing Newline" enabled - # It will add a newline and keep the file from converging on a beautified form - # and saving without emitting onDidSave event, because there were no changes. - pendingPaths[filePath] = true - Promise.resolve(editor.save()).then(() -> - delete pendingPaths[filePath] - logger.verbose('Saved TextEditor.') - ) ) .catch((error) -> return showError(error) ) - disposable = editor.onDidSave(({path : filePath}) -> - # TODO: Implement debouncing + disposable = editor.getBuffer().onWillSave(({path: filePath}) -> beautifyOnSaveHandler({path: filePath}) ) plugin.subscriptions.add disposable @@ -632,4 +621,4 @@ plugin.activate = -> @addLanguageCommands() plugin.deactivate = -> - @subscriptions.dispose() + @subscriptions.dispose() \ No newline at end of file diff --git a/src/options.json b/src/options.json index f2e3abf..c574c59 100644 --- a/src/options.json +++ b/src/options.json @@ -9480,4 +9480,4 @@ } } } -} +} \ No newline at end of file From 7107f00beb0f0f06004b8356a5f29c2121fbe76e Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 6 Feb 2018 10:32:09 -0600 Subject: [PATCH 078/103] Fix unit test for tsx --- examples/simple-jsbeautifyrc/tsx/expected/test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx index 273dd06..ced5af2 100644 --- a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx +++ b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx @@ -1,7 +1,7 @@ class Test extends React.Component { render() { return ( -
            +

            { this.foo.bar } < /h2> @@ -9,4 +9,4 @@ class Test extends React.Component {

            ); } -} \ No newline at end of file +} From 25a9ee8699f520e952e4842c49c67d67563d0b73 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 6 Feb 2018 11:29:14 -0600 Subject: [PATCH 079/103] Remove homebrew/science tap from build , as its deprecated --- Brewfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Brewfile b/Brewfile index 486f415..16f2eb2 100644 --- a/Brewfile +++ b/Brewfile @@ -1,4 +1,3 @@ -tap 'homebrew/science' tap 'homebrew/php' tap 'caskroom/versions' brew 'uncrustify' From 6c38d3df3f8005ec64434a229bec6f5245f1910c Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 6 Feb 2018 13:52:25 -0600 Subject: [PATCH 080/103] Fix typescript-formatter issues for TSX --- examples/simple-jsbeautifyrc/tsx/original/test.tsx | 12 ++++++------ src/beautifiers/typescript-formatter.coffee | 7 ++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/simple-jsbeautifyrc/tsx/original/test.tsx b/examples/simple-jsbeautifyrc/tsx/original/test.tsx index a974f18..5d2797f 100644 --- a/examples/simple-jsbeautifyrc/tsx/original/test.tsx +++ b/examples/simple-jsbeautifyrc/tsx/original/test.tsx @@ -1,12 +1,12 @@ class Test extends React.Component { - render() { +render() { return (
            -

            +

            {this.foo.bar}

            - {this.foo.bar.children} -
            - ); - } +{this.foo.bar.children} +
            + ); +} } \ No newline at end of file diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index a5081ea..7ca7fd7 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -26,8 +26,13 @@ module.exports = class TypeScriptFormatter extends Beautifier opts.indentSize = options.indent_size opts.indentStyle = 'space' + if language is "TSX" + fileName = 'test.tsx' + else + fileName = '' + @verbose('typescript', text, opts) - result = format('', text, opts) + result = format(fileName, text, opts) @verbose(result) resolve result catch e From ea3361812433ddbbb2b35fa15e46f2c3b19c0e46 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 6 Feb 2018 13:54:44 -0600 Subject: [PATCH 081/103] Fix expected output for TSX --- examples/simple-jsbeautifyrc/tsx/expected/test.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx index ced5af2..2619759 100644 --- a/examples/simple-jsbeautifyrc/tsx/expected/test.tsx +++ b/examples/simple-jsbeautifyrc/tsx/expected/test.tsx @@ -1,12 +1,12 @@ class Test extends React.Component { render() { return ( -
            -

            - { this.foo.bar } - < /h2> - { this.foo.bar.children } -

            +
            +

            + {this.foo.bar} +

            + {this.foo.bar.children} +
            ); } -} +} \ No newline at end of file From 3633b392d5add6971f3f941257bde5131413a97f Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Thu, 8 Feb 2018 16:58:02 -0600 Subject: [PATCH 082/103] Output path to debug Travis build issue --- build-package.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build-package.sh b/build-package.sh index eaade9a..0bd8feb 100644 --- a/build-package.sh +++ b/build-package.sh @@ -9,6 +9,8 @@ echo "Using Atom version:" "$ATOM_SCRIPT_NAME" -v echo "Using APM version:" "$APM_SCRIPT_NAME" -v +echo "Path:" +echo $PATH echo "Downloading package dependencies..." "$APM_SCRIPT_NAME" clean From 35f8c924ee32d569a6ee20da6b270f0cf3f4b7ce Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 00:09:53 -0600 Subject: [PATCH 083/103] Add Prettier as a beautifier, first commit --- README.md | 15 +- docs/options.md | 312 ++++++++++++++++---------------- package.json | 4 +- src/beautifiers/index.coffee | 1 + src/beautifiers/prettier.coffee | 38 ++++ src/options.json | 14 ++ 6 files changed, 220 insertions(+), 164 deletions(-) create mode 100644 src/beautifiers/prettier.coffee diff --git a/README.md b/README.md index 7720f42..9c3d948 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall | Perltidy | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://perltidy.sourceforge.net/ and follow the instructions. | | PHP-CS-Fixer | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [PHP-CS-Fixer (`php-cs-fixer`)](https://github.com/FriendsOfPHP/PHP-CS-Fixer) with `docker pull unibeautify/php-cs-fixer`

            :bookmark_tabs: Manually:
            1. Install [PHP (`php`)](http://php.net/) by following http://php.net/manual/en/install.php
            2. Install [PHP-CS-Fixer (`php-cs-fixer`)](https://github.com/FriendsOfPHP/PHP-CS-Fixer) by following https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation
            | | PHPCBF | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [PHPCBF (`phpcbf`)](https://github.com/squizlabs/PHP_CodeSniffer) with `docker pull unibeautify/phpcbf`

            :bookmark_tabs: Manually:
            1. Install [PHP (`php`)](http://php.net/) by following http://php.net/manual/en/install.php
            2. Install [PHPCBF (`phpcbf`)](https://github.com/squizlabs/PHP_CodeSniffer) by following https://github.com/squizlabs/PHP_CodeSniffer#installation
            | +| Prettier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Pretty Diff | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | Pug Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! | | puppet-lint | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
            1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) with `docker pull unibeautify/puppet-lint`

            :bookmark_tabs: Manually:
            1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) by following http://puppet-lint.com/
            | @@ -152,7 +153,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | C++ | `C++` |`.h`, `.hh`, `.cc`, `.cpp`, `.cxx`, `.C`, `.cu`, `.c++`, `.hpp`, `.hxx`, `.h++`, `.cuh` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)**, [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) | | Crystal | `Crystal` |`.cr` | **[`Crystal`](http://crystal-lang.org)** | | C# | `C#` |`.cs` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)** | -| CSS | `CSS` |`.css` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff), [`SassConvert`](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) | +| CSS | `CSS` |`.css` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Prettier`](https://github.com/prettier/prettier), [`Pretty Diff`](https://github.com/prettydiff/prettydiff), [`SassConvert`](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) | | CSV | `CSV` |`.csv` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | D | `D` |`.d` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)**, [`dfmt`](https://github.com/Hackerpilot/dfmt) | | EJS | `EJS`, `JavaScript Template`, `HTML (Angular)` |`.ejs` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | @@ -169,13 +170,13 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | HTML | `HTML` |`.html` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | Jade | `Jade`, `Pug` |`.jade`, `.pug` | **[`Pug Beautify`](https://github.com/vingorius/pug-beautify)** | | Java | `Java` |`.java` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)** | -| JavaScript | `JavaScript` |`.js` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`ESLint Fixer`](https://github.com/eslint/eslint), [`JSCS Fixer`](https://github.com/jscs-dev/node-jscs/), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | -| JSON | `JSON` |`.json` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | +| JavaScript | `JavaScript` |`.js` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`ESLint Fixer`](https://github.com/eslint/eslint), [`JSCS Fixer`](https://github.com/jscs-dev/node-jscs/), [`Prettier`](https://github.com/prettier/prettier), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | +| JSON | `JSON` |`.json` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Prettier`](https://github.com/prettier/prettier), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | JSX | `JSX`, `JavaScript (JSX)`, `Babel ES6 JavaScript`, `JavaScript with JSX` |`.jsx`, `.js` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`JS Beautify`](https://github.com/beautify-web/js-beautify) | | LaTeX | `BibTeX`, `LaTeX`, `TeX` |`.bib`, `.tex`, `.sty`, `.cls`, `.dtx`, `.ins`, `.bbx`, `.cbx` | **[`Latex Beautify`](https://github.com/cmhughes/latexindent.pl)** | -| LESS | `LESS` |`.less` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`CSScomb`](https://github.com/csscomb/csscomb.js) | +| LESS | `LESS` |`.less` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Prettier`](https://github.com/prettier/prettier) | | Lua | `Lua` |`.lua`, `.ttslua` | **[`Lua beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/lua-beautifier/beautifier.coffee)** | -| Markdown | `GitHub Markdown` |`.markdown`, `.md` | **[`Tidy Markdown`](https://github.com/slang800/tidy-markdown)**, [`Remark`](https://github.com/wooorm/remark) | +| Markdown | `GitHub Markdown` |`.markdown`, `.md` | **[`Tidy Markdown`](https://github.com/slang800/tidy-markdown)**, [`Prettier`](https://github.com/prettier/prettier), [`Remark`](https://github.com/wooorm/remark) | | Marko | `Marko` |`.marko` | **[`Marko Beautifier`](https://github.com/marko-js/marko-prettyprint)** | | Mustache | `HTML (Mustache)` |`.mustache` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | Nginx | `nginx` |`.conf` | **[`Nginx Beautify`](https://github.com/denysvitali/nginxbeautify)** | @@ -192,7 +193,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | Ruby | `Ruby`, `Ruby on Rails` |`.rb` | **[`Rubocop`](https://github.com/bbatsov/rubocop)**, [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) | | Rust | `Rust` |`.rs`, `.rlib` | **[`rustfmt`](https://github.com/rust-lang-nursery/rustfmt)** | | Sass | `Sass` |`.sass` | **[`SassConvert`](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax)** | -| SCSS | `SCSS` |`.scss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`CSScomb`](https://github.com/csscomb/csscomb.js), [`SassConvert`](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) | +| SCSS | `SCSS` |`.scss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Prettier`](https://github.com/prettier/prettier), [`SassConvert`](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) | | Spacebars | `Spacebars` | | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | SQL | `SQL (Rails)`, `SQL` |`.sql` | **[`sqlformat`](https://github.com/andialbrecht/sqlparse)** | | SVG | `SVG` |`.svg` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | @@ -205,7 +206,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | UX Markup | `UX` |`.ux` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | Vala | `Vala` |`.vala`, `.vapi` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)** | | Visualforce | `Visualforce` |`.page` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | -| Vue | `Vue Component` |`.vue` | **[`Vue Beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/vue-beautifier.coffee)** | +| Vue | `Vue Component` |`.vue` | **[`Vue Beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/vue-beautifier.coffee)**, [`Prettier`](https://github.com/prettier/prettier) | | XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP`, `GSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp`, `.gsp`, `.plist`, `.recipe`, `.config` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`JS Beautify`](https://github.com/beautify-web/js-beautify) | | XTemplate | `XTemplate` |`.xtemplate` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | YAML | `YAML` |`.yml`, `.yaml` | **[`align-yaml`](https://github.com/jonschlinkert/align-yaml)** | diff --git a/docs/options.md b/docs/options.md index 6047ede..470de85 100644 --- a/docs/options.md +++ b/docs/options.md @@ -1913,27 +1913,27 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) #### [CSS](#css) -**Supported Beautifiers**: [`CSScomb`](#csscomb) [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) [`SassConvert`](#sassconvert) +**Supported Beautifiers**: [`CSScomb`](#csscomb) [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) [`SassConvert`](#sassconvert) -| Option | CSScomb | JS Beautify | Pretty Diff | SassConvert | -| --- | --- | --- | --- | --- | -| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `align_assignments` | :x: | :x: | :white_check_mark: | :x: | -| `configPath` | :white_check_mark: | :x: | :x: | :x: | -| `convert_quotes` | :x: | :x: | :white_check_mark: | :x: | -| `end_with_newline` | :x: | :white_check_mark: | :x: | :x: | -| `force_indentation` | :x: | :x: | :white_check_mark: | :x: | -| `indent_char` | :x: | :white_check_mark: | :white_check_mark: | :x: | -| `indent_comments` | :x: | :x: | :white_check_mark: | :x: | -| `indent_size` | :x: | :white_check_mark: | :white_check_mark: | :x: | -| `newline_between_rules` | :x: | :white_check_mark: | :white_check_mark: | :x: | -| `no_lead_zero` | :x: | :x: | :white_check_mark: | :x: | -| `predefinedConfig` | :white_check_mark: | :x: | :x: | :x: | -| `preserve_newlines` | :x: | :white_check_mark: | :white_check_mark: | :x: | -| `selector_separator_newline` | :x: | :white_check_mark: | :x: | :x: | -| `wrap_line_length` | :x: | :white_check_mark: | :white_check_mark: | :x: | +| Option | CSScomb | JS Beautify | Prettier | Pretty Diff | SassConvert | +| --- | --- | --- | --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `align_assignments` | :x: | :x: | :x: | :white_check_mark: | :x: | +| `configPath` | :white_check_mark: | :x: | :x: | :x: | :x: | +| `convert_quotes` | :x: | :x: | :x: | :white_check_mark: | :x: | +| `end_with_newline` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `force_indentation` | :x: | :x: | :x: | :white_check_mark: | :x: | +| `indent_char` | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | +| `indent_comments` | :x: | :x: | :x: | :white_check_mark: | :x: | +| `indent_size` | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | +| `newline_between_rules` | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | +| `no_lead_zero` | :x: | :x: | :x: | :white_check_mark: | :x: | +| `predefinedConfig` | :white_check_mark: | :x: | :x: | :x: | :x: | +| `preserve_newlines` | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | +| `selector_separator_newline` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `wrap_line_length` | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | **Description**: @@ -1964,7 +1964,7 @@ Disable CSS Beautification **Type**: `string` -**Enum**: `CSScomb` `JS Beautify` `Pretty Diff` `SassConvert` +**Enum**: `CSScomb` `JS Beautify` `Prettier` `Pretty Diff` `SassConvert` **Description**: @@ -5510,33 +5510,33 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) #### [JavaScript](#javascript) -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`JSCS Fixer`](#jscs-fixer) [`ESLint Fixer`](#eslint-fixer) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`JSCS Fixer`](#jscs-fixer) [`ESLint Fixer`](#eslint-fixer) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) -| Option | ESLint Fixer | JS Beautify | JSCS Fixer | Pretty Diff | -| --- | --- | --- | --- | --- | -| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `brace_style` | :x: | :white_check_mark: | :x: | :x: | -| `break_chained_methods` | :x: | :white_check_mark: | :x: | :white_check_mark: | -| `end_of_line` | :x: | :white_check_mark: | :x: | :x: | -| `end_with_comma` | :x: | :white_check_mark: | :x: | :white_check_mark: | -| `end_with_newline` | :x: | :white_check_mark: | :x: | :x: | -| `eval_code` | :x: | :white_check_mark: | :x: | :x: | -| `indent_char` | :x: | :white_check_mark: | :x: | :white_check_mark: | -| `indent_level` | :x: | :white_check_mark: | :x: | :x: | -| `indent_size` | :x: | :white_check_mark: | :x: | :white_check_mark: | -| `indent_with_tabs` | :x: | :white_check_mark: | :x: | :white_check_mark: | -| `jslint_happy` | :x: | :white_check_mark: | :x: | :x: | -| `keep_array_indentation` | :x: | :white_check_mark: | :x: | :x: | -| `keep_function_indentation` | :x: | :white_check_mark: | :x: | :x: | -| `max_preserve_newlines` | :x: | :white_check_mark: | :x: | :x: | -| `preserve_newlines` | :x: | :white_check_mark: | :x: | :white_check_mark: | -| `space_after_anon_function` | :x: | :white_check_mark: | :x: | :white_check_mark: | -| `space_before_conditional` | :x: | :white_check_mark: | :x: | :x: | -| `space_in_paren` | :x: | :white_check_mark: | :x: | :white_check_mark: | -| `unescape_strings` | :x: | :white_check_mark: | :x: | :x: | -| `wrap_line_length` | :x: | :white_check_mark: | :x: | :white_check_mark: | +| Option | ESLint Fixer | JS Beautify | JSCS Fixer | Prettier | Pretty Diff | +| --- | --- | --- | --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `brace_style` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `break_chained_methods` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `end_of_line` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `end_with_comma` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `end_with_newline` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `eval_code` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `indent_char` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `indent_level` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `indent_size` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `indent_with_tabs` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `jslint_happy` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `keep_array_indentation` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `keep_function_indentation` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `max_preserve_newlines` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `preserve_newlines` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `space_after_anon_function` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `space_before_conditional` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `space_in_paren` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `unescape_strings` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `wrap_line_length` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | **Description**: @@ -5567,7 +5567,7 @@ Disable JavaScript Beautification **Type**: `string` -**Enum**: `JS Beautify` `JSCS Fixer` `ESLint Fixer` `Pretty Diff` +**Enum**: `JS Beautify` `JSCS Fixer` `ESLint Fixer` `Prettier` `Pretty Diff` **Description**: @@ -6097,33 +6097,33 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre #### [JSON](#json) -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) -| Option | JS Beautify | Pretty Diff | -| --- | --- | --- | -| `disabled` | :white_check_mark: | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | -| `break_chained_methods` | :white_check_mark: | :white_check_mark: | -| `end_of_line` | :white_check_mark: | :x: | -| `end_with_comma` | :white_check_mark: | :white_check_mark: | -| `end_with_newline` | :white_check_mark: | :x: | -| `eval_code` | :white_check_mark: | :x: | -| `indent_char` | :white_check_mark: | :white_check_mark: | -| `indent_level` | :white_check_mark: | :x: | -| `indent_size` | :white_check_mark: | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | :x: | -| `keep_array_indentation` | :white_check_mark: | :x: | -| `keep_function_indentation` | :white_check_mark: | :x: | -| `max_preserve_newlines` | :white_check_mark: | :x: | -| `preserve_newlines` | :white_check_mark: | :white_check_mark: | -| `space_after_anon_function` | :white_check_mark: | :white_check_mark: | -| `space_before_conditional` | :white_check_mark: | :x: | -| `space_in_paren` | :white_check_mark: | :white_check_mark: | -| `unescape_strings` | :white_check_mark: | :x: | -| `wrap_line_length` | :white_check_mark: | :white_check_mark: | +| Option | JS Beautify | Prettier | Pretty Diff | +| --- | --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `brace_style` | :white_check_mark: | :x: | :x: | +| `break_chained_methods` | :white_check_mark: | :x: | :white_check_mark: | +| `end_of_line` | :white_check_mark: | :x: | :x: | +| `end_with_comma` | :white_check_mark: | :x: | :white_check_mark: | +| `end_with_newline` | :white_check_mark: | :x: | :x: | +| `eval_code` | :white_check_mark: | :x: | :x: | +| `indent_char` | :white_check_mark: | :x: | :white_check_mark: | +| `indent_level` | :white_check_mark: | :x: | :x: | +| `indent_size` | :white_check_mark: | :x: | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | :x: | :white_check_mark: | +| `jslint_happy` | :white_check_mark: | :x: | :x: | +| `keep_array_indentation` | :white_check_mark: | :x: | :x: | +| `keep_function_indentation` | :white_check_mark: | :x: | :x: | +| `max_preserve_newlines` | :white_check_mark: | :x: | :x: | +| `preserve_newlines` | :white_check_mark: | :x: | :white_check_mark: | +| `space_after_anon_function` | :white_check_mark: | :x: | :white_check_mark: | +| `space_before_conditional` | :white_check_mark: | :x: | :x: | +| `space_in_paren` | :white_check_mark: | :x: | :white_check_mark: | +| `unescape_strings` | :white_check_mark: | :x: | :x: | +| `wrap_line_length` | :white_check_mark: | :x: | :white_check_mark: | **Description**: @@ -6154,7 +6154,7 @@ Disable JSON Beautification **Type**: `string` -**Enum**: `JS Beautify` `Pretty Diff` +**Enum**: `JS Beautify` `Prettier` `Pretty Diff` **Description**: @@ -7553,25 +7553,25 @@ Remove trailing whitespace (Supported by Latex Beautify) #### [LESS](#less) -**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) -| Option | CSScomb | Pretty Diff | -| --- | --- | --- | -| `disabled` | :white_check_mark: | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `align_assignments` | :x: | :white_check_mark: | -| `configPath` | :white_check_mark: | :x: | -| `convert_quotes` | :x: | :white_check_mark: | -| `force_indentation` | :x: | :white_check_mark: | -| `indent_char` | :x: | :white_check_mark: | -| `indent_comments` | :x: | :white_check_mark: | -| `indent_size` | :x: | :white_check_mark: | -| `newline_between_rules` | :x: | :white_check_mark: | -| `no_lead_zero` | :x: | :white_check_mark: | -| `predefinedConfig` | :white_check_mark: | :x: | -| `preserve_newlines` | :x: | :white_check_mark: | -| `wrap_line_length` | :x: | :white_check_mark: | +| Option | CSScomb | Prettier | Pretty Diff | +| --- | --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `align_assignments` | :x: | :x: | :white_check_mark: | +| `configPath` | :white_check_mark: | :x: | :x: | +| `convert_quotes` | :x: | :x: | :white_check_mark: | +| `force_indentation` | :x: | :x: | :white_check_mark: | +| `indent_char` | :x: | :x: | :white_check_mark: | +| `indent_comments` | :x: | :x: | :white_check_mark: | +| `indent_size` | :x: | :x: | :white_check_mark: | +| `newline_between_rules` | :x: | :x: | :white_check_mark: | +| `no_lead_zero` | :x: | :x: | :white_check_mark: | +| `predefinedConfig` | :white_check_mark: | :x: | :x: | +| `preserve_newlines` | :x: | :x: | :white_check_mark: | +| `wrap_line_length` | :x: | :x: | :white_check_mark: | **Description**: @@ -7602,7 +7602,7 @@ Disable LESS Beautification **Type**: `string` -**Enum**: `CSScomb` `Pretty Diff` +**Enum**: `CSScomb` `Prettier` `Pretty Diff` **Description**: @@ -8036,16 +8036,16 @@ Override EOL from line-ending-selector (Supported by Lua beautifier) #### [Markdown](#markdown) -**Supported Beautifiers**: [`Remark`](#remark) [`Tidy Markdown`](#tidy-markdown) +**Supported Beautifiers**: [`Prettier`](#prettier) [`Remark`](#remark) [`Tidy Markdown`](#tidy-markdown) -| Option | Remark | Tidy Markdown | -| --- | --- | --- | -| `disabled` | :white_check_mark: | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `commonmark` | :white_check_mark: | :x: | -| `gfm` | :white_check_mark: | :x: | -| `yaml` | :white_check_mark: | :x: | +| Option | Prettier | Remark | Tidy Markdown | +| --- | --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `commonmark` | :x: | :white_check_mark: | :x: | +| `gfm` | :x: | :white_check_mark: | :x: | +| `yaml` | :x: | :white_check_mark: | :x: | **Description**: @@ -8076,7 +8076,7 @@ Disable Markdown Beautification **Type**: `string` -**Enum**: `Remark` `Tidy Markdown` +**Enum**: `Prettier` `Remark` `Tidy Markdown` **Description**: @@ -11154,25 +11154,25 @@ Automatically beautify Sass files on save #### [SCSS](#scss) -**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) [`SassConvert`](#sassconvert) +**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) [`SassConvert`](#sassconvert) -| Option | CSScomb | Pretty Diff | SassConvert | -| --- | --- | --- | --- | -| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `align_assignments` | :x: | :white_check_mark: | :x: | -| `configPath` | :white_check_mark: | :x: | :x: | -| `convert_quotes` | :x: | :white_check_mark: | :x: | -| `force_indentation` | :x: | :white_check_mark: | :x: | -| `indent_char` | :x: | :white_check_mark: | :x: | -| `indent_comments` | :x: | :white_check_mark: | :x: | -| `indent_size` | :x: | :white_check_mark: | :x: | -| `newline_between_rules` | :x: | :white_check_mark: | :x: | -| `no_lead_zero` | :x: | :white_check_mark: | :x: | -| `predefinedConfig` | :white_check_mark: | :x: | :x: | -| `preserve_newlines` | :x: | :white_check_mark: | :x: | -| `wrap_line_length` | :x: | :white_check_mark: | :x: | +| Option | CSScomb | Prettier | Pretty Diff | SassConvert | +| --- | --- | --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `align_assignments` | :x: | :x: | :white_check_mark: | :x: | +| `configPath` | :white_check_mark: | :x: | :x: | :x: | +| `convert_quotes` | :x: | :x: | :white_check_mark: | :x: | +| `force_indentation` | :x: | :x: | :white_check_mark: | :x: | +| `indent_char` | :x: | :x: | :white_check_mark: | :x: | +| `indent_comments` | :x: | :x: | :white_check_mark: | :x: | +| `indent_size` | :x: | :x: | :white_check_mark: | :x: | +| `newline_between_rules` | :x: | :x: | :white_check_mark: | :x: | +| `no_lead_zero` | :x: | :x: | :white_check_mark: | :x: | +| `predefinedConfig` | :white_check_mark: | :x: | :x: | :x: | +| `preserve_newlines` | :x: | :x: | :white_check_mark: | :x: | +| `wrap_line_length` | :x: | :x: | :white_check_mark: | :x: | **Description**: @@ -11203,7 +11203,7 @@ Disable SCSS Beautification **Type**: `string` -**Enum**: `CSScomb` `Pretty Diff` `SassConvert` +**Enum**: `CSScomb` `Prettier` `Pretty Diff` `SassConvert` **Description**: @@ -14030,39 +14030,39 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) #### [Vue](#vue) -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) +**Supported Beautifiers**: [`Prettier`](#prettier) [`Vue Beautifier`](#vue-beautifier) -| Option | Vue Beautifier | -| --- | --- | -| `disabled` | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | -| `brace_style` | :white_check_mark: | -| `break_chained_methods` | :white_check_mark: | -| `end_of_line` | :white_check_mark: | -| `end_with_comma` | :white_check_mark: | -| `end_with_newline` | :white_check_mark: | -| `eval_code` | :white_check_mark: | -| `extra_liners` | :white_check_mark: | -| `indent_char` | :white_check_mark: | -| `indent_inner_html` | :white_check_mark: | -| `indent_level` | :white_check_mark: | -| `indent_scripts` | :white_check_mark: | -| `indent_size` | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | -| `keep_array_indentation` | :white_check_mark: | -| `keep_function_indentation` | :white_check_mark: | -| `max_preserve_newlines` | :white_check_mark: | -| `preserve_newlines` | :white_check_mark: | -| `space_after_anon_function` | :white_check_mark: | -| `space_before_conditional` | :white_check_mark: | -| `space_in_paren` | :white_check_mark: | -| `unescape_strings` | :white_check_mark: | -| `unformatted` | :white_check_mark: | -| `wrap_attributes` | :white_check_mark: | -| `wrap_attributes_indent_size` | :white_check_mark: | -| `wrap_line_length` | :white_check_mark: | +| Option | Prettier | Vue Beautifier | +| --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | +| `brace_style` | :x: | :white_check_mark: | +| `break_chained_methods` | :x: | :white_check_mark: | +| `end_of_line` | :x: | :white_check_mark: | +| `end_with_comma` | :x: | :white_check_mark: | +| `end_with_newline` | :x: | :white_check_mark: | +| `eval_code` | :x: | :white_check_mark: | +| `extra_liners` | :x: | :white_check_mark: | +| `indent_char` | :x: | :white_check_mark: | +| `indent_inner_html` | :x: | :white_check_mark: | +| `indent_level` | :x: | :white_check_mark: | +| `indent_scripts` | :x: | :white_check_mark: | +| `indent_size` | :x: | :white_check_mark: | +| `indent_with_tabs` | :x: | :white_check_mark: | +| `jslint_happy` | :x: | :white_check_mark: | +| `keep_array_indentation` | :x: | :white_check_mark: | +| `keep_function_indentation` | :x: | :white_check_mark: | +| `max_preserve_newlines` | :x: | :white_check_mark: | +| `preserve_newlines` | :x: | :white_check_mark: | +| `space_after_anon_function` | :x: | :white_check_mark: | +| `space_before_conditional` | :x: | :white_check_mark: | +| `space_in_paren` | :x: | :white_check_mark: | +| `unescape_strings` | :x: | :white_check_mark: | +| `unformatted` | :x: | :white_check_mark: | +| `wrap_attributes` | :x: | :white_check_mark: | +| `wrap_attributes_indent_size` | :x: | :white_check_mark: | +| `wrap_line_length` | :x: | :white_check_mark: | **Description**: @@ -14093,7 +14093,7 @@ Disable Vue Beautification **Type**: `string` -**Enum**: `Vue Beautifier` +**Enum**: `Prettier` `Vue Beautifier` **Description**: diff --git a/package.json b/package.json index bdb74b1..d0d4d46 100644 --- a/package.json +++ b/package.json @@ -183,6 +183,7 @@ "node-dir": "0.1.17", "node-uuid": "1.4.8", "open": "0.0.5", + "prettier": "^1.10.2", "prettydiff2": "^2.2.7", "pug-beautify": "^0.1.1", "remark": "6.0.1", @@ -414,7 +415,8 @@ "goimports", "terraform", "terraformfmt", - "tsx" + "tsx", + "prettier" ], "devDependencies": { "coffeelint": "1.16.0" diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index cc3f237..3d57821 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -61,6 +61,7 @@ module.exports = class Beautifiers extends EventEmitter 'perltidy' 'php-cs-fixer' 'phpcbf' + 'prettier' 'prettydiff' 'pybeautifier' 'pug-beautify' diff --git a/src/beautifiers/prettier.coffee b/src/beautifiers/prettier.coffee new file mode 100644 index 0000000..e7fea61 --- /dev/null +++ b/src/beautifiers/prettier.coffee @@ -0,0 +1,38 @@ +"use strict" + +Beautifier = require('./beautifier') +prettier = require("prettier") + +module.exports = class Prettier extends Beautifier + name: "Prettier" + link: "https://github.com/prettier/prettier" + options: { + JavaScript: false + CSS: false + LESS: false + SCSS: false + Vue: false + JSON: false + Markdown: false + } + + beautify: (text, language, options) -> + return new @Promise((resolve, reject) -> + _ = require('lodash') + + prettierLanguage = _.find(prettier.getSupportInfo().languages, 'name': language) + if prettierLanguage + parser = prettierLanguage.parsers[0] + else + reject(new Error("Unknown language for Prettier")) + + try + result = prettier.format(text, { + tabWidth: options.indent_size, + useTabs: options.indent_with_tabs + parser + }); + resolve result + catch err + reject(err) + ) \ No newline at end of file diff --git a/src/options.json b/src/options.json index d545bd3..b5c0ec2 100644 --- a/src/options.json +++ b/src/options.json @@ -893,6 +893,7 @@ "beautifiers": [ "CSScomb", "JS Beautify", + "Prettier", "Pretty Diff", "SassConvert" ], @@ -1132,6 +1133,7 @@ "enum": [ "CSScomb", "JS Beautify", + "Prettier", "Pretty Diff", "SassConvert" ] @@ -3139,6 +3141,7 @@ "JS Beautify", "JSCS Fixer", "ESLint Fixer", + "Prettier", "Pretty Diff" ], "grammars": [ @@ -3467,6 +3470,7 @@ "JS Beautify", "JSCS Fixer", "ESLint Fixer", + "Prettier", "Pretty Diff" ] }, @@ -3486,6 +3490,7 @@ "collapsed": true, "beautifiers": [ "JS Beautify", + "Prettier", "Pretty Diff" ], "grammars": [ @@ -3812,6 +3817,7 @@ "description": "Default Beautifier to be used for JSON", "enum": [ "JS Beautify", + "Prettier", "Pretty Diff" ] }, @@ -4350,6 +4356,7 @@ "collapsed": true, "beautifiers": [ "CSScomb", + "Prettier", "Pretty Diff" ], "grammars": [ @@ -4554,6 +4561,7 @@ "description": "Default Beautifier to be used for LESS", "enum": [ "CSScomb", + "Prettier", "Pretty Diff" ] }, @@ -4633,6 +4641,7 @@ "description": "Options for language Markdown", "collapsed": true, "beautifiers": [ + "Prettier", "Remark", "Tidy Markdown" ], @@ -4700,6 +4709,7 @@ "default": "Tidy Markdown", "description": "Default Beautifier to be used for Markdown", "enum": [ + "Prettier", "Remark", "Tidy Markdown" ] @@ -6566,6 +6576,7 @@ "collapsed": true, "beautifiers": [ "CSScomb", + "Prettier", "Pretty Diff", "SassConvert" ], @@ -6771,6 +6782,7 @@ "description": "Default Beautifier to be used for SCSS", "enum": [ "CSScomb", + "Prettier", "Pretty Diff", "SassConvert" ] @@ -8068,6 +8080,7 @@ "description": "Options for language Vue", "collapsed": true, "beautifiers": [ + "Prettier", "Vue Beautifier" ], "grammars": [ @@ -8559,6 +8572,7 @@ "default": "Vue Beautifier", "description": "Default Beautifier to be used for Vue", "enum": [ + "Prettier", "Vue Beautifier" ] }, From cc56ba34b062bac4363e18f21c5be93912cf592d Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:13:43 -0600 Subject: [PATCH 084/103] Fix up options for Prettier, add new bracket_spacing option --- docs/options.md | 360 +++++++++++++++++++++++++++++++- src/beautifiers/prettier.coffee | 9 +- src/languages/javascript.coffee | 4 + src/options.json | 105 +++++++++- 4 files changed, 467 insertions(+), 11 deletions(-) diff --git a/docs/options.md b/docs/options.md index 470de85..6e3422d 100644 --- a/docs/options.md +++ b/docs/options.md @@ -1077,6 +1077,7 @@ Automatically beautify Clojure files on save | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | +| `bracket_spacing` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :x: | | `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :x: | @@ -1184,6 +1185,30 @@ Automatically beautify CoffeeScript files on save } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) + +**Description**: + +Insert spaces between brackets in object literals (Supported by Coffee Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -2519,6 +2544,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | +| `bracket_spacing` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | | `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :white_check_mark: | @@ -2632,6 +2658,30 @@ Automatically beautify EJS files on save } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -5518,6 +5568,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `brace_style` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `bracket_spacing` | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | | `break_chained_methods` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | | `end_of_line` | :x: | :white_check_mark: | :x: | :x: | :x: | | `end_with_comma` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | @@ -5525,8 +5576,8 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `eval_code` | :x: | :white_check_mark: | :x: | :x: | :x: | | `indent_char` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | | `indent_level` | :x: | :white_check_mark: | :x: | :x: | :x: | -| `indent_size` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | -| `indent_with_tabs` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `indent_size` | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | +| `indent_with_tabs` | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | | `jslint_happy` | :x: | :white_check_mark: | :x: | :x: | :x: | | `keep_array_indentation` | :x: | :white_check_mark: | :x: | :x: | :x: | | `keep_function_indentation` | :x: | :white_check_mark: | :x: | :x: | :x: | @@ -5625,6 +5676,30 @@ Automatically beautify JavaScript files on save } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify, Prettier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -5809,11 +5884,11 @@ Initial indentation level (Supported by JS Beautify) **Type**: `integer` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation size/length (Supported by JS Beautify, Pretty Diff) +Indentation size/length (Supported by JS Beautify, Prettier, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -5833,11 +5908,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Prettier, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -6105,6 +6180,7 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | :x: | +| `bracket_spacing` | :white_check_mark: | :x: | :x: | | `break_chained_methods` | :white_check_mark: | :x: | :white_check_mark: | | `end_of_line` | :white_check_mark: | :x: | :x: | | `end_with_comma` | :white_check_mark: | :x: | :white_check_mark: | @@ -6212,6 +6288,30 @@ Automatically beautify JSON files on save } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -6692,6 +6792,7 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | +| `bracket_spacing` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | | `e4x` | :white_check_mark: | :x: | | `end_of_line` | :white_check_mark: | :x: | @@ -6800,6 +6901,30 @@ Automatically beautify JSX files on save } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -13003,6 +13128,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | +| `bracket_spacing` | :white_check_mark: | | `break_chained_methods` | :white_check_mark: | | `end_of_line` | :white_check_mark: | | `end_with_comma` | :white_check_mark: | @@ -13110,6 +13236,30 @@ Automatically beautify TypeScript files on save } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Insert spaces between brackets in object literals (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -14038,6 +14188,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :x: | :white_check_mark: | +| `bracket_spacing` | :x: | :white_check_mark: | | `break_chained_methods` | :x: | :white_check_mark: | | `end_of_line` | :x: | :white_check_mark: | | `end_with_comma` | :x: | :white_check_mark: | @@ -14151,6 +14302,30 @@ Automatically beautify Vue files on save } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Insert spaces between brackets in object literals (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -16182,6 +16357,30 @@ Override EOL from line-ending-selector (Supported by Coffee Formatter) } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) + +**Description**: + +Insert spaces between brackets in object literals (Supported by Coffee Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ### Fortran Beautifier @@ -16870,6 +17069,30 @@ Override EOL from line-ending-selector (Supported by JS Beautify) } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Indent inner html](#indent-inner-html) **Namespace**: `html` @@ -18177,6 +18400,83 @@ Specify a configuration file which will override the default name of .perltidyrc ``` +### Prettier + +##### [Indent size](#indent-size) + +**Namespace**: `js` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Indentation size/length (Supported by JS Beautify, Prettier, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_size": 4 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Prettier, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify, Prettier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + + ### Pretty Diff ##### [Indent size](#indent-size) @@ -19300,6 +19600,30 @@ Override EOL from line-ending-selector (Supported by TypeScript Formatter) } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Insert spaces between brackets in object literals (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ### Uncrustify @@ -19830,6 +20154,30 @@ Override EOL from line-ending-selector (Supported by Vue Beautifier) } ``` +##### [Bracket spacing](#bracket-spacing) + +**Namespace**: `js` + +**Key**: `bracket_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Insert spaces between brackets in object literals (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "bracket_spacing": false + } +} +``` + ##### [Indent inner html](#indent-inner-html) **Namespace**: `html` diff --git a/src/beautifiers/prettier.coffee b/src/beautifiers/prettier.coffee index e7fea61..3c083ae 100644 --- a/src/beautifiers/prettier.coffee +++ b/src/beautifiers/prettier.coffee @@ -7,7 +7,11 @@ module.exports = class Prettier extends Beautifier name: "Prettier" link: "https://github.com/prettier/prettier" options: { - JavaScript: false + _: + tabWidth: "indent_size" + useTabs: "indent_with_tabs" + JavaScript: + bracketSpacing: "bracket_spacing" CSS: false LESS: false SCSS: false @@ -28,8 +32,7 @@ module.exports = class Prettier extends Beautifier try result = prettier.format(text, { - tabWidth: options.indent_size, - useTabs: options.indent_with_tabs + options parser }); resolve result diff --git a/src/languages/javascript.coffee b/src/languages/javascript.coffee index 04dd35b..5d795c3 100644 --- a/src/languages/javascript.coffee +++ b/src/languages/javascript.coffee @@ -108,5 +108,9 @@ module.exports = { default: "System Default" enum: ["CRLF","LF","System Default"] description: "Override EOL from line-ending-selector" + bracket_spacing: + type: 'boolean' + default: false + description: "Insert spaces between brackets in object literals" } diff --git a/src/options.json b/src/options.json index b5c0ec2..12228a2 100644 --- a/src/options.json +++ b/src/options.json @@ -642,6 +642,20 @@ "namespace": "js" } }, + "bracket_spacing": { + "type": "boolean", + "default": false, + "description": "Insert spaces between brackets in object literals (Supported by Coffee Formatter)", + "title": "Bracket spacing", + "beautifiers": [ + "Coffee Formatter" + ], + "key": "bracket_spacing", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3, @@ -1565,6 +1579,20 @@ "namespace": "js" } }, + "bracket_spacing": { + "type": "boolean", + "default": false, + "description": "Insert spaces between brackets in object literals (Supported by JS Beautify)", + "title": "Bracket spacing", + "beautifiers": [ + "JS Beautify" + ], + "key": "bracket_spacing", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "indent_inner_html": { "type": "boolean", "default": false, @@ -3155,10 +3183,11 @@ "type": "integer", "default": null, "minimum": 0, - "description": "Indentation size/length (Supported by JS Beautify, Pretty Diff)", + "description": "Indentation size/length (Supported by JS Beautify, Prettier, Pretty Diff)", "title": "Indent size", "beautifiers": [ "JS Beautify", + "Prettier", "Pretty Diff" ], "key": "indent_size", @@ -3199,10 +3228,11 @@ "indent_with_tabs": { "type": "boolean", "default": null, - "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff)", + "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Prettier, Pretty Diff)", "title": "Indent with tabs", "beautifiers": [ "JS Beautify", + "Prettier", "Pretty Diff" ], "key": "indent_with_tabs", @@ -3453,6 +3483,21 @@ "namespace": "js" } }, + "bracket_spacing": { + "type": "boolean", + "default": false, + "description": "Insert spaces between brackets in object literals (Supported by JS Beautify, Prettier)", + "title": "Bracket spacing", + "beautifiers": [ + "JS Beautify", + "Prettier" + ], + "key": "bracket_spacing", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3, @@ -3802,6 +3847,20 @@ "namespace": "js" } }, + "bracket_spacing": { + "type": "boolean", + "default": false, + "description": "Insert spaces between brackets in object literals (Supported by JS Beautify)", + "title": "Bracket spacing", + "beautifiers": [ + "JS Beautify" + ], + "key": "bracket_spacing", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3, @@ -4166,6 +4225,20 @@ "namespace": "js" } }, + "bracket_spacing": { + "type": "boolean", + "default": false, + "description": "Insert spaces between brackets in object literals (Supported by JS Beautify)", + "title": "Bracket spacing", + "beautifiers": [ + "JS Beautify" + ], + "key": "bracket_spacing", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3, @@ -7894,6 +7967,20 @@ "namespace": "js" } }, + "bracket_spacing": { + "type": "boolean", + "default": false, + "description": "Insert spaces between brackets in object literals (Supported by TypeScript Formatter)", + "title": "Bracket spacing", + "beautifiers": [ + "TypeScript Formatter" + ], + "key": "bracket_spacing", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3, @@ -8383,6 +8470,20 @@ "namespace": "js" } }, + "bracket_spacing": { + "type": "boolean", + "default": false, + "description": "Insert spaces between brackets in object literals (Supported by Vue Beautifier)", + "title": "Bracket spacing", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "bracket_spacing", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "indent_inner_html": { "type": "boolean", "default": false, From 0c6ae87b097ea93246149574edfff5a1a907da9b Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:18:01 -0600 Subject: [PATCH 085/103] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e51a050..f5a31e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Next - Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable - See [#601](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for tsx files +- See [#1497](https://github.com/Glavin001/atom-beautify/issues/1497) and [#802](https://github.com/Glavin001/atom-beautify/issues/802) # v0.30.9 (2017-11-22) - Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed. From 00aad9cd3ab658df5d3651a4d3d8335b33930efe Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:23:43 -0600 Subject: [PATCH 086/103] Add react Atom package for proper JSX support --- atom-packages.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/atom-packages.txt b/atom-packages.txt index aa032ad..e7b6b1e 100644 --- a/atom-packages.txt +++ b/atom-packages.txt @@ -7,3 +7,4 @@ language-lua language-elm language-puppet fuse +react From c661bff7afea6cc33425dfb0a423c12e31c49f43 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:36:45 -0600 Subject: [PATCH 087/103] Fix lint error --- src/beautifiers/prettier.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/prettier.coffee b/src/beautifiers/prettier.coffee index 3c083ae..528f56e 100644 --- a/src/beautifiers/prettier.coffee +++ b/src/beautifiers/prettier.coffee @@ -34,7 +34,7 @@ module.exports = class Prettier extends Beautifier result = prettier.format(text, { options parser - }); + }) resolve result catch err reject(err) From 9b3d4adb1516d01cbc15e699aff9fd1921c5004d Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:38:09 -0600 Subject: [PATCH 088/103] Add --yes for opam init step --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 07c27c2..dd8450a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,7 +82,7 @@ before_install: # CoffeeScript - npm install coffee-formatter # OCaml - - opam init --auto-setup + - opam init --yes --auto-setup # Init environment variables for opam - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; From 152d6967bc4ce20cf8dc37b3ab8d31f51b2599b3 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:53:20 -0600 Subject: [PATCH 089/103] Make suggested updates --- src/beautifiers/prettier.coffee | 7 +++++-- src/languages/javascript.coffee | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/beautifiers/prettier.coffee b/src/beautifiers/prettier.coffee index 528f56e..6ee198a 100644 --- a/src/beautifiers/prettier.coffee +++ b/src/beautifiers/prettier.coffee @@ -9,9 +9,12 @@ module.exports = class Prettier extends Beautifier options: { _: tabWidth: "indent_size" - useTabs: "indent_with_tabs" + useTabs: ["indent_with_tabs", "indent_char", (indent_with_tabs, indent_char) -> + return (indent_with_tabs is true) or (indent_char is "\t") + ] JavaScript: - bracketSpacing: "bracket_spacing" + bracketSpacing: "object_curly_spacing" + TypeScript: false CSS: false LESS: false SCSS: false diff --git a/src/languages/javascript.coffee b/src/languages/javascript.coffee index 5d795c3..6f2877e 100644 --- a/src/languages/javascript.coffee +++ b/src/languages/javascript.coffee @@ -108,7 +108,7 @@ module.exports = { default: "System Default" enum: ["CRLF","LF","System Default"] description: "Override EOL from line-ending-selector" - bracket_spacing: + object_curly_spacing: type: 'boolean' default: false description: "Insert spaces between brackets in object literals" From 76028d64d8488bbd00d8d7ed6429011772e481c9 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 11:54:05 -0600 Subject: [PATCH 090/103] Revert --yes addition to opam init --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd8450a..07c27c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,7 +82,7 @@ before_install: # CoffeeScript - npm install coffee-formatter # OCaml - - opam init --yes --auto-setup + - opam init --auto-setup # Init environment variables for opam - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then eval `opam config env`; From 569f76271fd0b74d4b89bbd1ab14cec1346a46c3 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 12:13:23 -0600 Subject: [PATCH 091/103] Skip Ocaml test, comment out opam and ocp-indent installations for CI --- .travis.yml | 10 +++++----- .../ocaml/original/{js-pattern.ml => _js-pattern.ml} | 0 2 files changed, 5 insertions(+), 5 deletions(-) rename examples/nested-jsbeautifyrc/ocaml/original/{js-pattern.ml => _js-pattern.ml} (100%) diff --git a/.travis.yml b/.travis.yml index 07c27c2..14bd112 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,9 +82,9 @@ before_install: # CoffeeScript - npm install coffee-formatter # OCaml - - opam init --auto-setup + # - opam init --auto-setup # Init environment variables for opam - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - eval `opam config env`; - fi - - opam install --yes ocp-indent + # - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + # eval `opam config env`; + # fi + # - opam install --yes ocp-indent diff --git a/examples/nested-jsbeautifyrc/ocaml/original/js-pattern.ml b/examples/nested-jsbeautifyrc/ocaml/original/_js-pattern.ml similarity index 100% rename from examples/nested-jsbeautifyrc/ocaml/original/js-pattern.ml rename to examples/nested-jsbeautifyrc/ocaml/original/_js-pattern.ml From 1de54efef41c75c2648adee9e0fcf93ac42a2ad0 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 12:51:23 -0600 Subject: [PATCH 092/103] Rerun docs, make typescript-formatter the default for typescript --- README.md | 2 +- docs/options.md | 468 +++++++++++++++++--------------- src/languages/typescript.coffee | 2 + src/options.json | 49 ++-- 4 files changed, 276 insertions(+), 245 deletions(-) diff --git a/README.md b/README.md index 9c3d948..d1dc883 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | TSS | `TSS` |`.tss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | TSX | `TypeScriptReact` |`.tsx` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** | | Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | -| TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** | +| TypeScript | `TypeScript` |`.ts` | **[`Prettier`](https://github.com/prettier/prettier)**, [`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter) | | UX Markup | `UX` |`.ux` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | Vala | `Vala` |`.vala`, `.vapi` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)** | | Visualforce | `Visualforce` |`.page` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | diff --git a/docs/options.md b/docs/options.md index 6e3422d..3d90896 100644 --- a/docs/options.md +++ b/docs/options.md @@ -1077,7 +1077,6 @@ Automatically beautify Clojure files on save | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | -| `bracket_spacing` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :x: | | `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :x: | @@ -1091,6 +1090,7 @@ Automatically beautify Clojure files on save | `keep_array_indentation` | :white_check_mark: | :x: | | `keep_function_indentation` | :white_check_mark: | :x: | | `max_preserve_newlines` | :white_check_mark: | :x: | +| `object_curly_spacing` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :x: | | `space_after_anon_function` | :white_check_mark: | :x: | | `space_before_conditional` | :white_check_mark: | :x: | @@ -1185,30 +1185,6 @@ Automatically beautify CoffeeScript files on save } ``` -##### [Bracket spacing](#bracket-spacing) - -**Namespace**: `js` - -**Key**: `bracket_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Insert spaces between brackets in object literals (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "bracket_spacing": false - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -1531,6 +1507,30 @@ Number of line-breaks to be preserved in one chunk (Supported by Coffee Formatte } ``` +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) + +**Description**: + +Insert spaces between brackets in object literals (Supported by Coffee Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -2544,7 +2544,6 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | -| `bracket_spacing` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | | `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :white_check_mark: | @@ -2561,6 +2560,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `keep_array_indentation` | :white_check_mark: | :x: | | `keep_function_indentation` | :white_check_mark: | :x: | | `max_preserve_newlines` | :white_check_mark: | :x: | +| `object_curly_spacing` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | | `space_after_anon_function` | :white_check_mark: | :white_check_mark: | | `space_before_conditional` | :white_check_mark: | :x: | @@ -2658,30 +2658,6 @@ Automatically beautify EJS files on save } ``` -##### [Bracket spacing](#bracket-spacing) - -**Namespace**: `js` - -**Key**: `bracket_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Insert spaces between brackets in object literals (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "bracket_spacing": false - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -3086,6 +3062,30 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) } ``` +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -5568,13 +5568,12 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `brace_style` | :x: | :white_check_mark: | :x: | :x: | :x: | -| `bracket_spacing` | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | | `break_chained_methods` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | | `end_of_line` | :x: | :white_check_mark: | :x: | :x: | :x: | | `end_with_comma` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | | `end_with_newline` | :x: | :white_check_mark: | :x: | :x: | :x: | | `eval_code` | :x: | :white_check_mark: | :x: | :x: | :x: | -| `indent_char` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | +| `indent_char` | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | | `indent_level` | :x: | :white_check_mark: | :x: | :x: | :x: | | `indent_size` | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | | `indent_with_tabs` | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | @@ -5582,6 +5581,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `keep_array_indentation` | :x: | :white_check_mark: | :x: | :x: | :x: | | `keep_function_indentation` | :x: | :white_check_mark: | :x: | :x: | :x: | | `max_preserve_newlines` | :x: | :white_check_mark: | :x: | :x: | :x: | +| `object_curly_spacing` | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | | `preserve_newlines` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | | `space_after_anon_function` | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | | `space_before_conditional` | :x: | :white_check_mark: | :x: | :x: | :x: | @@ -5676,30 +5676,6 @@ Automatically beautify JavaScript files on save } ``` -##### [Bracket spacing](#bracket-spacing) - -**Namespace**: `js` - -**Key**: `bracket_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) - -**Description**: - -Insert spaces between brackets in object literals (Supported by JS Beautify, Prettier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "bracket_spacing": false - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -5834,11 +5810,11 @@ End output with newline (Supported by JS Beautify) **Type**: `string` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation character (Supported by JS Beautify, Pretty Diff) +Indentation character (Supported by JS Beautify, Prettier, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -6022,6 +5998,30 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) } ``` +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify, Prettier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -6180,7 +6180,6 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | :x: | -| `bracket_spacing` | :white_check_mark: | :x: | :x: | | `break_chained_methods` | :white_check_mark: | :x: | :white_check_mark: | | `end_of_line` | :white_check_mark: | :x: | :x: | | `end_with_comma` | :white_check_mark: | :x: | :white_check_mark: | @@ -6194,6 +6193,7 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `keep_array_indentation` | :white_check_mark: | :x: | :x: | | `keep_function_indentation` | :white_check_mark: | :x: | :x: | | `max_preserve_newlines` | :white_check_mark: | :x: | :x: | +| `object_curly_spacing` | :white_check_mark: | :x: | :x: | | `preserve_newlines` | :white_check_mark: | :x: | :white_check_mark: | | `space_after_anon_function` | :white_check_mark: | :x: | :white_check_mark: | | `space_before_conditional` | :white_check_mark: | :x: | :x: | @@ -6288,30 +6288,6 @@ Automatically beautify JSON files on save } ``` -##### [Bracket spacing](#bracket-spacing) - -**Namespace**: `js` - -**Key**: `bracket_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Insert spaces between brackets in object literals (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "bracket_spacing": false - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -6634,6 +6610,30 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) } ``` +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -6792,7 +6792,6 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | -| `bracket_spacing` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | | `e4x` | :white_check_mark: | :x: | | `end_of_line` | :white_check_mark: | :x: | @@ -6807,6 +6806,7 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `keep_array_indentation` | :white_check_mark: | :x: | | `keep_function_indentation` | :white_check_mark: | :x: | | `max_preserve_newlines` | :white_check_mark: | :x: | +| `object_curly_spacing` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | | `space_after_anon_function` | :white_check_mark: | :white_check_mark: | | `space_before_conditional` | :white_check_mark: | :x: | @@ -6901,30 +6901,6 @@ Automatically beautify JSX files on save } ``` -##### [Bracket spacing](#bracket-spacing) - -**Namespace**: `js` - -**Key**: `bracket_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Insert spaces between brackets in object literals (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "bracket_spacing": false - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -7273,6 +7249,30 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) } ``` +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Insert spaces between brackets in object literals (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -13120,34 +13120,34 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) #### [TypeScript](#typescript) -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) +**Supported Beautifiers**: [`Prettier`](#prettier) [`TypeScript Formatter`](#typescript-formatter) -| Option | TypeScript Formatter | -| --- | --- | -| `disabled` | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | -| `brace_style` | :white_check_mark: | -| `bracket_spacing` | :white_check_mark: | -| `break_chained_methods` | :white_check_mark: | -| `end_of_line` | :white_check_mark: | -| `end_with_comma` | :white_check_mark: | -| `end_with_newline` | :white_check_mark: | -| `eval_code` | :white_check_mark: | -| `indent_char` | :white_check_mark: | -| `indent_level` | :white_check_mark: | -| `indent_size` | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | -| `keep_array_indentation` | :white_check_mark: | -| `keep_function_indentation` | :white_check_mark: | -| `max_preserve_newlines` | :white_check_mark: | -| `preserve_newlines` | :white_check_mark: | -| `space_after_anon_function` | :white_check_mark: | -| `space_before_conditional` | :white_check_mark: | -| `space_in_paren` | :white_check_mark: | -| `unescape_strings` | :white_check_mark: | -| `wrap_line_length` | :white_check_mark: | +| Option | Prettier | TypeScript Formatter | +| --- | --- | --- | +| `disabled` | :white_check_mark: | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | :white_check_mark: | +| `brace_style` | :x: | :white_check_mark: | +| `break_chained_methods` | :x: | :white_check_mark: | +| `end_of_line` | :x: | :white_check_mark: | +| `end_with_comma` | :x: | :white_check_mark: | +| `end_with_newline` | :x: | :white_check_mark: | +| `eval_code` | :x: | :white_check_mark: | +| `indent_char` | :x: | :white_check_mark: | +| `indent_level` | :x: | :white_check_mark: | +| `indent_size` | :x: | :white_check_mark: | +| `indent_with_tabs` | :x: | :white_check_mark: | +| `jslint_happy` | :x: | :white_check_mark: | +| `keep_array_indentation` | :x: | :white_check_mark: | +| `keep_function_indentation` | :x: | :white_check_mark: | +| `max_preserve_newlines` | :x: | :white_check_mark: | +| `object_curly_spacing` | :x: | :white_check_mark: | +| `preserve_newlines` | :x: | :white_check_mark: | +| `space_after_anon_function` | :x: | :white_check_mark: | +| `space_before_conditional` | :x: | :white_check_mark: | +| `space_in_paren` | :x: | :white_check_mark: | +| `unescape_strings` | :x: | :white_check_mark: | +| `wrap_line_length` | :x: | :white_check_mark: | **Description**: @@ -13174,11 +13174,11 @@ Disable TypeScript Beautification **Important**: This option is only configurable from within Atom Beautify's setting panel. -**Default**: `TypeScript Formatter` +**Default**: `Prettier` **Type**: `string` -**Enum**: `TypeScript Formatter` +**Enum**: `Prettier` `TypeScript Formatter` **Description**: @@ -13236,30 +13236,6 @@ Automatically beautify TypeScript files on save } ``` -##### [Bracket spacing](#bracket-spacing) - -**Namespace**: `js` - -**Key**: `bracket_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Insert spaces between brackets in object literals (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "bracket_spacing": false - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -13582,6 +13558,30 @@ Number of line-breaks to be preserved in one chunk (Supported by TypeScript Form } ``` +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Insert spaces between brackets in object literals (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `js` @@ -14188,7 +14188,6 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :x: | :white_check_mark: | -| `bracket_spacing` | :x: | :white_check_mark: | | `break_chained_methods` | :x: | :white_check_mark: | | `end_of_line` | :x: | :white_check_mark: | | `end_with_comma` | :x: | :white_check_mark: | @@ -14205,6 +14204,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `keep_array_indentation` | :x: | :white_check_mark: | | `keep_function_indentation` | :x: | :white_check_mark: | | `max_preserve_newlines` | :x: | :white_check_mark: | +| `object_curly_spacing` | :x: | :white_check_mark: | | `preserve_newlines` | :x: | :white_check_mark: | | `space_after_anon_function` | :x: | :white_check_mark: | | `space_before_conditional` | :x: | :white_check_mark: | @@ -14302,30 +14302,6 @@ Automatically beautify Vue files on save } ``` -##### [Bracket spacing](#bracket-spacing) - -**Namespace**: `js` - -**Key**: `bracket_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Insert spaces between brackets in object literals (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "bracket_spacing": false - } -} -``` - ##### [Break chained methods](#break-chained-methods) **Namespace**: `js` @@ -14730,6 +14706,30 @@ Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier) } ``` +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Insert spaces between brackets in object literals (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + ##### [Preserve newlines](#preserve-newlines) **Namespace**: `html` @@ -16357,11 +16357,11 @@ Override EOL from line-ending-selector (Supported by Coffee Formatter) } ``` -##### [Bracket spacing](#bracket-spacing) +##### [Object curly spacing](#object-curly-spacing) **Namespace**: `js` -**Key**: `bracket_spacing` +**Key**: `object_curly_spacing` **Type**: `boolean` @@ -16376,7 +16376,7 @@ Insert spaces between brackets in object literals (Supported by Coffee Formatter ```json { "js": { - "bracket_spacing": false + "object_curly_spacing": false } } ``` @@ -17069,11 +17069,11 @@ Override EOL from line-ending-selector (Supported by JS Beautify) } ``` -##### [Bracket spacing](#bracket-spacing) +##### [Object curly spacing](#object-curly-spacing) **Namespace**: `js` -**Key**: `bracket_spacing` +**Key**: `object_curly_spacing` **Type**: `boolean` @@ -17088,7 +17088,7 @@ Insert spaces between brackets in object literals (Supported by JS Beautify) ```json { "js": { - "bracket_spacing": false + "object_curly_spacing": false } } ``` @@ -18428,6 +18428,32 @@ Indentation size/length (Supported by JS Beautify, Prettier, Pretty Diff) } ``` +##### [Indent char](#indent-char) + +**Namespace**: `js` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Prettier`](#prettier) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Indentation character (Supported by JS Beautify, Prettier, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_char": " " + } +} +``` + ##### [Indent with tabs](#indent-with-tabs) **Namespace**: `js` @@ -18452,11 +18478,11 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by J } ``` -##### [Bracket spacing](#bracket-spacing) +##### [Object curly spacing](#object-curly-spacing) **Namespace**: `js` -**Key**: `bracket_spacing` +**Key**: `object_curly_spacing` **Type**: `boolean` @@ -18471,7 +18497,7 @@ Insert spaces between brackets in object literals (Supported by JS Beautify, Pre ```json { "js": { - "bracket_spacing": false + "object_curly_spacing": false } } ``` @@ -19600,11 +19626,11 @@ Override EOL from line-ending-selector (Supported by TypeScript Formatter) } ``` -##### [Bracket spacing](#bracket-spacing) +##### [Object curly spacing](#object-curly-spacing) **Namespace**: `js` -**Key**: `bracket_spacing` +**Key**: `object_curly_spacing` **Type**: `boolean` @@ -19619,7 +19645,7 @@ Insert spaces between brackets in object literals (Supported by TypeScript Forma ```json { "js": { - "bracket_spacing": false + "object_curly_spacing": false } } ``` @@ -20154,11 +20180,11 @@ Override EOL from line-ending-selector (Supported by Vue Beautifier) } ``` -##### [Bracket spacing](#bracket-spacing) +##### [Object curly spacing](#object-curly-spacing) **Namespace**: `js` -**Key**: `bracket_spacing` +**Key**: `object_curly_spacing` **Type**: `boolean` @@ -20173,7 +20199,7 @@ Insert spaces between brackets in object literals (Supported by Vue Beautifier) ```json { "js": { - "bracket_spacing": false + "object_curly_spacing": false } } ``` diff --git a/src/languages/typescript.coffee b/src/languages/typescript.coffee index 1ab966e..aa8afc0 100644 --- a/src/languages/typescript.coffee +++ b/src/languages/typescript.coffee @@ -18,4 +18,6 @@ module.exports = { "ts" ] + defaultBeautifier: "TypeScript Formatter" + } diff --git a/src/options.json b/src/options.json index 12228a2..e910631 100644 --- a/src/options.json +++ b/src/options.json @@ -642,15 +642,15 @@ "namespace": "js" } }, - "bracket_spacing": { + "object_curly_spacing": { "type": "boolean", "default": false, "description": "Insert spaces between brackets in object literals (Supported by Coffee Formatter)", - "title": "Bracket spacing", + "title": "Object curly spacing", "beautifiers": [ "Coffee Formatter" ], - "key": "bracket_spacing", + "key": "object_curly_spacing", "language": { "name": "JavaScript", "namespace": "js" @@ -1579,15 +1579,15 @@ "namespace": "js" } }, - "bracket_spacing": { + "object_curly_spacing": { "type": "boolean", "default": false, "description": "Insert spaces between brackets in object literals (Supported by JS Beautify)", - "title": "Bracket spacing", + "title": "Object curly spacing", "beautifiers": [ "JS Beautify" ], - "key": "bracket_spacing", + "key": "object_curly_spacing", "language": { "name": "JavaScript", "namespace": "js" @@ -3199,10 +3199,11 @@ "indent_char": { "type": "string", "default": null, - "description": "Indentation character (Supported by JS Beautify, Pretty Diff)", + "description": "Indentation character (Supported by JS Beautify, Prettier, Pretty Diff)", "title": "Indent char", "beautifiers": [ "JS Beautify", + "Prettier", "Pretty Diff" ], "key": "indent_char", @@ -3483,16 +3484,16 @@ "namespace": "js" } }, - "bracket_spacing": { + "object_curly_spacing": { "type": "boolean", "default": false, "description": "Insert spaces between brackets in object literals (Supported by JS Beautify, Prettier)", - "title": "Bracket spacing", + "title": "Object curly spacing", "beautifiers": [ "JS Beautify", "Prettier" ], - "key": "bracket_spacing", + "key": "object_curly_spacing", "language": { "name": "JavaScript", "namespace": "js" @@ -3847,15 +3848,15 @@ "namespace": "js" } }, - "bracket_spacing": { + "object_curly_spacing": { "type": "boolean", "default": false, "description": "Insert spaces between brackets in object literals (Supported by JS Beautify)", - "title": "Bracket spacing", + "title": "Object curly spacing", "beautifiers": [ "JS Beautify" ], - "key": "bracket_spacing", + "key": "object_curly_spacing", "language": { "name": "JavaScript", "namespace": "js" @@ -4225,15 +4226,15 @@ "namespace": "js" } }, - "bracket_spacing": { + "object_curly_spacing": { "type": "boolean", "default": false, "description": "Insert spaces between brackets in object literals (Supported by JS Beautify)", - "title": "Bracket spacing", + "title": "Object curly spacing", "beautifiers": [ "JS Beautify" ], - "key": "bracket_spacing", + "key": "object_curly_spacing", "language": { "name": "JavaScript", "namespace": "js" @@ -7665,6 +7666,7 @@ "description": "Options for language TypeScript", "collapsed": true, "beautifiers": [ + "Prettier", "TypeScript Formatter" ], "grammars": [ @@ -7967,15 +7969,15 @@ "namespace": "js" } }, - "bracket_spacing": { + "object_curly_spacing": { "type": "boolean", "default": false, "description": "Insert spaces between brackets in object literals (Supported by TypeScript Formatter)", - "title": "Bracket spacing", + "title": "Object curly spacing", "beautifiers": [ "TypeScript Formatter" ], - "key": "bracket_spacing", + "key": "object_curly_spacing", "language": { "name": "JavaScript", "namespace": "js" @@ -7992,9 +7994,10 @@ "title": "Default Beautifier", "order": -2, "type": "string", - "default": "TypeScript Formatter", + "default": "Prettier", "description": "Default Beautifier to be used for TypeScript", "enum": [ + "Prettier", "TypeScript Formatter" ] }, @@ -8470,15 +8473,15 @@ "namespace": "js" } }, - "bracket_spacing": { + "object_curly_spacing": { "type": "boolean", "default": false, "description": "Insert spaces between brackets in object literals (Supported by Vue Beautifier)", - "title": "Bracket spacing", + "title": "Object curly spacing", "beautifiers": [ "Vue Beautifier" ], - "key": "bracket_spacing", + "key": "object_curly_spacing", "language": { "name": "JavaScript", "namespace": "js" From 6a58d30f07a9350872b814b22e1cdbdad3565720 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Mon, 19 Feb 2018 13:03:22 -0600 Subject: [PATCH 093/103] Add React package to test file --- spec/beautify-languages-spec.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/beautify-languages-spec.coffee b/spec/beautify-languages-spec.coffee index 87204cc..4310acd 100644 --- a/spec/beautify-languages-spec.coffee +++ b/spec/beautify-languages-spec.coffee @@ -54,6 +54,7 @@ describe "BeautifyLanguages", -> dependentPackages = [ 'autocomplete-plus' 'fuse' + 'react' # 'linter' # 'atom-typescript' # it logs too much... ] From 6bc1afce29baa823d1800cefa5e562e661c74b0f Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 20 Feb 2018 10:20:42 -0600 Subject: [PATCH 094/103] Remove debug info from build-options --- build-package.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/build-package.sh b/build-package.sh index 0bd8feb..eaade9a 100644 --- a/build-package.sh +++ b/build-package.sh @@ -9,8 +9,6 @@ echo "Using Atom version:" "$ATOM_SCRIPT_NAME" -v echo "Using APM version:" "$APM_SCRIPT_NAME" -v -echo "Path:" -echo $PATH echo "Downloading package dependencies..." "$APM_SCRIPT_NAME" clean From db80ba6ac794284f88f1f3d8d7c1fd3ae9ef27f1 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 20 Feb 2018 11:50:17 -0600 Subject: [PATCH 095/103] Fix options not working from Atom UI and config file --- src/beautifiers/prettier.coffee | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/beautifiers/prettier.coffee b/src/beautifiers/prettier.coffee index 6ee198a..bd2d12a 100644 --- a/src/beautifiers/prettier.coffee +++ b/src/beautifiers/prettier.coffee @@ -33,12 +33,14 @@ module.exports = class Prettier extends Beautifier else reject(new Error("Unknown language for Prettier")) + filePath = atom.workspace.getActiveTextEditor().getPath() + try - result = prettier.format(text, { - options - parser - }) - resolve result + prettier.resolveConfig(filePath).then((configOptions) -> + result = prettier.format(text, configOptions or options, parser) + prettier.clearConfigCache() + resolve result + ) catch err reject(err) ) \ No newline at end of file From 7c2c0d3541047f44454e9d5623ccd0d7d78eabbd Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 20 Feb 2018 14:49:58 -0600 Subject: [PATCH 096/103] Fix options supported by beautifiers --- README.md | 2 +- docs/options.md | 3629 +------------------ src/beautifiers/coffee-formatter.coffee | 2 +- src/beautifiers/typescript-formatter.coffee | 2 +- src/beautifiers/vue-beautifier.coffee | 2 +- src/options.json | 1064 +----- 6 files changed, 24 insertions(+), 4677 deletions(-) diff --git a/README.md b/README.md index d1dc883..afb263b 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | TSS | `TSS` |`.tss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | TSX | `TypeScriptReact` |`.tsx` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** | | Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | -| TypeScript | `TypeScript` |`.ts` | **[`Prettier`](https://github.com/prettier/prettier)**, [`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter) | +| TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)**, [`Prettier`](https://github.com/prettier/prettier) | | UX Markup | `UX` |`.ux` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | Vala | `Vala` |`.vala`, `.vapi` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)** | | Visualforce | `Visualforce` |`.page` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | diff --git a/docs/options.md b/docs/options.md index 3d90896..1a00495 100644 --- a/docs/options.md +++ b/docs/options.md @@ -1076,27 +1076,9 @@ Automatically beautify Clojure files on save | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :white_check_mark: | :x: | -| `break_chained_methods` | :white_check_mark: | :x: | -| `end_of_line` | :white_check_mark: | :x: | -| `end_with_comma` | :white_check_mark: | :x: | -| `end_with_newline` | :white_check_mark: | :x: | -| `eval_code` | :white_check_mark: | :x: | -| `indent_char` | :white_check_mark: | :white_check_mark: | -| `indent_level` | :white_check_mark: | :x: | -| `indent_size` | :white_check_mark: | :white_check_mark: | -| `indent_with_tabs` | :white_check_mark: | :white_check_mark: | -| `jslint_happy` | :white_check_mark: | :x: | -| `keep_array_indentation` | :white_check_mark: | :x: | -| `keep_function_indentation` | :white_check_mark: | :x: | -| `max_preserve_newlines` | :white_check_mark: | :x: | -| `object_curly_spacing` | :white_check_mark: | :x: | -| `preserve_newlines` | :white_check_mark: | :x: | -| `space_after_anon_function` | :white_check_mark: | :x: | -| `space_before_conditional` | :white_check_mark: | :x: | -| `space_in_paren` | :white_check_mark: | :x: | -| `unescape_strings` | :white_check_mark: | :x: | -| `wrap_line_length` | :white_check_mark: | :x: | +| `indent_char` | :x: | :white_check_mark: | +| `indent_size` | :x: | :white_check_mark: | +| `indent_with_tabs` | :x: | :white_check_mark: | **Description**: @@ -1157,158 +1139,6 @@ Automatically beautify CoffeeScript files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `js` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Break chained method calls across subsequent lines (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "break_chained_methods": false - } -} -``` - -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Override EOL from line-ending-selector (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [End with newline](#end-with-newline) - -**Namespace**: `js` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -End output with newline (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_newline": false - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - - (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - ##### [Indent char](#indent-char) **Namespace**: `js` @@ -1319,11 +1149,11 @@ End output with newline (Supported by Coffee Formatter) **Type**: `string` -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) +**Supported Beautifiers**: [`coffee-fmt`](#coffee-fmt) **Description**: -Indentation character (Supported by Coffee Formatter, coffee-fmt) +Indentation character (Supported by coffee-fmt) **Example `.jsbeautifyrc` Configuration** @@ -1335,30 +1165,6 @@ Indentation character (Supported by Coffee Formatter, coffee-fmt) } ``` -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Initial indentation level (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - ##### [Indent size](#indent-size) **Namespace**: `js` @@ -1369,11 +1175,11 @@ Initial indentation level (Supported by Coffee Formatter) **Type**: `integer` -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) +**Supported Beautifiers**: [`coffee-fmt`](#coffee-fmt) **Description**: -Indentation size/length (Supported by Coffee Formatter, coffee-fmt) +Indentation size/length (Supported by coffee-fmt) **Example `.jsbeautifyrc` Configuration** @@ -1393,11 +1199,11 @@ Indentation size/length (Supported by Coffee Formatter, coffee-fmt) **Type**: `boolean` -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) +**Supported Beautifiers**: [`coffee-fmt`](#coffee-fmt) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Coffee Formatter, coffee-fmt) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by coffee-fmt) **Example `.jsbeautifyrc` Configuration** @@ -1409,276 +1215,6 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by C } ``` -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Enable jslint-stricter mode (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Preserve array indentation (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - - (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `js` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Object curly spacing](#object-curly-spacing) - -**Namespace**: `js` - -**Key**: `object_curly_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Insert spaces between brackets in object literals (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "object_curly_spacing": false - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `js` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Preserve line-breaks (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "preserve_newlines": true - } -} -``` - -##### [Space after anon function](#space-after-anon-function) - -**Namespace**: `js` - -**Key**: `space_after_anon_function` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - - (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Wrap line length](#wrap-line-length) - -**Namespace**: `js` - -**Key**: `wrap_line_length` - -**Type**: `integer` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Wrap lines at next opportunity after N characters (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "wrap_line_length": 0 - } -} -``` - #### [C++](#c-) **Supported Beautifiers**: [`Uncrustify`](#uncrustify) [`clang-format`](#clang-format) @@ -13127,27 +12663,6 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :x: | :white_check_mark: | -| `break_chained_methods` | :x: | :white_check_mark: | -| `end_of_line` | :x: | :white_check_mark: | -| `end_with_comma` | :x: | :white_check_mark: | -| `end_with_newline` | :x: | :white_check_mark: | -| `eval_code` | :x: | :white_check_mark: | -| `indent_char` | :x: | :white_check_mark: | -| `indent_level` | :x: | :white_check_mark: | -| `indent_size` | :x: | :white_check_mark: | -| `indent_with_tabs` | :x: | :white_check_mark: | -| `jslint_happy` | :x: | :white_check_mark: | -| `keep_array_indentation` | :x: | :white_check_mark: | -| `keep_function_indentation` | :x: | :white_check_mark: | -| `max_preserve_newlines` | :x: | :white_check_mark: | -| `object_curly_spacing` | :x: | :white_check_mark: | -| `preserve_newlines` | :x: | :white_check_mark: | -| `space_after_anon_function` | :x: | :white_check_mark: | -| `space_before_conditional` | :x: | :white_check_mark: | -| `space_in_paren` | :x: | :white_check_mark: | -| `unescape_strings` | :x: | :white_check_mark: | -| `wrap_line_length` | :x: | :white_check_mark: | **Description**: @@ -13174,7 +12689,7 @@ Disable TypeScript Beautification **Important**: This option is only configurable from within Atom Beautify's setting panel. -**Default**: `Prettier` +**Default**: `TypeScript Formatter` **Type**: `string` @@ -13208,528 +12723,6 @@ Automatically beautify TypeScript files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `js` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Break chained method calls across subsequent lines (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "break_chained_methods": false - } -} -``` - -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Override EOL from line-ending-selector (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [End with newline](#end-with-newline) - -**Namespace**: `js` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -End output with newline (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_newline": false - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - - (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Indent char](#indent-char) - -**Namespace**: `js` - -**Key**: `indent_char` - -**Default**: ` ` - -**Type**: `string` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Indentation character (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_char": " " - } -} -``` - -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Initial indentation level (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent size](#indent-size) - -**Namespace**: `js` - -**Key**: `indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Indentation size/length (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_size": 4 - } -} -``` - -##### [Indent with tabs](#indent-with-tabs) - -**Namespace**: `js` - -**Key**: `indent_with_tabs` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_with_tabs": false - } -} -``` - -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Enable jslint-stricter mode (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Preserve array indentation (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - - (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `js` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Object curly spacing](#object-curly-spacing) - -**Namespace**: `js` - -**Key**: `object_curly_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Insert spaces between brackets in object literals (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "object_curly_spacing": false - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `js` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Preserve line-breaks (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "preserve_newlines": true - } -} -``` - -##### [Space after anon function](#space-after-anon-function) - -**Namespace**: `js` - -**Key**: `space_after_anon_function` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - - (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Wrap line length](#wrap-line-length) - -**Namespace**: `js` - -**Key**: `wrap_line_length` - -**Type**: `integer` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Wrap lines at next opportunity after N characters (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "wrap_line_length": 0 - } -} -``` - #### [UX Markup](#ux-markup) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -14187,33 +13180,6 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `brace_style` | :x: | :white_check_mark: | -| `break_chained_methods` | :x: | :white_check_mark: | -| `end_of_line` | :x: | :white_check_mark: | -| `end_with_comma` | :x: | :white_check_mark: | -| `end_with_newline` | :x: | :white_check_mark: | -| `eval_code` | :x: | :white_check_mark: | -| `extra_liners` | :x: | :white_check_mark: | -| `indent_char` | :x: | :white_check_mark: | -| `indent_inner_html` | :x: | :white_check_mark: | -| `indent_level` | :x: | :white_check_mark: | -| `indent_scripts` | :x: | :white_check_mark: | -| `indent_size` | :x: | :white_check_mark: | -| `indent_with_tabs` | :x: | :white_check_mark: | -| `jslint_happy` | :x: | :white_check_mark: | -| `keep_array_indentation` | :x: | :white_check_mark: | -| `keep_function_indentation` | :x: | :white_check_mark: | -| `max_preserve_newlines` | :x: | :white_check_mark: | -| `object_curly_spacing` | :x: | :white_check_mark: | -| `preserve_newlines` | :x: | :white_check_mark: | -| `space_after_anon_function` | :x: | :white_check_mark: | -| `space_before_conditional` | :x: | :white_check_mark: | -| `space_in_paren` | :x: | :white_check_mark: | -| `unescape_strings` | :x: | :white_check_mark: | -| `unformatted` | :x: | :white_check_mark: | -| `wrap_attributes` | :x: | :white_check_mark: | -| `wrap_attributes_indent_size` | :x: | :white_check_mark: | -| `wrap_line_length` | :x: | :white_check_mark: | **Description**: @@ -14274,761 +13240,6 @@ Automatically beautify Vue files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Brace style](#brace-style) - -**Namespace**: `html` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -[collapse|expand|end-expand|none] (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Break chained method calls across subsequent lines (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "break_chained_methods": false - } -} -``` - -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Override EOL from line-ending-selector (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [End with newline](#end-with-newline) - -**Namespace**: `html` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -End output with newline (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "end_with_newline": false - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - - (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Extra liners](#extra-liners) - -**Namespace**: `html` - -**Key**: `extra_liners` - -**Default**: `head,body,/html` - -**Type**: `array` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "extra_liners": [ - "head", - "body", - "/html" - ] - } -} -``` - -##### [Indent char](#indent-char) - -**Namespace**: `html` - -**Key**: `indent_char` - -**Default**: ` ` - -**Type**: `string` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indentation character (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_char": " " - } -} -``` - -##### [Indent inner html](#indent-inner-html) - -**Namespace**: `html` - -**Key**: `indent_inner_html` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indent and sections. (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_inner_html": false - } -} -``` - -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Initial indentation level (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent scripts](#indent-scripts) - -**Namespace**: `html` - -**Key**: `indent_scripts` - -**Default**: `normal` - -**Type**: `string` - -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -[keep|separate|normal] (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_scripts": "normal" - } -} -``` - -##### [Indent size](#indent-size) - -**Namespace**: `html` - -**Key**: `indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indentation size/length (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_size": 4 - } -} -``` - -##### [Indent with tabs](#indent-with-tabs) - -**Namespace**: `js` - -**Key**: `indent_with_tabs` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_with_tabs": false - } -} -``` - -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Enable jslint-stricter mode (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Preserve array indentation (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - - (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Object curly spacing](#object-curly-spacing) - -**Namespace**: `js` - -**Key**: `object_curly_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Insert spaces between brackets in object literals (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "object_curly_spacing": false - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `html` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Preserve line-breaks (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "preserve_newlines": true - } -} -``` - -##### [Space after anon function](#space-after-anon-function) - -**Namespace**: `js` - -**Key**: `space_after_anon_function` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - - (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - -**Type**: `array` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] - } -} -``` - -##### [Wrap attributes](#wrap-attributes) - -**Namespace**: `html` - -**Key**: `wrap_attributes` - -**Default**: `auto` - -**Type**: `string` - -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes": "auto" - } -} -``` - -##### [Wrap attributes indent size](#wrap-attributes-indent-size) - -**Namespace**: `html` - -**Key**: `wrap_attributes_indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indent wrapped attributes to after N characters (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes_indent_size": 4 - } -} -``` - -##### [Wrap line length](#wrap-line-length) - -**Namespace**: `html` - -**Key**: `wrap_line_length` - -**Default**: `250` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Maximum characters per line (0 disables) (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_line_length": 250 - } -} -``` - #### [XML](#xml) **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) @@ -15857,531 +14068,6 @@ Used if neither a project or custom config file exists. (Supported by CSScomb) ``` -### Coffee Formatter - -##### [Indent size](#indent-size) - -**Namespace**: `js` - -**Key**: `indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) - -**Description**: - -Indentation size/length (Supported by Coffee Formatter, coffee-fmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_size": 4 - } -} -``` - -##### [Indent char](#indent-char) - -**Namespace**: `js` - -**Key**: `indent_char` - -**Default**: ` ` - -**Type**: `string` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) - -**Description**: - -Indentation character (Supported by Coffee Formatter, coffee-fmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_char": " " - } -} -``` - -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Initial indentation level (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent with tabs](#indent-with-tabs) - -**Namespace**: `js` - -**Key**: `indent_with_tabs` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) - -**Description**: - -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Coffee Formatter, coffee-fmt) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_with_tabs": false - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `js` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Preserve line-breaks (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "preserve_newlines": true - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `js` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Enable jslint-stricter mode (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Space after anon function](#space-after-anon-function) - -**Namespace**: `js` - -**Key**: `space_after_anon_function` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Brace style](#brace-style) - -**Namespace**: `js` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Break chained method calls across subsequent lines (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "break_chained_methods": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Preserve array indentation (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - - (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - - (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - - (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Wrap line length](#wrap-line-length) - -**Namespace**: `js` - -**Key**: `wrap_line_length` - -**Type**: `integer` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Wrap lines at next opportunity after N characters (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "wrap_line_length": 0 - } -} -``` - -##### [End with newline](#end-with-newline) - -**Namespace**: `js` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -End output with newline (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_newline": false - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Override EOL from line-ending-selector (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - -##### [Object curly spacing](#object-curly-spacing) - -**Namespace**: `js` - -**Key**: `object_curly_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) - -**Description**: - -Insert spaces between brackets in object literals (Supported by Coffee Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "object_curly_spacing": false - } -} -``` - - ### Fortran Beautifier ##### [Emacs path](#emacs-path) @@ -19126,531 +16812,6 @@ Indentation character (Supported by Ruby Beautify) ``` -### TypeScript Formatter - -##### [Indent size](#indent-size) - -**Namespace**: `js` - -**Key**: `indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Indentation size/length (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_size": 4 - } -} -``` - -##### [Indent char](#indent-char) - -**Namespace**: `js` - -**Key**: `indent_char` - -**Default**: ` ` - -**Type**: `string` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Indentation character (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_char": " " - } -} -``` - -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Initial indentation level (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent with tabs](#indent-with-tabs) - -**Namespace**: `js` - -**Key**: `indent_with_tabs` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_with_tabs": false - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `js` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Preserve line-breaks (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "preserve_newlines": true - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `js` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Enable jslint-stricter mode (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Space after anon function](#space-after-anon-function) - -**Namespace**: `js` - -**Key**: `space_after_anon_function` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Brace style](#brace-style) - -**Namespace**: `js` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Break chained method calls across subsequent lines (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "break_chained_methods": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Preserve array indentation (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - - (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - - (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - - (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Wrap line length](#wrap-line-length) - -**Namespace**: `js` - -**Key**: `wrap_line_length` - -**Type**: `integer` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Wrap lines at next opportunity after N characters (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "wrap_line_length": 0 - } -} -``` - -##### [End with newline](#end-with-newline) - -**Namespace**: `js` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -End output with newline (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_newline": false - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Override EOL from line-ending-selector (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - -##### [Object curly spacing](#object-curly-spacing) - -**Namespace**: `js` - -**Key**: `object_curly_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) - -**Description**: - -Insert spaces between brackets in object literals (Supported by TypeScript Formatter) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "object_curly_spacing": false - } -} -``` - - ### Uncrustify ##### [Config Path](#config-path) @@ -19678,764 +16839,6 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) ``` -### Vue Beautifier - -##### [Indent size](#indent-size) - -**Namespace**: `html` - -**Key**: `indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indentation size/length (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_size": 4 - } -} -``` - -##### [Indent char](#indent-char) - -**Namespace**: `html` - -**Key**: `indent_char` - -**Default**: ` ` - -**Type**: `string` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indentation character (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_char": " " - } -} -``` - -##### [Indent level](#indent-level) - -**Namespace**: `js` - -**Key**: `indent_level` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Initial indentation level (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_level": 0 - } -} -``` - -##### [Indent with tabs](#indent-with-tabs) - -**Namespace**: `js` - -**Key**: `indent_with_tabs` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "indent_with_tabs": false - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `html` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Preserve line-breaks (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "preserve_newlines": true - } -} -``` - -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Space in paren](#space-in-paren) - -**Namespace**: `js` - -**Key**: `space_in_paren` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Add padding spaces within paren, ie. f( a, b ) (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_in_paren": false - } -} -``` - -##### [Jslint happy](#jslint-happy) - -**Namespace**: `js` - -**Key**: `jslint_happy` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Enable jslint-stricter mode (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "jslint_happy": false - } -} -``` - -##### [Space after anon function](#space-after-anon-function) - -**Namespace**: `js` - -**Key**: `space_after_anon_function` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Add a space before an anonymous function's parens, ie. function () (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_after_anon_function": false - } -} -``` - -##### [Brace style](#brace-style) - -**Namespace**: `html` - -**Key**: `brace_style` - -**Default**: `collapse` - -**Type**: `string` - -**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -[collapse|expand|end-expand|none] (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "brace_style": "collapse" - } -} -``` - -##### [Break chained methods](#break-chained-methods) - -**Namespace**: `js` - -**Key**: `break_chained_methods` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Break chained method calls across subsequent lines (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "break_chained_methods": false - } -} -``` - -##### [Keep array indentation](#keep-array-indentation) - -**Namespace**: `js` - -**Key**: `keep_array_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Preserve array indentation (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_array_indentation": false - } -} -``` - -##### [Keep function indentation](#keep-function-indentation) - -**Namespace**: `js` - -**Key**: `keep_function_indentation` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - - (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "keep_function_indentation": false - } -} -``` - -##### [Space before conditional](#space-before-conditional) - -**Namespace**: `js` - -**Key**: `space_before_conditional` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - - (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "space_before_conditional": true - } -} -``` - -##### [Eval code](#eval-code) - -**Namespace**: `js` - -**Key**: `eval_code` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - - (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "eval_code": false - } -} -``` - -##### [Unescape strings](#unescape-strings) - -**Namespace**: `js` - -**Key**: `unescape_strings` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Decode printable characters encoded in xNN notation (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "unescape_strings": false - } -} -``` - -##### [Wrap line length](#wrap-line-length) - -**Namespace**: `html` - -**Key**: `wrap_line_length` - -**Default**: `250` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Maximum characters per line (0 disables) (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_line_length": 250 - } -} -``` - -##### [End with newline](#end-with-newline) - -**Namespace**: `html` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -End output with newline (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "end_with_newline": false - } -} -``` - -##### [End with comma](#end-with-comma) - -**Namespace**: `js` - -**Key**: `end_with_comma` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_with_comma": false - } -} -``` - -##### [End of line](#end-of-line) - -**Namespace**: `js` - -**Key**: `end_of_line` - -**Default**: `System Default` - -**Type**: `string` - -**Enum**: `CRLF` `LF` `System Default` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Override EOL from line-ending-selector (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "end_of_line": "System Default" - } -} -``` - -##### [Object curly spacing](#object-curly-spacing) - -**Namespace**: `js` - -**Key**: `object_curly_spacing` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Insert spaces between brackets in object literals (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "js": { - "object_curly_spacing": false - } -} -``` - -##### [Indent inner html](#indent-inner-html) - -**Namespace**: `html` - -**Key**: `indent_inner_html` - -**Type**: `boolean` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indent and sections. (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_inner_html": false - } -} -``` - -##### [Indent scripts](#indent-scripts) - -**Namespace**: `html` - -**Key**: `indent_scripts` - -**Default**: `normal` - -**Type**: `string` - -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -[keep|separate|normal] (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "indent_scripts": "normal" - } -} -``` - -##### [Wrap attributes](#wrap-attributes) - -**Namespace**: `html` - -**Key**: `wrap_attributes` - -**Default**: `auto` - -**Type**: `string` - -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes": "auto" - } -} -``` - -##### [Wrap attributes indent size](#wrap-attributes-indent-size) - -**Namespace**: `html` - -**Key**: `wrap_attributes_indent_size` - -**Default**: `4` - -**Type**: `integer` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -Indent wrapped attributes to after N characters (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "wrap_attributes_indent_size": 4 - } -} -``` - -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - -**Type**: `array` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] - } -} -``` - -##### [Extra liners](#extra-liners) - -**Namespace**: `html` - -**Key**: `extra_liners` - -**Default**: `head,body,/html` - -**Type**: `array` - -**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) - -**Description**: - -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by Vue Beautifier) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "extra_liners": [ - "head", - "body", - "/html" - ] - } -} -``` - - ### align-yaml ##### [Padding](#padding) @@ -20720,11 +17123,11 @@ Path to clang-format config file. i.e. clang-format.cfg (Supported by clang-form **Type**: `integer` -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) +**Supported Beautifiers**: [`coffee-fmt`](#coffee-fmt) **Description**: -Indentation size/length (Supported by Coffee Formatter, coffee-fmt) +Indentation size/length (Supported by coffee-fmt) **Example `.jsbeautifyrc` Configuration** @@ -20746,11 +17149,11 @@ Indentation size/length (Supported by Coffee Formatter, coffee-fmt) **Type**: `string` -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) +**Supported Beautifiers**: [`coffee-fmt`](#coffee-fmt) **Description**: -Indentation character (Supported by Coffee Formatter, coffee-fmt) +Indentation character (Supported by coffee-fmt) **Example `.jsbeautifyrc` Configuration** @@ -20770,11 +17173,11 @@ Indentation character (Supported by Coffee Formatter, coffee-fmt) **Type**: `boolean` -**Supported Beautifiers**: [`Coffee Formatter`](#coffee-formatter) [`coffee-fmt`](#coffee-fmt) +**Supported Beautifiers**: [`coffee-fmt`](#coffee-fmt) **Description**: -Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Coffee Formatter, coffee-fmt) +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by coffee-fmt) **Example `.jsbeautifyrc` Configuration** diff --git a/src/beautifiers/coffee-formatter.coffee b/src/beautifiers/coffee-formatter.coffee index bf19dd7..9f08793 100644 --- a/src/beautifiers/coffee-formatter.coffee +++ b/src/beautifiers/coffee-formatter.coffee @@ -7,7 +7,7 @@ module.exports = class CoffeeFormatter extends Beautifier link: "https://github.com/Glavin001/Coffee-Formatter" options: { - CoffeeScript: true + CoffeeScript: false } beautify: (text, language, options) -> diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index 7ca7fd7..5cff9f1 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -5,7 +5,7 @@ module.exports = class TypeScriptFormatter extends Beautifier name: "TypeScript Formatter" link: "https://github.com/vvakame/typescript-formatter" options: { - TypeScript: true + TypeScript: false TSX: true } diff --git a/src/beautifiers/vue-beautifier.coffee b/src/beautifiers/vue-beautifier.coffee index 6c693b9..39ff252 100644 --- a/src/beautifiers/vue-beautifier.coffee +++ b/src/beautifiers/vue-beautifier.coffee @@ -6,7 +6,7 @@ module.exports = class VueBeautifier extends Beautifier link: "https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/vue-beautifier.coffee" options: - Vue: true + Vue: false beautify: (text, language, options) -> return new @Promise((resolve, reject) => diff --git a/src/options.json b/src/options.json index e910631..568de04 100644 --- a/src/options.json +++ b/src/options.json @@ -350,10 +350,9 @@ "type": "integer", "default": null, "minimum": 0, - "description": "Indentation size/length (Supported by Coffee Formatter, coffee-fmt)", + "description": "Indentation size/length (Supported by coffee-fmt)", "title": "Indent size", "beautifiers": [ - "Coffee Formatter", "coffee-fmt" ], "key": "indent_size", @@ -365,10 +364,9 @@ "indent_char": { "type": "string", "default": null, - "description": "Indentation character (Supported by Coffee Formatter, coffee-fmt)", + "description": "Indentation character (Supported by coffee-fmt)", "title": "Indent char", "beautifiers": [ - "Coffee Formatter", "coffee-fmt" ], "key": "indent_char", @@ -377,27 +375,12 @@ "namespace": "js" } }, - "indent_level": { - "type": "integer", - "default": 0, - "description": "Initial indentation level (Supported by Coffee Formatter)", - "title": "Indent level", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "indent_level", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, "indent_with_tabs": { "type": "boolean", "default": null, - "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Coffee Formatter, coffee-fmt)", + "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by coffee-fmt)", "title": "Indent with tabs", "beautifiers": [ - "Coffee Formatter", "coffee-fmt" ], "key": "indent_with_tabs", @@ -406,256 +389,6 @@ "namespace": "js" } }, - "preserve_newlines": { - "type": "boolean", - "default": true, - "description": "Preserve line-breaks (Supported by Coffee Formatter)", - "title": "Preserve newlines", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "preserve_newlines", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "max_preserve_newlines": { - "type": "integer", - "default": 10, - "description": "Number of line-breaks to be preserved in one chunk (Supported by Coffee Formatter)", - "title": "Max preserve newlines", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "max_preserve_newlines", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_in_paren": { - "type": "boolean", - "default": false, - "description": "Add padding spaces within paren, ie. f( a, b ) (Supported by Coffee Formatter)", - "title": "Space in paren", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "space_in_paren", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "jslint_happy": { - "type": "boolean", - "default": false, - "description": "Enable jslint-stricter mode (Supported by Coffee Formatter)", - "title": "Jslint happy", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "jslint_happy", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_after_anon_function": { - "type": "boolean", - "default": false, - "description": "Add a space before an anonymous function's parens, ie. function () (Supported by Coffee Formatter)", - "title": "Space after anon function", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "space_after_anon_function", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "brace_style": { - "type": "string", - "default": "collapse", - "enum": [ - "collapse", - "collapse-preserve-inline", - "expand", - "end-expand", - "none" - ], - "description": "[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by Coffee Formatter)", - "title": "Brace style", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "brace_style", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "break_chained_methods": { - "type": "boolean", - "default": false, - "description": "Break chained method calls across subsequent lines (Supported by Coffee Formatter)", - "title": "Break chained methods", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "break_chained_methods", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "keep_array_indentation": { - "type": "boolean", - "default": false, - "description": "Preserve array indentation (Supported by Coffee Formatter)", - "title": "Keep array indentation", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "keep_array_indentation", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "keep_function_indentation": { - "type": "boolean", - "default": false, - "description": " (Supported by Coffee Formatter)", - "title": "Keep function indentation", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "keep_function_indentation", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_before_conditional": { - "type": "boolean", - "default": true, - "description": " (Supported by Coffee Formatter)", - "title": "Space before conditional", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "space_before_conditional", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "eval_code": { - "type": "boolean", - "default": false, - "description": " (Supported by Coffee Formatter)", - "title": "Eval code", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "eval_code", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "unescape_strings": { - "type": "boolean", - "default": false, - "description": "Decode printable characters encoded in xNN notation (Supported by Coffee Formatter)", - "title": "Unescape strings", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "unescape_strings", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "wrap_line_length": { - "type": "integer", - "default": 0, - "description": "Wrap lines at next opportunity after N characters (Supported by Coffee Formatter)", - "title": "Wrap line length", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "wrap_line_length", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_with_newline": { - "type": "boolean", - "default": false, - "description": "End output with newline (Supported by Coffee Formatter)", - "title": "End with newline", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "end_with_newline", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_with_comma": { - "type": "boolean", - "default": false, - "description": "If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Coffee Formatter)", - "title": "End with comma", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "end_with_comma", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_of_line": { - "type": "string", - "default": "System Default", - "enum": [ - "CRLF", - "LF", - "System Default" - ], - "description": "Override EOL from line-ending-selector (Supported by Coffee Formatter)", - "title": "End of line", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "end_of_line", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "object_curly_spacing": { - "type": "boolean", - "default": false, - "description": "Insert spaces between brackets in object literals (Supported by Coffee Formatter)", - "title": "Object curly spacing", - "beautifiers": [ - "Coffee Formatter" - ], - "key": "object_curly_spacing", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, "disabled": { "title": "Disable Beautifying Language", "order": -3, @@ -7676,313 +7409,6 @@ "ts" ], "properties": { - "indent_size": { - "type": "integer", - "default": null, - "minimum": 0, - "description": "Indentation size/length (Supported by TypeScript Formatter)", - "title": "Indent size", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "indent_size", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "indent_char": { - "type": "string", - "default": null, - "description": "Indentation character (Supported by TypeScript Formatter)", - "title": "Indent char", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "indent_char", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "indent_level": { - "type": "integer", - "default": 0, - "description": "Initial indentation level (Supported by TypeScript Formatter)", - "title": "Indent level", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "indent_level", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "indent_with_tabs": { - "type": "boolean", - "default": null, - "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter)", - "title": "Indent with tabs", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "indent_with_tabs", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "preserve_newlines": { - "type": "boolean", - "default": true, - "description": "Preserve line-breaks (Supported by TypeScript Formatter)", - "title": "Preserve newlines", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "preserve_newlines", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "max_preserve_newlines": { - "type": "integer", - "default": 10, - "description": "Number of line-breaks to be preserved in one chunk (Supported by TypeScript Formatter)", - "title": "Max preserve newlines", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "max_preserve_newlines", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_in_paren": { - "type": "boolean", - "default": false, - "description": "Add padding spaces within paren, ie. f( a, b ) (Supported by TypeScript Formatter)", - "title": "Space in paren", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "space_in_paren", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "jslint_happy": { - "type": "boolean", - "default": false, - "description": "Enable jslint-stricter mode (Supported by TypeScript Formatter)", - "title": "Jslint happy", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "jslint_happy", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_after_anon_function": { - "type": "boolean", - "default": false, - "description": "Add a space before an anonymous function's parens, ie. function () (Supported by TypeScript Formatter)", - "title": "Space after anon function", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "space_after_anon_function", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "brace_style": { - "type": "string", - "default": "collapse", - "enum": [ - "collapse", - "collapse-preserve-inline", - "expand", - "end-expand", - "none" - ], - "description": "[collapse|collapse-preserve-inline|expand|end-expand|none] (Supported by TypeScript Formatter)", - "title": "Brace style", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "brace_style", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "break_chained_methods": { - "type": "boolean", - "default": false, - "description": "Break chained method calls across subsequent lines (Supported by TypeScript Formatter)", - "title": "Break chained methods", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "break_chained_methods", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "keep_array_indentation": { - "type": "boolean", - "default": false, - "description": "Preserve array indentation (Supported by TypeScript Formatter)", - "title": "Keep array indentation", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "keep_array_indentation", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "keep_function_indentation": { - "type": "boolean", - "default": false, - "description": " (Supported by TypeScript Formatter)", - "title": "Keep function indentation", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "keep_function_indentation", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_before_conditional": { - "type": "boolean", - "default": true, - "description": " (Supported by TypeScript Formatter)", - "title": "Space before conditional", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "space_before_conditional", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "eval_code": { - "type": "boolean", - "default": false, - "description": " (Supported by TypeScript Formatter)", - "title": "Eval code", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "eval_code", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "unescape_strings": { - "type": "boolean", - "default": false, - "description": "Decode printable characters encoded in xNN notation (Supported by TypeScript Formatter)", - "title": "Unescape strings", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "unescape_strings", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "wrap_line_length": { - "type": "integer", - "default": 0, - "description": "Wrap lines at next opportunity after N characters (Supported by TypeScript Formatter)", - "title": "Wrap line length", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "wrap_line_length", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_with_newline": { - "type": "boolean", - "default": false, - "description": "End output with newline (Supported by TypeScript Formatter)", - "title": "End with newline", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "end_with_newline", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_with_comma": { - "type": "boolean", - "default": false, - "description": "If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by TypeScript Formatter)", - "title": "End with comma", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "end_with_comma", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_of_line": { - "type": "string", - "default": "System Default", - "enum": [ - "CRLF", - "LF", - "System Default" - ], - "description": "Override EOL from line-ending-selector (Supported by TypeScript Formatter)", - "title": "End of line", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "end_of_line", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "object_curly_spacing": { - "type": "boolean", - "default": false, - "description": "Insert spaces between brackets in object literals (Supported by TypeScript Formatter)", - "title": "Object curly spacing", - "beautifiers": [ - "TypeScript Formatter" - ], - "key": "object_curly_spacing", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, "disabled": { "title": "Disable Beautifying Language", "order": -3, @@ -7994,7 +7420,7 @@ "title": "Default Beautifier", "order": -2, "type": "string", - "default": "Prettier", + "default": "TypeScript Formatter", "description": "Default Beautifier to be used for TypeScript", "enum": [ "Prettier", @@ -8180,488 +7606,6 @@ "vue" ], "properties": { - "indent_size": { - "type": "integer", - "default": null, - "minimum": 0, - "description": "Indentation size/length (Supported by Vue Beautifier)", - "title": "Indent size", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "indent_size", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "indent_char": { - "type": "string", - "default": null, - "description": "Indentation character (Supported by Vue Beautifier)", - "title": "Indent char", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "indent_char", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "indent_level": { - "type": "integer", - "default": 0, - "description": "Initial indentation level (Supported by Vue Beautifier)", - "title": "Indent level", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "indent_level", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "indent_with_tabs": { - "type": "boolean", - "default": null, - "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Vue Beautifier)", - "title": "Indent with tabs", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "indent_with_tabs", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "preserve_newlines": { - "type": "boolean", - "default": true, - "description": "Preserve line-breaks (Supported by Vue Beautifier)", - "title": "Preserve newlines", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "preserve_newlines", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "max_preserve_newlines": { - "type": "integer", - "default": 10, - "description": "Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier)", - "title": "Max preserve newlines", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "max_preserve_newlines", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "space_in_paren": { - "type": "boolean", - "default": false, - "description": "Add padding spaces within paren, ie. f( a, b ) (Supported by Vue Beautifier)", - "title": "Space in paren", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "space_in_paren", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "jslint_happy": { - "type": "boolean", - "default": false, - "description": "Enable jslint-stricter mode (Supported by Vue Beautifier)", - "title": "Jslint happy", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "jslint_happy", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_after_anon_function": { - "type": "boolean", - "default": false, - "description": "Add a space before an anonymous function's parens, ie. function () (Supported by Vue Beautifier)", - "title": "Space after anon function", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "space_after_anon_function", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "brace_style": { - "type": "string", - "default": "collapse", - "enum": [ - "collapse", - "collapse-preserve-inline", - "expand", - "end-expand", - "none" - ], - "description": "[collapse|expand|end-expand|none] (Supported by Vue Beautifier)", - "title": "Brace style", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "brace_style", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "break_chained_methods": { - "type": "boolean", - "default": false, - "description": "Break chained method calls across subsequent lines (Supported by Vue Beautifier)", - "title": "Break chained methods", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "break_chained_methods", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "keep_array_indentation": { - "type": "boolean", - "default": false, - "description": "Preserve array indentation (Supported by Vue Beautifier)", - "title": "Keep array indentation", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "keep_array_indentation", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "keep_function_indentation": { - "type": "boolean", - "default": false, - "description": " (Supported by Vue Beautifier)", - "title": "Keep function indentation", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "keep_function_indentation", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "space_before_conditional": { - "type": "boolean", - "default": true, - "description": " (Supported by Vue Beautifier)", - "title": "Space before conditional", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "space_before_conditional", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "eval_code": { - "type": "boolean", - "default": false, - "description": " (Supported by Vue Beautifier)", - "title": "Eval code", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "eval_code", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "unescape_strings": { - "type": "boolean", - "default": false, - "description": "Decode printable characters encoded in xNN notation (Supported by Vue Beautifier)", - "title": "Unescape strings", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "unescape_strings", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "wrap_line_length": { - "type": "integer", - "default": 250, - "description": "Maximum characters per line (0 disables) (Supported by Vue Beautifier)", - "title": "Wrap line length", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "wrap_line_length", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "end_with_newline": { - "type": "boolean", - "default": false, - "description": "End output with newline (Supported by Vue Beautifier)", - "title": "End with newline", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "end_with_newline", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "end_with_comma": { - "type": "boolean", - "default": false, - "description": "If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Vue Beautifier)", - "title": "End with comma", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "end_with_comma", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "end_of_line": { - "type": "string", - "default": "System Default", - "enum": [ - "CRLF", - "LF", - "System Default" - ], - "description": "Override EOL from line-ending-selector (Supported by Vue Beautifier)", - "title": "End of line", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "end_of_line", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "object_curly_spacing": { - "type": "boolean", - "default": false, - "description": "Insert spaces between brackets in object literals (Supported by Vue Beautifier)", - "title": "Object curly spacing", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "object_curly_spacing", - "language": { - "name": "JavaScript", - "namespace": "js" - } - }, - "indent_inner_html": { - "type": "boolean", - "default": false, - "description": "Indent and sections. (Supported by Vue Beautifier)", - "title": "Indent inner html", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "indent_inner_html", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "indent_scripts": { - "type": "string", - "default": "normal", - "enum": [ - "keep", - "separate", - "normal" - ], - "description": "[keep|separate|normal] (Supported by Vue Beautifier)", - "title": "Indent scripts", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "indent_scripts", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "wrap_attributes": { - "type": "string", - "default": "auto", - "enum": [ - "auto", - "force", - "force-aligned", - "force-expand-multiline" - ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier)", - "title": "Wrap attributes", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "wrap_attributes", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "wrap_attributes_indent_size": { - "type": "integer", - "default": null, - "minimum": 0, - "description": "Indent wrapped attributes to after N characters (Supported by Vue Beautifier)", - "title": "Wrap attributes indent size", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "wrap_attributes_indent_size", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "unformatted": { - "type": "array", - "default": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ], - "items": { - "type": "string" - }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier)", - "title": "Unformatted", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "unformatted", - "language": { - "name": "HTML", - "namespace": "html" - } - }, - "extra_liners": { - "type": "array", - "default": [ - "head", - "body", - "/html" - ], - "items": { - "type": "string" - }, - "description": "List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by Vue Beautifier)", - "title": "Extra liners", - "beautifiers": [ - "Vue Beautifier" - ], - "key": "extra_liners", - "language": { - "name": "HTML", - "namespace": "html" - } - }, "disabled": { "title": "Disable Beautifying Language", "order": -3, From e97cdea57e2caa7a868f7e7afe18b055bd5dbd92 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 20 Feb 2018 15:19:33 -0600 Subject: [PATCH 097/103] Fix options for typescript-formatter and vue-beautifier --- docs/options.md | 1645 +++++++++++++++++++ src/beautifiers/typescript-formatter.coffee | 5 +- src/beautifiers/vue-beautifier.coffee | 2 +- src/options.json | 511 ++++++ 4 files changed, 2161 insertions(+), 2 deletions(-) diff --git a/docs/options.md b/docs/options.md index 1a00495..3cb4453 100644 --- a/docs/options.md +++ b/docs/options.md @@ -12663,6 +12663,8 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | +| `indent_size` | :x: | :white_check_mark: | +| `indent_with_tabs` | :x: | :white_check_mark: | **Description**: @@ -12723,6 +12725,56 @@ Automatically beautify TypeScript files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Indent size](#indent-size) + +**Namespace**: `js` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Indentation size/length (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_size": 4 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + #### [UX Markup](#ux-markup) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -13180,6 +13232,33 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `disabled` | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | +| `brace_style` | :x: | :white_check_mark: | +| `break_chained_methods` | :x: | :white_check_mark: | +| `end_of_line` | :x: | :white_check_mark: | +| `end_with_comma` | :x: | :white_check_mark: | +| `end_with_newline` | :x: | :white_check_mark: | +| `eval_code` | :x: | :white_check_mark: | +| `extra_liners` | :x: | :white_check_mark: | +| `indent_char` | :x: | :white_check_mark: | +| `indent_inner_html` | :x: | :white_check_mark: | +| `indent_level` | :x: | :white_check_mark: | +| `indent_scripts` | :x: | :white_check_mark: | +| `indent_size` | :x: | :white_check_mark: | +| `indent_with_tabs` | :x: | :white_check_mark: | +| `jslint_happy` | :x: | :white_check_mark: | +| `keep_array_indentation` | :x: | :white_check_mark: | +| `keep_function_indentation` | :x: | :white_check_mark: | +| `max_preserve_newlines` | :x: | :white_check_mark: | +| `object_curly_spacing` | :x: | :white_check_mark: | +| `preserve_newlines` | :x: | :white_check_mark: | +| `space_after_anon_function` | :x: | :white_check_mark: | +| `space_before_conditional` | :x: | :white_check_mark: | +| `space_in_paren` | :x: | :white_check_mark: | +| `unescape_strings` | :x: | :white_check_mark: | +| `unformatted` | :x: | :white_check_mark: | +| `wrap_attributes` | :x: | :white_check_mark: | +| `wrap_attributes_indent_size` | :x: | :white_check_mark: | +| `wrap_line_length` | :x: | :white_check_mark: | **Description**: @@ -13240,6 +13319,761 @@ Automatically beautify Vue files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + +##### [Break chained methods](#break-chained-methods) + +**Namespace**: `js` + +**Key**: `break_chained_methods` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Break chained method calls across subsequent lines (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "break_chained_methods": false + } +} +``` + +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Override EOL from line-ending-selector (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + +##### [End with comma](#end-with-comma) + +**Namespace**: `js` + +**Key**: `end_with_comma` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_with_comma": false + } +} +``` + +##### [End with newline](#end-with-newline) + +**Namespace**: `html` + +**Key**: `end_with_newline` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +End output with newline (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "end_with_newline": false + } +} +``` + +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + + (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + +##### [Indent char](#indent-char) + +**Namespace**: `html` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation character (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_char": " " + } +} +``` + +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indent and sections. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent level](#indent-level) + +**Namespace**: `js` + +**Key**: `indent_level` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Initial indentation level (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_level": 0 + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +[keep|separate|normal] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + +##### [Indent size](#indent-size) + +**Namespace**: `html` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation size/length (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_size": 4 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Enable jslint-stricter mode (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "jslint_happy": false + } +} +``` + +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Preserve array indentation (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_array_indentation": false + } +} +``` + +##### [Keep function indentation](#keep-function-indentation) + +**Namespace**: `js` + +**Key**: `keep_function_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + + (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_function_indentation": false + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Insert spaces between brackets in object literals (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Preserve line-breaks (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Space after anon function](#space-after-anon-function) + +**Namespace**: `js` + +**Key**: `space_after_anon_function` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Add a space before an anonymous function's parens, ie. function () (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_after_anon_function": false + } +} +``` + +##### [Space before conditional](#space-before-conditional) + +**Namespace**: `js` + +**Key**: `space_before_conditional` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + + (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + +##### [Space in paren](#space-in-paren) + +**Namespace**: `js` + +**Key**: `space_in_paren` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Add padding spaces within paren, ie. f( a, b ) (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_in_paren": false + } +} +``` + +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + +##### [Wrap line length](#wrap-line-length) + +**Namespace**: `html` + +**Key**: `wrap_line_length` + +**Default**: `250` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Maximum characters per line (0 disables) (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_line_length": 250 + } +} +``` + #### [XML](#xml) **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) @@ -16812,6 +17646,59 @@ Indentation character (Supported by Ruby Beautify) ``` +### TypeScript Formatter + +##### [Indent size](#indent-size) + +**Namespace**: `js` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Indentation size/length (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_size": 4 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + + ### Uncrustify ##### [Config Path](#config-path) @@ -16839,6 +17726,764 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) ``` +### Vue Beautifier + +##### [Indent size](#indent-size) + +**Namespace**: `html` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation size/length (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_size": 4 + } +} +``` + +##### [Indent char](#indent-char) + +**Namespace**: `html` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation character (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_char": " " + } +} +``` + +##### [Indent level](#indent-level) + +**Namespace**: `js` + +**Key**: `indent_level` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Initial indentation level (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_level": 0 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Preserve line-breaks (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Space in paren](#space-in-paren) + +**Namespace**: `js` + +**Key**: `space_in_paren` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Add padding spaces within paren, ie. f( a, b ) (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_in_paren": false + } +} +``` + +##### [Jslint happy](#jslint-happy) + +**Namespace**: `js` + +**Key**: `jslint_happy` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Enable jslint-stricter mode (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "jslint_happy": false + } +} +``` + +##### [Space after anon function](#space-after-anon-function) + +**Namespace**: `js` + +**Key**: `space_after_anon_function` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Add a space before an anonymous function's parens, ie. function () (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_after_anon_function": false + } +} +``` + +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `collapse-preserve-inline` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + +##### [Break chained methods](#break-chained-methods) + +**Namespace**: `js` + +**Key**: `break_chained_methods` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Break chained method calls across subsequent lines (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "break_chained_methods": false + } +} +``` + +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Preserve array indentation (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_array_indentation": false + } +} +``` + +##### [Keep function indentation](#keep-function-indentation) + +**Namespace**: `js` + +**Key**: `keep_function_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + + (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_function_indentation": false + } +} +``` + +##### [Space before conditional](#space-before-conditional) + +**Namespace**: `js` + +**Key**: `space_before_conditional` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + + (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "space_before_conditional": true + } +} +``` + +##### [Eval code](#eval-code) + +**Namespace**: `js` + +**Key**: `eval_code` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + + (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "eval_code": false + } +} +``` + +##### [Unescape strings](#unescape-strings) + +**Namespace**: `js` + +**Key**: `unescape_strings` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Decode printable characters encoded in xNN notation (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "unescape_strings": false + } +} +``` + +##### [Wrap line length](#wrap-line-length) + +**Namespace**: `html` + +**Key**: `wrap_line_length` + +**Default**: `250` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Maximum characters per line (0 disables) (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_line_length": 250 + } +} +``` + +##### [End with newline](#end-with-newline) + +**Namespace**: `html` + +**Key**: `end_with_newline` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +End output with newline (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "end_with_newline": false + } +} +``` + +##### [End with comma](#end-with-comma) + +**Namespace**: `js` + +**Key**: `end_with_comma` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_with_comma": false + } +} +``` + +##### [End of line](#end-of-line) + +**Namespace**: `js` + +**Key**: `end_of_line` + +**Default**: `System Default` + +**Type**: `string` + +**Enum**: `CRLF` `LF` `System Default` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Override EOL from line-ending-selector (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "end_of_line": "System Default" + } +} +``` + +##### [Object curly spacing](#object-curly-spacing) + +**Namespace**: `js` + +**Key**: `object_curly_spacing` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Insert spaces between brackets in object literals (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "object_curly_spacing": false + } +} +``` + +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indent and sections. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +[keep|separate|normal] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + + ### align-yaml ##### [Padding](#padding) diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index 5cff9f1..be786a8 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -5,7 +5,10 @@ module.exports = class TypeScriptFormatter extends Beautifier name: "TypeScript Formatter" link: "https://github.com/vvakame/typescript-formatter" options: { - TypeScript: false + TypeScript: + indent_with_tabs: true + tab_width: true + indent_size: true TSX: true } diff --git a/src/beautifiers/vue-beautifier.coffee b/src/beautifiers/vue-beautifier.coffee index 39ff252..6c693b9 100644 --- a/src/beautifiers/vue-beautifier.coffee +++ b/src/beautifiers/vue-beautifier.coffee @@ -6,7 +6,7 @@ module.exports = class VueBeautifier extends Beautifier link: "https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/vue-beautifier.coffee" options: - Vue: false + Vue: true beautify: (text, language, options) -> return new @Promise((resolve, reject) => diff --git a/src/options.json b/src/options.json index 568de04..24cc1e9 100644 --- a/src/options.json +++ b/src/options.json @@ -7409,6 +7409,35 @@ "ts" ], "properties": { + "indent_size": { + "type": "integer", + "default": null, + "minimum": 0, + "description": "Indentation size/length (Supported by TypeScript Formatter)", + "title": "Indent size", + "beautifiers": [ + "TypeScript Formatter" + ], + "key": "indent_size", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "indent_with_tabs": { + "type": "boolean", + "default": null, + "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter)", + "title": "Indent with tabs", + "beautifiers": [ + "TypeScript Formatter" + ], + "key": "indent_with_tabs", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3, @@ -7606,6 +7635,488 @@ "vue" ], "properties": { + "indent_size": { + "type": "integer", + "default": null, + "minimum": 0, + "description": "Indentation size/length (Supported by Vue Beautifier)", + "title": "Indent size", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "indent_size", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "indent_char": { + "type": "string", + "default": null, + "description": "Indentation character (Supported by Vue Beautifier)", + "title": "Indent char", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "indent_char", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "indent_level": { + "type": "integer", + "default": 0, + "description": "Initial indentation level (Supported by Vue Beautifier)", + "title": "Indent level", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "indent_level", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "indent_with_tabs": { + "type": "boolean", + "default": null, + "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Vue Beautifier)", + "title": "Indent with tabs", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "indent_with_tabs", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "preserve_newlines": { + "type": "boolean", + "default": true, + "description": "Preserve line-breaks (Supported by Vue Beautifier)", + "title": "Preserve newlines", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "preserve_newlines", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "max_preserve_newlines": { + "type": "integer", + "default": 10, + "description": "Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier)", + "title": "Max preserve newlines", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "max_preserve_newlines", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "space_in_paren": { + "type": "boolean", + "default": false, + "description": "Add padding spaces within paren, ie. f( a, b ) (Supported by Vue Beautifier)", + "title": "Space in paren", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "space_in_paren", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "jslint_happy": { + "type": "boolean", + "default": false, + "description": "Enable jslint-stricter mode (Supported by Vue Beautifier)", + "title": "Jslint happy", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "jslint_happy", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "space_after_anon_function": { + "type": "boolean", + "default": false, + "description": "Add a space before an anonymous function's parens, ie. function () (Supported by Vue Beautifier)", + "title": "Space after anon function", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "space_after_anon_function", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "brace_style": { + "type": "string", + "default": "collapse", + "enum": [ + "collapse", + "collapse-preserve-inline", + "expand", + "end-expand", + "none" + ], + "description": "[collapse|expand|end-expand|none] (Supported by Vue Beautifier)", + "title": "Brace style", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "brace_style", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "break_chained_methods": { + "type": "boolean", + "default": false, + "description": "Break chained method calls across subsequent lines (Supported by Vue Beautifier)", + "title": "Break chained methods", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "break_chained_methods", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "keep_array_indentation": { + "type": "boolean", + "default": false, + "description": "Preserve array indentation (Supported by Vue Beautifier)", + "title": "Keep array indentation", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "keep_array_indentation", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "keep_function_indentation": { + "type": "boolean", + "default": false, + "description": " (Supported by Vue Beautifier)", + "title": "Keep function indentation", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "keep_function_indentation", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "space_before_conditional": { + "type": "boolean", + "default": true, + "description": " (Supported by Vue Beautifier)", + "title": "Space before conditional", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "space_before_conditional", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "eval_code": { + "type": "boolean", + "default": false, + "description": " (Supported by Vue Beautifier)", + "title": "Eval code", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "eval_code", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "unescape_strings": { + "type": "boolean", + "default": false, + "description": "Decode printable characters encoded in xNN notation (Supported by Vue Beautifier)", + "title": "Unescape strings", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "unescape_strings", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "wrap_line_length": { + "type": "integer", + "default": 250, + "description": "Maximum characters per line (0 disables) (Supported by Vue Beautifier)", + "title": "Wrap line length", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "wrap_line_length", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "end_with_newline": { + "type": "boolean", + "default": false, + "description": "End output with newline (Supported by Vue Beautifier)", + "title": "End with newline", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "end_with_newline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "end_with_comma": { + "type": "boolean", + "default": false, + "description": "If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by Vue Beautifier)", + "title": "End with comma", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "end_with_comma", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "end_of_line": { + "type": "string", + "default": "System Default", + "enum": [ + "CRLF", + "LF", + "System Default" + ], + "description": "Override EOL from line-ending-selector (Supported by Vue Beautifier)", + "title": "End of line", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "end_of_line", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "object_curly_spacing": { + "type": "boolean", + "default": false, + "description": "Insert spaces between brackets in object literals (Supported by Vue Beautifier)", + "title": "Object curly spacing", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "object_curly_spacing", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "indent_inner_html": { + "type": "boolean", + "default": false, + "description": "Indent and sections. (Supported by Vue Beautifier)", + "title": "Indent inner html", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "indent_inner_html", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "indent_scripts": { + "type": "string", + "default": "normal", + "enum": [ + "keep", + "separate", + "normal" + ], + "description": "[keep|separate|normal] (Supported by Vue Beautifier)", + "title": "Indent scripts", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "indent_scripts", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "wrap_attributes": { + "type": "string", + "default": "auto", + "enum": [ + "auto", + "force", + "force-aligned", + "force-expand-multiline" + ], + "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier)", + "title": "Wrap attributes", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "wrap_attributes", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "wrap_attributes_indent_size": { + "type": "integer", + "default": null, + "minimum": 0, + "description": "Indent wrapped attributes to after N characters (Supported by Vue Beautifier)", + "title": "Wrap attributes indent size", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "wrap_attributes_indent_size", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "unformatted": { + "type": "array", + "default": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ], + "items": { + "type": "string" + }, + "description": "List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier)", + "title": "Unformatted", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "extra_liners": { + "type": "array", + "default": [ + "head", + "body", + "/html" + ], + "items": { + "type": "string" + }, + "description": "List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by Vue Beautifier)", + "title": "Extra liners", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "extra_liners", + "language": { + "name": "HTML", + "namespace": "html" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3, From b4c75b4837594d2aaf78f401a443e592e415f27f Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 20 Feb 2018 15:28:42 -0600 Subject: [PATCH 098/103] Update TSX options --- docs/options.md | 52 +++++++++++++++++++++ src/beautifiers/typescript-formatter.coffee | 5 +- src/languages/tsx.coffee | 2 +- src/options.json | 29 ++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) diff --git a/docs/options.md b/docs/options.md index 3cb4453..9a69a78 100644 --- a/docs/options.md +++ b/docs/options.md @@ -12292,6 +12292,8 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) | `disabled` | :white_check_mark: | | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | +| `indent_size` | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | **Description**: @@ -12352,6 +12354,56 @@ Automatically beautify TSX files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Indent size](#indent-size) + +**Namespace**: `js` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Indentation size/length (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_size": 4 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + #### [Twig](#twig) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index be786a8..4dee72d 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -9,7 +9,10 @@ module.exports = class TypeScriptFormatter extends Beautifier indent_with_tabs: true tab_width: true indent_size: true - TSX: true + TSX: + indent_with_tabs: true + tab_width: true + indent_size: true } beautify: (text, language, options) -> diff --git a/src/languages/tsx.coffee b/src/languages/tsx.coffee index 7625b88..d75ff1b 100644 --- a/src/languages/tsx.coffee +++ b/src/languages/tsx.coffee @@ -2,7 +2,7 @@ module.exports = { name: "TSX" namespace: "tsx" - fallback: ['ts'] + fallback: ['js'] ### Supported Grammars diff --git a/src/options.json b/src/options.json index 24cc1e9..196868b 100644 --- a/src/options.json +++ b/src/options.json @@ -7199,6 +7199,35 @@ "tsx" ], "properties": { + "indent_size": { + "type": "integer", + "default": null, + "minimum": 0, + "description": "Indentation size/length (Supported by TypeScript Formatter)", + "title": "Indent size", + "beautifiers": [ + "TypeScript Formatter" + ], + "key": "indent_size", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "indent_with_tabs": { + "type": "boolean", + "default": null, + "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter)", + "title": "Indent with tabs", + "beautifiers": [ + "TypeScript Formatter" + ], + "key": "indent_with_tabs", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3, From 50172154c5571f14711072d6d96d0b2a0d35fad6 Mon Sep 17 00:00:00 2001 From: Steven Zeck Date: Tue, 20 Feb 2018 16:23:53 -0600 Subject: [PATCH 099/103] Use path and context to retrieve the directory --- src/beautifiers/prettier.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/beautifiers/prettier.coffee b/src/beautifiers/prettier.coffee index bd2d12a..6d5c4e1 100644 --- a/src/beautifiers/prettier.coffee +++ b/src/beautifiers/prettier.coffee @@ -2,6 +2,7 @@ Beautifier = require('./beautifier') prettier = require("prettier") +path = require("path") module.exports = class Prettier extends Beautifier name: "Prettier" @@ -23,7 +24,7 @@ module.exports = class Prettier extends Beautifier Markdown: false } - beautify: (text, language, options) -> + beautify: (text, language, options, context) -> return new @Promise((resolve, reject) -> _ = require('lodash') @@ -33,7 +34,7 @@ module.exports = class Prettier extends Beautifier else reject(new Error("Unknown language for Prettier")) - filePath = atom.workspace.getActiveTextEditor().getPath() + filePath = context.filePath and path.dirname context.filePath try prettier.resolveConfig(filePath).then((configOptions) -> From 335f7594e75f1c105eff7d1f938c3d3a60e00703 Mon Sep 17 00:00:00 2001 From: Christian Kjaer Laustsen Date: Mon, 26 Feb 2018 19:12:30 +0100 Subject: [PATCH 100/103] Set stylish-haskell as the default haskell beautifier --- src/languages/haskell.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/languages/haskell.coffee b/src/languages/haskell.coffee index 31ec842..649156d 100644 --- a/src/languages/haskell.coffee +++ b/src/languages/haskell.coffee @@ -17,6 +17,8 @@ module.exports = { "hs" ] + defaultBeautifier: "stylish-haskell" + options: [] } From 2cb86a679a44ebcace793127ac7e384ab2c767b9 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Thu, 1 Mar 2018 20:15:27 -0400 Subject: [PATCH 101/103] Add changelog entry for breaking change to pybeautifier. #1898 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecd8ce3..a18faf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Next +- Breaking change to `pybeautifier`: Fix typo, change `formater` to `formatter`. See [#1898](https://github.com/Glavin001/atom-beautify/pull/1898). - Fixes [#1773](https://github.com/Glavin001/atom-beautify/issues/1773) and [#793](https://github.com/Glavin001/atom-beautify/issues/793). ruby-beautify with Rubocop now respects `Exclude` settings, and properly loads inherited config files (like `~/.rubocop.yml`) - Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable - See [#601](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for tsx files From d96f898d38136344c89b6bf8ecfdd1cbdc16fd8a Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Thu, 1 Mar 2018 20:27:54 -0400 Subject: [PATCH 102/103] Update docs --- README.md | 2 +- src/options.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 61431e9..64281f4 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | Go | `Go` |`.go` | **[`gofmt`](https://golang.org/cmd/gofmt/)**, [`goimports`](https://godoc.org/golang.org/x/tools/cmd/goimports) | | Golang Template | `HTML (Go)`, `Go Template` |`.gohtml` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** | | Handlebars | `Handlebars`, `HTML (Handlebars)` |`.hbs`, `.handlebars` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | -| Haskell | `Haskell` |`.hs` | **[`brittany`](https://github.com/lspitzner/brittany)**, [`hindent`](https://github.com/commercialhaskell/hindent), [`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell) | +| Haskell | `Haskell` |`.hs` | **[`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell)**, [`brittany`](https://github.com/lspitzner/brittany), [`hindent`](https://github.com/commercialhaskell/hindent) | | HTML | `HTML` |`.html` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | Jade | `Jade`, `Pug` |`.jade`, `.pug` | **[`Pug Beautify`](https://github.com/vingorius/pug-beautify)** | | Java | `Java` |`.java` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)** | diff --git a/src/options.json b/src/options.json index 1a8ec7a..c30a3c1 100644 --- a/src/options.json +++ b/src/options.json @@ -2417,7 +2417,7 @@ "title": "Default Beautifier", "order": -2, "type": "string", - "default": "brittany", + "default": "stylish-haskell", "description": "Default Beautifier to be used for Haskell", "enum": [ "brittany", From d27ca3e54a8c659b1eb0ae7dcc2184ac6e4125ee Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Thu, 1 Mar 2018 20:29:50 -0400 Subject: [PATCH 103/103] See #1911. Change Brittany and Hindent beautifiers to support no options --- src/beautifiers/brittany.coffee | 2 +- src/beautifiers/hindent.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/beautifiers/brittany.coffee b/src/beautifiers/brittany.coffee index 1f4445c..54769be 100644 --- a/src/beautifiers/brittany.coffee +++ b/src/beautifiers/brittany.coffee @@ -11,7 +11,7 @@ module.exports = class Brittany extends Beautifier isPreInstalled: false options: { - Haskell: true + Haskell: false } beautify: (text, language, options) -> diff --git a/src/beautifiers/hindent.coffee b/src/beautifiers/hindent.coffee index c1b9756..d7f06cf 100644 --- a/src/beautifiers/hindent.coffee +++ b/src/beautifiers/hindent.coffee @@ -11,7 +11,7 @@ module.exports = class Hindent extends Beautifier isPreInstalled: false options: { - Haskell: true + Haskell: false } beautify: (text, language, options) ->