From 0044fab6255ea90888df9c42b57a3b2b6fdab2ed Mon Sep 17 00:00:00 2001 From: Christian Kjaer Laustsen Date: Sat, 28 Oct 2017 12:41:20 +0200 Subject: [PATCH] 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 + +
  • - \ 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 +}