From d79eda075642eeee9e8a236db79a4a8817c33f41 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Wed, 6 Apr 2016 22:21:43 +0200 Subject: [PATCH 01/28] running provided emacs binary directly instead of running it via python which does not work well on windows. listening to emacs return codes. --- .../fortran-beautifier/index.coffee | 60 +++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/src/beautifiers/fortran-beautifier/index.coffee b/src/beautifiers/fortran-beautifier/index.coffee index fcada97..cd009fe 100644 --- a/src/beautifiers/fortran-beautifier/index.coffee +++ b/src/beautifiers/fortran-beautifier/index.coffee @@ -7,41 +7,39 @@ Beautifier = require('../beautifier') path = require("path") module.exports = class FortranBeautifier extends Beautifier - name: "Fortran Beautifier" + name: "Fortran Beautifier" - options: { - Fortran: true - } + options: { + Fortran: true + } - beautify: (text, language, options) -> - @debug('fortran-beautifier', options) + beautify: (text, language, options) -> + @debug('fortran-beautifier', options) - emacs_path = options.emacs_path - emacs_script_path = options.emacs_script_path + emacs_path = options.emacs_path + emacs_script_path = options.emacs_script_path - if not emacs_script_path - emacs_script_path = path.resolve(__dirname, "emacs-fortran-formating-script.lisp") + if not emacs_script_path + emacs_script_path = path.resolve(__dirname, "emacs-fortran-formating-script.lisp") - @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path) + @debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path) - args = [ - '--batch' - '-l' - emacs_script_path - '-f' - 'f90-batch-indent-region' - tempFile = @tempFile("temp", text) - ] + args = [ + '--batch' + '-l' + emacs_script_path + '-f' + 'f90-batch-indent-region' + tempFile = @tempFile("temp", text) + ] - if emacs_path - args.unshift("#{emacs_path}") - - @run("python", args, {ignoreReturnCode: true}) - .then(=> - @readFile(tempFile) - ) - else - @run("emacs", args, {ignoreReturnCode: true}) - .then(=> - @readFile(tempFile) - ) + if emacs_path? + @run(emacs_path, args, {ignoreReturnCode: false}) + .then(=> + @readFile(tempFile) + ) + else + @run("emacs", args, {ignoreReturnCode: false}) + .then(=> + @readFile(tempFile) + ) From 55445d66adfef7a28e497aa29834a9b86b9b383e Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Sun, 10 Apr 2016 17:31:49 +0200 Subject: [PATCH 02/28] fixed non empty check of emacs path --- src/beautifiers/fortran-beautifier/index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/fortran-beautifier/index.coffee b/src/beautifiers/fortran-beautifier/index.coffee index cd009fe..d5f2c05 100644 --- a/src/beautifiers/fortran-beautifier/index.coffee +++ b/src/beautifiers/fortran-beautifier/index.coffee @@ -33,7 +33,7 @@ module.exports = class FortranBeautifier extends Beautifier tempFile = @tempFile("temp", text) ] - if emacs_path? + if emacs_path @run(emacs_path, args, {ignoreReturnCode: false}) .then(=> @readFile(tempFile) From 125660c1e770bc3606de4e1d065fee51353be17e Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Sun, 10 Apr 2016 18:10:10 +0200 Subject: [PATCH 03/28] fixed appveyor uncrustify download command --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5808153..7452ade 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -105,7 +105,7 @@ install: - where php-cs-fixer # Uncrustify - - curl -L http://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.61/uncrustify-0.61.3-gf65394e-win32.zip/download > uncrustify.zip + - curl -k -L http://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.61/uncrustify-0.61.3-gf65394e-win32.zip/download > uncrustify.zip - cinst 7zip.commandline -y - 7za e uncrustify.zip -ouncrustify - "SET PATH=%cd%\\uncrustify;%PATH%" From af3655063903051bbed25efdc42531dc83218487 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Sun, 10 Apr 2016 18:23:41 +0200 Subject: [PATCH 04/28] added missing packages to appveyor build script --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 7452ade..cb0542d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -115,7 +115,7 @@ build_script: - cd %APPVEYOR_BUILD_FOLDER% # Install languages to Atom - - apm install language-marko language-html-swig language-svg language-elm + - apm install language-marko language-html-swig language-svg language-elm language-d mavensmate-atom # Show current PATH - echo %PATH% # Run tests on package From 238b81867b4830e374d75e4a721f42f0221e5970 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Sun, 10 Apr 2016 19:57:24 +0200 Subject: [PATCH 05/28] added isort and sqlparse to appveyor --- appveyor.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index cb0542d..8df7c49 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -76,6 +76,12 @@ install: - "%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" + - where sqlparse + # Ruby & Gem - cinst ruby -y - "SET PATH=C:\\Ruby193\\bin;%PATH%" From cf6a98d33fcfe8835773952fa096842ae06d198c Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Sun, 10 Apr 2016 20:06:28 +0200 Subject: [PATCH 06/28] dont use > when downloading in powershell since this converts the output to unicode which is not preferable when downloading binaries --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8df7c49..4306b78 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -111,7 +111,7 @@ install: - where php-cs-fixer # Uncrustify - - curl -k -L http://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.61/uncrustify-0.61.3-gf65394e-win32.zip/download > uncrustify.zip + - curl -k -L http://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.61/uncrustify-0.61.3-gf65394e-win32.zip/download -o uncrustify.zip - cinst 7zip.commandline -y - 7za e uncrustify.zip -ouncrustify - "SET PATH=%cd%\\uncrustify;%PATH%" From c534a1e323f1fa8ce3f13e682970488bb1b11ae4 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Sun, 10 Apr 2016 20:32:56 +0200 Subject: [PATCH 07/28] removed check for sqlparse from appveyor build script --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4306b78..1bad685 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -80,8 +80,7 @@ install: - where isort - "%CMD_IN_ENV% pip install --upgrade sqlparse" - - where sqlparse - + # Ruby & Gem - cinst ruby -y - "SET PATH=C:\\Ruby193\\bin;%PATH%" From aeb39566abe7c70fe1b0f8dbb739255be288adea Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Tue, 12 Apr 2016 00:30:05 -0300 Subject: [PATCH 08/28] Closes #905. Add Handlebars support to Pretty Diff beautifier --- src/beautifiers/prettydiff.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index 9971412..b020ea6 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -40,6 +40,7 @@ module.exports = class PrettyDiff extends Beautifier ERB: true EJS: true HTML: true + Handlebars: true XML: true SVG: true Spacebars: true From 7f1ca2ac73cd173c8ef7b48fdd6ec5d22f1b268d Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Tue, 12 Apr 2016 16:20:45 +0200 Subject: [PATCH 09/28] debugging appveyor --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1bad685..8f2f631 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -80,7 +80,7 @@ install: - where isort - "%CMD_IN_ENV% pip install --upgrade sqlparse" - + # Ruby & Gem - cinst ruby -y - "SET PATH=C:\\Ruby193\\bin;%PATH%" @@ -115,6 +115,7 @@ install: - 7za e uncrustify.zip -ouncrustify - "SET PATH=%cd%\\uncrustify;%PATH%" - where uncrustify + - ps: "echo $env:path" build_script: From 4788deaa6dad30a620ce30ceafa16e968510f208 Mon Sep 17 00:00:00 2001 From: ewgenius Date: Wed, 13 Apr 2016 08:18:29 +0300 Subject: [PATCH 10/28] adding Pug extension and grammar *.pug files can't be beautified --- src/languages/jade.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/jade.coffee b/src/languages/jade.coffee index 2f2eb82..c0a8bde 100644 --- a/src/languages/jade.coffee +++ b/src/languages/jade.coffee @@ -16,14 +16,14 @@ module.exports = { Supported Grammars ### grammars: [ - "Jade" + "Jade", "Pug" ] ### Supported extensions ### extensions: [ - "jade" + "jade", "pug" ] options: [ From 4584d98dd6b408a189db3728473b1f2eb8431714 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 01:14:47 +0200 Subject: [PATCH 11/28] more appveyor debugging --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 8f2f631..fa14319 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -116,6 +116,7 @@ install: - "SET PATH=%cd%\\uncrustify;%PATH%" - where uncrustify - ps: "echo $env:path" + - ps: where.exe uncrustify build_script: From 8ede61e9da9ba810bb3bdf5fc1d34c8719195538 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 01:19:36 +0200 Subject: [PATCH 12/28] added elm-format to appveyor --- appveyor.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index fa14319..0f110d0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -118,6 +118,12 @@ install: - ps: "echo $env:path" - ps: where.exe uncrustify + # elm-format + - curl -k -L https://github.com/avh4/elm-format/releases/download/0.2.0-alpha/elm-format-0.2.0-alpha-win-x64.zip -o elm-format.zip + - 7za e elm-format.zip -oelm-format + - "SET PATH=%cd%\\elm-format;%PATH%" + - where elm-format + build_script: - cd %APPVEYOR_BUILD_FOLDER% From 77d488633b90c944680b2d0f928be2b1748cf3b0 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 10:26:53 +0200 Subject: [PATCH 13/28] modified atom runner --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0f110d0..3674733 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -132,4 +132,4 @@ build_script: # Show current PATH - echo %PATH% # Run tests on package - - apm test --path %LOCALAPPDATA%/atom/bin/atom.cmd + - %LOCALAPPDATA%/atom/bin/atom.cmd --test spec From 792b58d30bf42ee55adca251f12afd113efe4fcd Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 10:35:19 +0200 Subject: [PATCH 14/28] fixed path --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3674733..36a3c03 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -132,4 +132,4 @@ build_script: # Show current PATH - echo %PATH% # Run tests on package - - %LOCALAPPDATA%/atom/bin/atom.cmd --test spec + - %LOCALAPPDATA%\atom\bin\atom.cmd --test spec From e809a220cb80968c41281e13f51706aa82f3c6c1 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 10:40:16 +0200 Subject: [PATCH 15/28] appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 36a3c03..e70a968 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -132,4 +132,4 @@ build_script: # Show current PATH - echo %PATH% # Run tests on package - - %LOCALAPPDATA%\atom\bin\atom.cmd --test spec + - "%LOCALAPPDATA%\\atom\\bin\\atom.cmd --test spec" From 4906e65cdbb48c0f7834b03ab8ef54bb72905b65 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 10:53:52 +0200 Subject: [PATCH 16/28] updated build script --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e70a968..bbe6565 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -115,8 +115,6 @@ install: - 7za e uncrustify.zip -ouncrustify - "SET PATH=%cd%\\uncrustify;%PATH%" - where uncrustify - - ps: "echo $env:path" - - ps: where.exe uncrustify # elm-format - curl -k -L https://github.com/avh4/elm-format/releases/download/0.2.0-alpha/elm-format-0.2.0-alpha-win-x64.zip -o elm-format.zip @@ -131,5 +129,7 @@ build_script: - apm install language-marko language-html-swig language-svg language-elm language-d mavensmate-atom # Show current PATH - echo %PATH% + - where uncrustify + - where elm-format # Run tests on package - "%LOCALAPPDATA%\\atom\\bin\\atom.cmd --test spec" From 4e91dd355829cc6262797873d7d8061c6f87e0b7 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 11:19:04 +0200 Subject: [PATCH 17/28] there seems to be an issue on windows where having an executable foo on the PATH and a folder foo in the cwd causes windows to be confused between the two. therefore, I renamed the folders for uncrustify and elm-format. --- appveyor.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bbe6565..f47a2d4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -112,14 +112,14 @@ install: # Uncrustify - curl -k -L http://sourceforge.net/projects/uncrustify/files/uncrustify/uncrustify-0.61/uncrustify-0.61.3-gf65394e-win32.zip/download -o uncrustify.zip - cinst 7zip.commandline -y - - 7za e uncrustify.zip -ouncrustify - - "SET PATH=%cd%\\uncrustify;%PATH%" + - 7za e uncrustify.zip -ouncrustify-d + - "SET PATH=%cd%\\uncrustify-d;%PATH%" - where uncrustify # elm-format - curl -k -L https://github.com/avh4/elm-format/releases/download/0.2.0-alpha/elm-format-0.2.0-alpha-win-x64.zip -o elm-format.zip - - 7za e elm-format.zip -oelm-format - - "SET PATH=%cd%\\elm-format;%PATH%" + - 7za e elm-format.zip -oelm-format-d + - "SET PATH=%cd%\\elm-format-d;%PATH%" - where elm-format build_script: @@ -129,7 +129,5 @@ build_script: - apm install language-marko language-html-swig language-svg language-elm language-d mavensmate-atom # Show current PATH - echo %PATH% - - where uncrustify - - where elm-format # Run tests on package - "%LOCALAPPDATA%\\atom\\bin\\atom.cmd --test spec" From a31711a0cb20db6bdc4bd83c6cce8cb910a48650 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 11:48:49 +0200 Subject: [PATCH 18/28] modified test runner --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f47a2d4..f8dd85d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -130,4 +130,5 @@ build_script: # Show current PATH - echo %PATH% # Run tests on package - - "%LOCALAPPDATA%\\atom\\bin\\atom.cmd --test spec" + #- "%LOCALAPPDATA%\\atom\\bin\\atom.cmd --test spec" + - apm test --path %LOCALAPPDATA%/atom/bin/atom.cmd From ae38396df0fa9da054bac932f3c1c7c29fd74066 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 12:08:37 +0200 Subject: [PATCH 19/28] updating travis and appveyor elm-format dep --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bc176d6..5a4fb5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -68,5 +68,5 @@ before_install: # - stack setup # - stack install stylish-haskell # Elm - - curl -L -o /tmp/elm-format.tgz https://github.com/avh4/elm-format/releases/download/0.1-alpha2/elm-format-0.1-alpha2-mac-x64.tgz + - curl -L -o /tmp/elm-format.tgz https://github.com/avh4/elm-format/releases/download/0.2.0-alpha/elm-format-0.2.0-alpha-mac-x64.tgz - tar xvzf /tmp/elm-format.tgz -C /usr/local/bin From 106a3130e4d1017de120ac0912f70348f5ebcc88 Mon Sep 17 00:00:00 2001 From: Jan-Cornelius Molnar Date: Thu, 14 Apr 2016 14:05:18 +0200 Subject: [PATCH 20/28] updated elm examples to v0.2 --- examples/nested-jsbeautifyrc/elm/expected/test.elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/nested-jsbeautifyrc/elm/expected/test.elm b/examples/nested-jsbeautifyrc/elm/expected/test.elm index b28a16c..3280f99 100644 --- a/examples/nested-jsbeautifyrc/elm/expected/test.elm +++ b/examples/nested-jsbeautifyrc/elm/expected/test.elm @@ -2,8 +2,8 @@ module Main (..) where addThings x y = - x + y + x + y main = - addThings 4 5 + addThings 4 5 From c0b3ba35570b953a4ebb9b7781510fde19d81eb5 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Thu, 14 Apr 2016 23:24:56 -0300 Subject: [PATCH 21/28] See #919. Remove options from analytics tracking Originally tracking `options` was intended to help with debugging errors, and making sure Atom-Beautify was working for the users. However, we now have that `Help Debug Editor` command that users can use on their own when submitting an Issue for Atom-Beautify on GitHub. Thus, tracking the `options` is not being used for analytics (yet) and it is more advantageous to remove to reduce the information being tracked. --- src/beautifiers/index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index c88f4b5..1021543 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -302,7 +302,7 @@ module.exports = class Beautifiers extends EventEmitter grammar : grammar extension : fileExtension version : version - options : allOptions + #options : allOptions label : language?.name category : version From 1009945b8a8d4fa938a6d9fea908cdc085897644 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sat, 16 Apr 2016 16:15:14 -0300 Subject: [PATCH 22/28] Fix built-options and docs script adding duplicate beautifiers --- docs/options.md | 68 ++++++++++++++++++++--------------------- script/build-options.js | 5 ++- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/docs/options.md b/docs/options.md index a8f25dd..250b20f 100644 --- a/docs/options.md +++ b/docs/options.md @@ -394,7 +394,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) #### [Coldfusion](#coldfusion) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -1268,7 +1268,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) #### [CSS](#css) -**Supported Beautifiers**: [`CSScomb`](#csscomb) [`CSScomb`](#csscomb) [`JS Beautify`](#js-beautify) [`JS Beautify`](#js-beautify) [`JS Beautify`](#js-beautify) [`JS Beautify`](#js-beautify) [`JS Beautify`](#js-beautify) [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`CSScomb`](#csscomb) [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: @@ -1657,7 +1657,7 @@ Maximum amount of characters per line (0 = disable) (Supported by JS Beautify, P #### [CSV](#csv) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -1807,7 +1807,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) #### [EJS](#ejs) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -2109,7 +2109,7 @@ Automatically beautify Elm files on save #### [ERB](#erb) -**Supported Beautifiers**: [`HTML Beautifier`](#html-beautifier) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`HTML Beautifier`](#html-beautifier) [`Pretty Diff`](#pretty-diff) **Description**: @@ -2628,7 +2628,7 @@ Automatically beautify Go files on save #### [Handlebars](#handlebars) -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: @@ -2659,7 +2659,7 @@ Disable Handlebars Beautification **Type**: `string` -**Enum**: `JS Beautify` +**Enum**: `JS Beautify` `Pretty Diff` **Description**: @@ -2781,11 +2781,11 @@ List of tags (defaults to [head,body,/html] that should have an extra newline be **Type**: `string` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation character (Supported by JS Beautify) +Indentation character (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2859,11 +2859,11 @@ Indent and sections. (Supported by JS Beautify) **Type**: `integer` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Indentation size/length (Supported by JS Beautify) +Indentation size/length (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -2911,11 +2911,11 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) **Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Preserve line-breaks (Supported by JS Beautify) +Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -3055,11 +3055,11 @@ Indent wrapped attributes to after N characters (Supported by JS Beautify) **Type**: `integer` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Maximum characters per line (0 disables) (Supported by JS Beautify) +Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** @@ -3136,7 +3136,7 @@ Automatically beautify Haskell files on save #### [HTML](#html) -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: @@ -3581,7 +3581,7 @@ Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff) #### [Jade](#jade) -**Supported Beautifiers**: [`Pug Beautify`](#pug-beautify) [`Pug Beautify`](#pug-beautify) +**Supported Beautifiers**: [`Pug Beautify`](#pug-beautify) **Description**: @@ -3783,7 +3783,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) #### [JavaScript](#javascript) -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`JSCS Fixer`](#jscs-fixer) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`JSCS Fixer`](#jscs-fixer) [`Pretty Diff`](#pretty-diff) **Description**: @@ -4316,7 +4316,7 @@ 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) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: @@ -4849,7 +4849,7 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre #### [JSX](#jsx) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -5330,7 +5330,7 @@ Remove trailing whitespace (Supported by Latex Beautify) #### [LESS](#less) -**Supported Beautifiers**: [`CSScomb`](#csscomb) [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) **Description**: @@ -5695,7 +5695,7 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) #### [Markdown](#markdown) -**Supported Beautifiers**: [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Remark`](#remark) [`Tidy Markdown`](#tidy-markdown) +**Supported Beautifiers**: [`Remark`](#remark) [`Tidy Markdown`](#tidy-markdown) **Description**: @@ -7398,7 +7398,7 @@ sort imports (requires isort installed) (Supported by autopep8) #### [Riot.js](#riot.js) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -7565,7 +7565,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) #### [Ruby](#ruby) -**Supported Beautifiers**: [`Rubocop`](#rubocop) [`Rubocop`](#rubocop) [`Ruby Beautify`](#ruby-beautify) [`Ruby Beautify`](#ruby-beautify) +**Supported Beautifiers**: [`Rubocop`](#rubocop) [`Ruby Beautify`](#ruby-beautify) **Description**: @@ -7793,7 +7793,7 @@ Path to rustfmt program (Supported by rustfmt) #### [Sass](#sass) -**Supported Beautifiers**: [`CSScomb`](#csscomb) [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) **Description**: @@ -8158,7 +8158,7 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) #### [SCSS](#scss) -**Supported Beautifiers**: [`CSScomb`](#csscomb) [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) **Description**: @@ -8523,7 +8523,7 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) #### [Spacebars](#spacebars) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -8835,7 +8835,7 @@ Change case of keywords (Supported by sqlformat) #### [SVG](#svg) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -9002,7 +9002,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) #### [Swig](#swig) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -9169,7 +9169,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) #### [TSS](#tss) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -9482,7 +9482,7 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) #### [Twig](#twig) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -10341,7 +10341,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) #### [Visualforce](#visualforce) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: @@ -10508,7 +10508,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) #### [XML](#xml) -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: @@ -10953,7 +10953,7 @@ Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff) #### [XTemplate](#xtemplate) -**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Description**: diff --git a/script/build-options.js b/script/build-options.js index 6a505f5..4439d0e 100644 --- a/script/build-options.js +++ b/script/build-options.js @@ -129,6 +129,7 @@ buildOptionsForBeautifiers = function(beautifiers, allLanguages) { allOptions = _.values(langOptions); flatOptions = _.reduce(allOptions, (function(result, languageOptions, language) { return _.reduce(languageOptions, (function(result, optionDef, optionName) { + optionDef.beautifiers = _.uniq(optionDef.beautifiers) if (optionDef.beautifiers.length > 0) { optionDef.description = optionDef.description + " (Supported by " + (optionDef.beautifiers.join(', ')) + ")"; } else { @@ -309,6 +310,7 @@ buildOptionsForBeautifiers = function(beautifiers, allLanguages) { ref16 = group.properties; for (o in ref16) { optionDef = ref16[o]; + optionDef.beautifiers = _.uniq(optionDef.beautifiers) if (optionDef.beautifiers.length > 0) { optionDef.description = optionDef.description + " (Supported by " + (optionDef.beautifiers.join(', ')) + ")"; } else { @@ -324,7 +326,8 @@ buildOptionsForBeautifiers = function(beautifiers, allLanguages) { lang = languages[langName]; name = lang.name; namespace = lang.namespace; - beautifiers = lang.beautifiers; + beautifiers = (lang.beautifiers = _.uniq(lang.beautifiers)); + langOptions[namespace].beautifiers = beautifiers optionName = "language_" + namespace; _.set(langOptions, namespace + ".properties.disabled", { title: "Disable Beautifying Language", From 3bc3c6d3a724a26064ba76e6cddc4011e36bc274 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sat, 16 Apr 2016 16:15:47 -0300 Subject: [PATCH 23/28] See #924. Add JavaScript test that is reported to crash Atom --- .../javascript/expected/test2.js | 65 ++++++++++++++++++ .../javascript/original/test2.js | 66 +++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 examples/nested-jsbeautifyrc/javascript/expected/test2.js create mode 100644 examples/nested-jsbeautifyrc/javascript/original/test2.js diff --git a/examples/nested-jsbeautifyrc/javascript/expected/test2.js b/examples/nested-jsbeautifyrc/javascript/expected/test2.js new file mode 100644 index 0000000..1063943 --- /dev/null +++ b/examples/nested-jsbeautifyrc/javascript/expected/test2.js @@ -0,0 +1,65 @@ +/** + * Created by Pierre on 05.04.16. + */ +var express = require("express"); +var router = express.Router({ + mergeParams: true +}); +var Customer = require("../../models/customers"); +var middleware = require("../../middleware/index.js"); +//TODO add a way for pagination +//INDEX - show all Customers +router.get("/", function (req, res) { + var regexid = /^[a-f\d]{24}$/i; + var search = req.query.search; + + if (regexid.exec(search) !== null) { + Customer.findById(search, function (err, foundCustomer) { + if (err) { + console.log(err); + } else { + res.end(JSON.stringify([foundCustomer])); + } + }); + } else { + var re = new RegExp(search); + var offset = 0; + if (req.query.offset) { + offset = req.query.offset; + } + Customer.find().or([{ + 'name': { + $regex: re + } + }, { + 'mail': { + $regex: re + } + }, { + 'phone': { + $regex: re + } + }, { + 'customernumber': { + $regex: re + } + }, { + 'street': { + $regex: re + } + }]).skip(parseInt(offset)).limit(20).exec(function (err, allCustomers) { + if (err) { + console.log(err); + } else if (allCustomers.length === 0) { + res.sendStatus(404); + } else { + res.end(JSON.stringify(allCustomers)); + } + }); + } + +}); + +// TODO add findsingle for id + +module.exports = router; \ No newline at end of file diff --git a/examples/nested-jsbeautifyrc/javascript/original/test2.js b/examples/nested-jsbeautifyrc/javascript/original/test2.js new file mode 100644 index 0000000..1549b5b --- /dev/null +++ b/examples/nested-jsbeautifyrc/javascript/original/test2.js @@ -0,0 +1,66 @@ +/** + * Created by Pierre on 05.04.16. + */ +var express = require("express"); +var router = express.Router({ + mergeParams: true +}); +var Customer = require("../../models/customers"); +var middleware = require("../../middleware/index.js"); +//TODO add a way for pagination +//INDEX - show all Customers +router.get("/", function(req, res) { + var regexid = /^[a-f\d]{24}$/i; + var search = req.query.search; + + if (regexid.exec(search) !== null) { + Customer.findById(search, function(err, foundCustomer) { + if (err) { + console.log(err); + } else { + res.end(JSON.stringify([foundCustomer])); + } + }); + } else { + var re = new RegExp(search); + var offset = 0; + if (req.query.offset) { + offset = req.query.offset; + } + Customer.find().or([{ + 'name': { + $regex: re + } + }, { + 'mail': { + $regex: re + } + }, { + 'phone': { + $regex: re + } + }, { + 'customernumber': { + $regex: re + } + }, { + 'street': { + $regex: re + } + }]).skip(parseInt(offset)).limit(20).exec(function(err, allCustomers) { + if (err) { + console.log(err); + } else if (allCustomers.length === 0) { + res.sendStatus(404); + } else { + res.end(JSON.stringify(allCustomers)); + } + }); + } + + +}); + +// TODO add findsingle for id + +module.exports = router; \ No newline at end of file From 78c2cc5480c7df062962ef0cf50a4daef6098c28 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sat, 16 Apr 2016 16:16:56 -0300 Subject: [PATCH 24/28] See #864. Fix Logger to use renamed loggerLevel setting key --- src/logger.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logger.coffee b/src/logger.coffee index b4a3a35..d169092 100644 --- a/src/logger.coffee +++ b/src/logger.coffee @@ -48,7 +48,7 @@ module.exports = do -> }) wlogger.on('logging', (transport, level, msg, meta)-> loggerLevel = atom?.config.get(\ - 'atom-beautify._loggerLevel') ? "warn" + 'atom-beautify.general.loggerLevel') ? "warn" # console.log('logging', loggerLevel, arguments) loggerLevelNum = levels[loggerLevel] levelNum = levels[level] From 83ecac5d7e7b120d0bbde7305d2d21b9ade006c5 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sat, 16 Apr 2016 16:18:10 -0300 Subject: [PATCH 25/28] See #924. Add more verbose debugging to beautifyFilePath --- src/beautifiers/beautifier.coffee | 16 ++++++++-------- src/beautify.coffee | 22 ++++++++++++++++++---- src/logger.coffee | 3 ++- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index 78e8256..f3af8dc 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -20,27 +20,27 @@ module.exports = class Beautifier ### Supported Options - + Enable options for supported languages. - : - :: - :: - :: - :: - + ### options: {} ### Supported languages by this Beautifier - + Extracted from the keys of the `options` field. ### languages: null ### Beautify text - + Override this method in subclasses ### beautify: null @@ -87,7 +87,7 @@ module.exports = class Beautifier ### Get Shell Environment variables - + Special thank you to @ioquatix See https://github.com/ioquatix/script-runner/blob/v1.5.0/lib/script-runner.coffee#L45-L63 ### @@ -139,7 +139,7 @@ module.exports = class Beautifier ### Like the unix which utility. - + Finds the first instance of a specified executable in the PATH environment variable. Does not cache the results, so hash -r is not needed when the PATH changes. @@ -165,7 +165,7 @@ module.exports = class Beautifier ### Add help to error.description - + Note: error.description is not officially used in JavaScript, however it is used internally for Atom Beautify when displaying errors. ### @@ -319,7 +319,7 @@ module.exports = class Beautifier for key, method of @logger # @verbose(key, method) @[key] = method - @verbose("Beautifier logger has been initialized.") + @verbose("#{@name} beautifier logger has been initialized.") ### Constructor to setup beautifer diff --git a/src/beautify.coffee b/src/beautify.coffee index 218aa17..60d936c 100644 --- a/src/beautify.coffee +++ b/src/beautify.coffee @@ -180,6 +180,7 @@ beautify = ({onSave}) -> return beautifyFilePath = (filePath, callback) -> + logger.verbose('beautifyFilePath', filePath) # Show in progress indicate on file's tree-view entry $ ?= require("atom-space-pen-views").$ @@ -188,13 +189,16 @@ beautifyFilePath = (filePath, callback) -> # Cleanup and return callback function cb = (err, result) -> + logger.verbose('Cleanup beautifyFilePath', err, result) $el = $(".icon-file-text[data-path=\"#{filePath}\"]") $el.removeClass('beautifying') return callback(err, result) # Get contents of file fs ?= require "fs" + logger.verbose('readFile', filePath) fs.readFile(filePath, (err, data) -> + logger.verbose('readFile completed', err, filePath) return cb(err) if err input = data?.toString() grammar = atom.grammars.selectGrammar(filePath, input) @@ -202,14 +206,18 @@ beautifyFilePath = (filePath, callback) -> # Get the options allOptions = beautifier.getOptionsForPath(filePath) + logger.verbose('beautifyFilePath allOptions', allOptions) # Beautify File completionFun = (output) -> + logger.verbose('beautifyFilePath completionFun', output) if output instanceof Error return cb(output, null ) # output == Error else if typeof output is "string" # do not allow empty string - return cb(null, output) if output is '' + if output.trim() is '' + logger.verbose('beautifyFilePath, output was empty string!') + return cb(null, output) # save to file fs.writeFile(filePath, output, (err) -> return cb(err) if err @@ -218,6 +226,7 @@ beautifyFilePath = (filePath, callback) -> else return cb( new Error("Unknown beautification result #{output}."), output) try + logger.verbose('beautify', input, allOptions, grammarName, filePath) beautifier.beautify(input, allOptions, grammarName, filePath) .then(completionFun) .catch(completionFun) @@ -470,8 +479,9 @@ debug = () -> handleSaveEvent = -> atom.workspace.observeTextEditors (editor) -> - buffer = editor.getBuffer() - disposable = buffer.onDidSave(({path : filePath}) -> + disposable = editor.onDidSave(({path : filePath}) -> + logger.verbose('Should beautify on this save?') + buffer = editor.getBuffer() path ?= require('path') # Get Grammar grammar = editor.getGrammar().name @@ -492,14 +502,18 @@ handleSaveEvent = -> if beautifyOnSave posArray = getCursors(editor) origScrollTop = getScrollTop(editor) + logger.verbose('Beautifying file', filePath) beautifyFilePath(filePath, -> + logger.verbose('Done beautifying file', filePath) if editor.isAlive() is true + logger.verbose('Reloading TextEditor buffer...') buffer.reload() - logger.verbose('restore editor positions', posArray,origScrollTop) + logger.verbose('Reloaded TextEditor buffer.') # Let the scrollTop setting run after all the save related stuff is run, # otherwise setScrollTop is not working, probably because the cursor # addition happens asynchronously setTimeout ( -> + logger.verbose('restore editor positions', posArray,origScrollTop) setCursors(editor, posArray) setScrollTop(editor, origScrollTop) # console.log "setScrollTop" diff --git a/src/logger.coffee b/src/logger.coffee index d169092..0e2c75c 100644 --- a/src/logger.coffee +++ b/src/logger.coffee @@ -57,7 +57,8 @@ module.exports = do -> label = "#{path.dirname(transport.label)\ .split(path.sep).reverse()[0]}\ #{path.sep}#{path.basename(transport.label)}" - console.log("#{label} [#{level}]: #{msg}", meta) + d = new Date() + console.log("#{d.toLocaleDateString()} #{d.toLocaleTimeString()} - #{label} [#{level}]: #{msg}", meta) ) # Export logger methods loggerMethods = ['silly','debug','verbose','info','warn','error'] From 1e282de280be44063a64eb8356603d8f0297eaef Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sat, 16 Apr 2016 16:19:12 -0300 Subject: [PATCH 26/28] Prepare 0.29.3 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 454c0c1..e0fb7ea 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.29.2", + "version": "0.29.3", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, and SQL in Atom", "repository": { From c950557438e57dfa368c8d75d015605697f661b3 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sat, 16 Apr 2016 19:55:13 -0300 Subject: [PATCH 27/28] Change cross-spawn dependency to be optionalDependency Closes #573, #795, #922, #858, #925, #761, #902, #740. If cross-spawn fails to install, atom-beautify will still continue to install and work without it, with degraded support for Windows, such as ignoring PATHEXT. --- package.json | 4 +++- src/beautifiers/beautifier.coffee | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e0fb7ea..cbc40f9 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,6 @@ "coffee-fmt": "0.11.0", "coffee-formatter": "^0.1.2", "coffee-script": "^1.10.0", - "cross-spawn": "^2.0.0", "csscomb": "^3.1.7", "diff": "^2.1.0", "editorconfig": "^0.12.2", @@ -117,6 +116,9 @@ "winston": "^1.0.0", "yaml-front-matter": "^3.2.3" }, + "optionalDependencies": { + "cross-spawn": "^2.0.0" + }, "activationCommands": { "atom-workspace": [ "atom-beautify:help-debug-editor", diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index f3af8dc..62e887b 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -2,9 +2,14 @@ Promise = require("bluebird") _ = require('lodash') fs = require("fs") temp = require("temp").track() -spawn = require('cross-spawn') readFile = Promise.promisify(fs.readFile) which = require('which') +# Get optional dependency cross-spawn +spawn = null +try + spawn = require('cross-spawn') +catch err + spawn = require('child_process').spawn module.exports = class Beautifier From 6de115f8e6a4a3e527d6ec85d36a136a1dff67d4 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Sat, 16 Apr 2016 20:05:21 -0300 Subject: [PATCH 28/28] Prepare 0.29.4 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cbc40f9..cfbcb21 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.29.3", + "version": "0.29.4", "private": true, "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, and SQL in Atom", "repository": {