diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..d537ddc --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,12 @@ +engines: + coffeelint: + enabled: true + eslint: + enabled: true + +ratings: + paths: + - "**.coffee" + - "**.js" + +exclude_paths: diff --git a/CHANGELOG.md b/CHANGELOG.md index 32ecf1d..2785100 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ # dev +- Add support for additional wrap attribute options of js-beautify (html): force-aligned and force-expand-multiline. - Update to `remark`'s new API and fix [#1196](https://github.com/Glavin001/atom-beautify/issues/1196) - Add beautifier for the Lua language. - Add [ocp-indent](https://github.com/OCamlPro/ocp-indent) beautifier for the OCaml language. - Add [elm-format](https://github.com/avh4/elm-format) beautifier for the Elm language. - Add [clang-format](http://clang.llvm.org/docs/ClangFormat.html) beautifier for C/C++/Obj-C languages. - Add [yapf](http://github.com/google/yapf) beautifier for Python. +- Add [ESLint](https://github.com/eslint/eslint) beautifier for Javascript - Closes [#776] (https://github.com/Glavin001/atom-beautify/issues/776) Add support for `collapse-preserve-inline` brace_style for javascript. - Closes [#786](https://github.com/Glavin001/atom-beautify/issues/786) YAPF configuration files are ignored. - Fix phpcbf hanging issue by closing stdin. See [#893](https://github.com/Glavin001/atom-beautify/issues/893) diff --git a/README-template.md b/README-template.md index 34f56a8..82bca17 100644 --- a/README-template.md +++ b/README-template.md @@ -20,6 +20,7 @@ ## Table of Contents - [Installation](#installation) +- [Beautifiers](#beautifiers) - [Language Support](#language-support) - [Usage](#usage) - [Selection of Code](#selection-of-code) @@ -54,6 +55,11 @@ 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). +## 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. + +{{beautifiers-info beautifiers}} ## Language Support diff --git a/README.md b/README.md index da87ff0..b0f2e9f 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ ## Table of Contents - [Installation](#installation) +- [Beautifiers](#beautifiers) - [Language Support](#language-support) - [Usage](#usage) - [Selection of Code](#selection-of-code) @@ -54,6 +55,56 @@ 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). +## 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. + +| Beautifier | Is Pre-Installed? | Installation Instructions | +| --- | --- | --- | +| autopep8 | :x: | Go to https://github.com/hhatto/autopep8 and follow the instructions. | +| beautysh | :x: | Go to https://github.com/bemeurer/beautysh and follow the instructions. | +| clang-format | :x: | Go to https://clang.llvm.org/docs/ClangFormat.html and follow the instructions. | +| cljfmt | :white_check_mark: | Nothing! | +| Coffee Formatter | :white_check_mark: | Nothing! | +| coffee-fmt | :white_check_mark: | Nothing! | +| Crystal | :x: | Go to http://crystal-lang.org and follow the instructions. | +| CSScomb | :white_check_mark: | Nothing! | +| dfmt | :x: | Go to https://github.com/Hackerpilot/dfmt and follow the instructions. | +| elm-format | :x: | Go to https://github.com/avh4/elm-format and follow the instructions. | +| erl_tidy | :x: | Go to http://erlang.org/doc/man/erl_tidy.html and follow the instructions. | +| ESLint Fixer | :white_check_mark: | Nothing! | +| formatR | :x: | Go to https://github.com/yihui/formatR and follow the instructions. | +| Fortran Beautifier | :x: | Go to https://www.gnu.org/software/emacs/ and follow the instructions. | +| Gherkin formatter | :white_check_mark: | Nothing! | +| gofmt | :x: | Go to https://golang.org/cmd/gofmt/ and follow the instructions. | +| hh_format | :x: | Go to http://hhvm.com/ and follow the instructions. | +| HTML Beautifier | :x: | Go to https://github.com/threedaymonk/htmlbeautifier and follow the instructions. | +| JS Beautify | :white_check_mark: | Nothing! | +| JSCS Fixer | :white_check_mark: | Nothing! | +| Latex Beautify | :x: | Go to https://github.com/cmhughes/latexindent.pl and follow the instructions. | +| Lua beautifier | :x: | Go to https://www.perl.org/ and follow the instructions. | +| Marko Beautifier | :white_check_mark: | Nothing! | +| Nginx Beautify | :x: | Go to https://github.com/denysvitali/nginxbeautify and follow the instructions. | +| ocp-indent | :x: | Go to https://www.typerex.org/ocp-indent.html and follow the instructions. | +| Perltidy | :x: | Go to http://perltidy.sourceforge.net/ and follow the instructions. | +| PHP-CS-Fixer | :x: | Go to https://github.com/FriendsOfPHP/PHP-CS-Fixer and follow the instructions. | +| PHPCBF | :x: | Go to http://php.net/manual/en/install.php and follow the instructions. | +| Pretty Diff | :white_check_mark: | Nothing! | +| Pug Beautify | :white_check_mark: | Nothing! | +| puppet-lint | :x: | Go to http://puppet-lint.com/ and follow the instructions. | +| pybeautifier | :x: | Go to https://github.com/guyskk/pybeautifier and follow the instructions. | +| Remark | :white_check_mark: | Nothing! | +| Rubocop | :x: | Go to https://github.com/bbatsov/rubocop and follow the instructions. | +| Ruby Beautify | :x: | Go to https://github.com/erniebrodeur/ruby-beautify and follow the instructions. | +| rustfmt | :x: | Go to https://github.com/nrc/rustfmt and follow the instructions. | +| SassConvert | :x: | Go to http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax and follow the instructions. | +| sqlformat | :x: | Go to https://github.com/andialbrecht/sqlparse and follow the instructions. | +| stylish-haskell | :x: | Go to https://github.com/jaspervdj/stylish-haskell and follow the instructions. | +| Tidy Markdown | :white_check_mark: | Nothing! | +| TypeScript Formatter | :white_check_mark: | Nothing! | +| Uncrustify | :x: | Go to https://github.com/uncrustify/uncrustify and follow the instructions. | +| Vue Beautifier | :white_check_mark: | Nothing! | +| yapf | :x: | Go to https://github.com/google/yapf and follow the instructions. | ## Language Support @@ -68,7 +119,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | Coldfusion | `html` |`.cfm`, `.cfml`, `.cfc` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Clojure | `Clojure` |`.clj`, `.cljs`, `.edn` | [`cljfmt`](https://github.com/snoe/node-cljfmt) (Default) | | CoffeeScript | `CoffeeScript` |`.coffee` | [`Coffee Formatter`](https://github.com/Glavin001/Coffee-Formatter), [`coffee-fmt`](https://github.com/sterpe/coffee-fmt) (Default) | -| C++ | `C++` |`.h`, `.hh`, `.cc`, `.cpp`, `.cxx`, `.C`, `.c++`, `.hpp`, `.hxx`, `.h++` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default), [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) | +| C++ | `C++` |`.h`, `.hh`, `.cc`, `.cpp`, `.cxx`, `.C`, `.cu`, `.c++`, `.hpp`, `.hxx`, `.h++`, `.cuh` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default), [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) | | Crystal | `Crystal` |`.cr` | [`Crystal`](http://crystal-lang.org) (Default) | | C# | `C#` |`.cs` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) | | CSS | `CSS` |`.css` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default), [`Pretty Diff`](https://github.com/prettydiff/prettydiff), [`SassConvert`](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) | @@ -78,24 +129,26 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | Elm | `Elm` |`.elm` | [`elm-format`](https://github.com/avh4/elm-format) (Default) | | ERB | `HTML (Ruby - ERB)`, `HTML (Rails)` |`.erb` | [`HTML Beautifier`](https://github.com/threedaymonk/htmlbeautifier), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Erlang | `Erlang` |`.erl` | [`erl_tidy`](http://erlang.org/doc/man/erl_tidy.html) (Default) | -| Fortran | `Fortran - Modern` |`.f90`, `.F90`, `.f95`, `.F95` | [`Fortran Beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/fortran-beautifier/emacs-fortran-formating-script.lisp) (Default) | +| Fortran | `Fortran - Modern` |`.f90`, `.F90`, `.f95`, `.F95` | [`Fortran Beautifier`](https://www.gnu.org/software/emacs/) (Default) | | gherkin | `Gherkin` |`.feature` | [`Gherkin formatter`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/gherkin.coffee) (Default) | | GLSL | `C`, `opencl`, `GLSL` |`.vert`, `.frag` | [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) (Default) | | Go | `Go` |`.go` | [`gofmt`](https://golang.org/cmd/gofmt/) (Default) | +| Golang Template | `HTML (Go)`, `Go Template` |`.gohtml` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Handlebars | `Handlebars`, `HTML (Handlebars)` |`.hbs`, `.handlebars` | [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | Haskell | `Haskell` |`.hs` | [`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell) (Default) | | HTML | `HTML` |`.html` | [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | Jade | `Jade`, `Pug` |`.jade`, `.pug` | [`Pug Beautify`](https://github.com/vingorius/pug-beautify) (Default) | | Java | `Java` |`.java` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) | -| JavaScript | `JavaScript` |`.js` | [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default), [`JSCS Fixer`](https://github.com/jscs-dev/node-jscs/), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | +| JavaScript | `JavaScript` |`.js` | [`ESLint Fixer`](https://github.com/eslint/eslint), [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default), [`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) (Default), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | JSX | `JSX`, `JavaScript (JSX)`, `Babel ES6 JavaScript`, `JavaScript with JSX` |`.jsx`, `.js` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | LaTeX | `LaTeX` |`.tex` | [`Latex Beautify`](https://github.com/cmhughes/latexindent.pl) (Default) | | LESS | `LESS` |`.less` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | -| Lua | `Lua` |`.lua` | [`Lua beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/lua-beautifier/beautifier.pl) (Default) | +| Lua | `Lua` |`.lua` | [`Lua beautifier`](https://www.perl.org/) (Default) | | Markdown | `GitHub Markdown` |`.markdown`, `.md` | [`Remark`](https://github.com/wooorm/remark), [`Tidy Markdown`](https://github.com/slang800/tidy-markdown) (Default) | | Marko | `Marko` |`.marko` | [`Marko Beautifier`](https://github.com/marko-js/marko-prettyprint) (Default) | -| Mustache | `HTML (Mustache)` |`.mustache` | [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default) | +| Mustache | `HTML (Mustache)` |`.mustache` | [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | +| Nginx | `nginx` |`.conf` | [`Nginx Beautify`](https://github.com/denysvitali/nginxbeautify) (Default) | | Nunjucks | `Nunjucks`, `Nunjucks Templates`, `HTML (Nunjucks Templates)` |`.njk`, `.nunjucks` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Objective-C | `Objective-C`, `Objective-C++` |`.m`, `.mm`, `.h` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default), [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) | | OCaml | `OCaml` |`.ml` | [`ocp-indent`](https://www.typerex.org/ocp-indent.html) (Default) | @@ -103,7 +156,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | Perl | `Perl`, `Perl 6` |`.pl` | [`Perltidy`](http://perltidy.sourceforge.net/) (Default) | | PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (Default), [`PHPCBF`](http://php.net/manual/en/install.php), [`hh_format`](http://hhvm.com/) | | Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) | -| Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) | +| Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`pybeautifier`](https://github.com/guyskk/pybeautifier), [`yapf`](https://github.com/google/yapf) | | R | `R` |`.r`, `.R` | [`formatR`](https://github.com/yihui/formatR) (Default) | | Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) | @@ -120,7 +173,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) (Default) | | Vala | `Vala` |`.vala`, `.vapi` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) | | Visualforce | `Visualforce` |`.page` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | -| Vue | `Vue Component` |`.vue` | `Vue Beautifier` (Default) | +| Vue | `Vue Component` |`.vue` | [`Vue Beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/vue-beautifier.coffee) (Default) | | XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP`, `GSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp`, `.gsp`, `.plist`, `.recipe` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | XTemplate | `XTemplate` |`.xtemplate` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | diff --git a/appveyor.yml b/appveyor.yml index 7debaf4..002bd1f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,6 +15,7 @@ environment: - PYTHON: "C:\\Python27" PYTHON_VERSION: "2.7.8" PYTHON_ARCH: "32" + RUBY_VERSION: 23 # - PYTHON: "C:\\Python27-x64" # PYTHON_VERSION: "2.7.8" @@ -82,8 +83,7 @@ install: - "%CMD_IN_ENV% pip install --upgrade sqlparse" # Ruby & Gem - - cinst ruby -y - - "SET PATH=C:\\tools\\ruby23\\bin;%PATH%" + - SET PATH=C:\Ruby%RUBY_VERSION%\bin;C:\Ruby23-x64\DevKit\mingw\bin;%PATH% # Rubocop - gem install rubocop - where rubocop @@ -104,9 +104,10 @@ install: # 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\\php\"" - - "SET PATH=C:\\tools\\php;%PATH%" + - 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 diff --git a/docs/index.coffee b/docs/index.coffee index 66b3247..80539b9 100755 --- a/docs/index.coffee +++ b/docs/index.coffee @@ -150,6 +150,31 @@ Handlebars.registerHelper('language-options-support', (languageOptions, options) return new Handlebars.SafeString(results) ) + +Handlebars.registerHelper('beautifiers-info', (beautifiers, options) -> + + ### + | Beautifier | Is Pre-Installed? | Installation Instructions | + | --- | ---- | + | Pretty Diff | :white_check_mark: | N/A | + | AutoPEP8 | :x: | LINK | + ### + + rows = _.map(beautifiers, (beautifier, k) -> + name = beautifier.name + isPreInstalled = beautifier.isPreInstalled + link = beautifier.link + installationInstructions = if isPreInstalled then "Nothing!" else "Go to #{link} and follow the instructions." + return "| #{name} | #{if isPreInstalled then ':white_check_mark:' else ':x:'} | #{installationInstructions} |" + ) + results = """ + | Beautifier | Is Pre-Installed? | Installation Instructions | + | --- | --- | --- | + #{rows.join('\n')} + """ + return new Handlebars.SafeString(results) +) + sortKeysBy = (obj, comparator) -> keys = _.sortBy(_.keys(obj), (key) -> return if comparator then comparator(obj[key], key) else key @@ -176,6 +201,7 @@ context = { packageOptions: sortSettings(packageOptions) languageOptions: sortSettings(languageOptions) beautifierOptions: sortSettings(beautifierOptions) + beautifiers: _.sortBy(beautifier.beautifiers, (beautifier) -> beautifier.name.toLowerCase()) } result = template(context) readmeResult = readmeTemplate(context) diff --git a/docs/options.md b/docs/options.md index 3893805..f304c88 100644 --- a/docs/options.md +++ b/docs/options.md @@ -124,6 +124,25 @@ Do not show "Unsupported Language" errors when they occur 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Mute Unsupported Language Errors*" and change it to your desired configuration. +##### [Show Loading View](#show-loading-view) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Default**: `true` + +**Type**: `boolean` + +**Description**: + +Show loading view when beautifying + +**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 "*Show Loading View*" and change it to your desired configuration. + ## Language Options @@ -2953,13 +2972,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -3743,6 +3762,183 @@ Automatically beautify Go 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. +#### [Golang Template](#golang-template) + +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) + +| Option | Pretty Diff | +| --- | --- | +| `disabled` | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | +| `indent_char` | :white_check_mark: | +| `indent_size` | :white_check_mark: | +| `preserve_newlines` | :white_check_mark: | +| `wrap_line_length` | :white_check_mark: | + +**Description**: + +Options for language Golang Template + +##### [Disable Beautifying Language](#disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable Golang Template 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**: `Pretty Diff` + +**Type**: `string` + +**Enum**: `Pretty Diff` + +**Description**: + +Default Beautifier to be used for Golang Template + +**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 Golang Template 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. + +##### [Indent char](#indent-char) + +**Namespace**: `html` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) + +**Description**: + +Indentation character (Supported by Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_char": " " + } +} +``` + +##### [Indent size](#indent-size) + +**Namespace**: `html` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) + +**Description**: + +Indentation size/length (Supported by Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_size": 4 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) + +**Description**: + +Preserve line-breaks (Supported by Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Wrap line length](#wrap-line-length) + +**Namespace**: `html` + +**Key**: `wrap_line_length` + +**Default**: `250` + +**Type**: `integer` + +**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) + +**Description**: + +Maximum characters per line (0 disables) (Supported by Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_line_length": 250 + } +} +``` + #### [Handlebars](#handlebars) **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) @@ -4168,13 +4364,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -4732,13 +4928,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -5021,33 +5217,32 @@ 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) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`JSCS Fixer`](#jscs-fixer) [`ESLint Fixer`](#eslint-fixer) [`Pretty Diff`](#pretty-diff) -| Option | JS Beautify | JSCS Fixer | 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: | +| 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_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: | **Description**: @@ -5078,7 +5273,7 @@ Disable JavaScript Beautification **Type**: `string` -**Enum**: `JS Beautify` `JSCS Fixer` `Pretty Diff` +**Enum**: `JS Beautify` `JSCS Fixer` `ESLint Fixer` `Pretty Diff` **Description**: @@ -6205,6 +6400,7 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre | `brace_style` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | | `end_of_line` | :white_check_mark: | :x: | +| `e4x` | :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: | @@ -6346,18 +6542,31 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr **Enum**: `CRLF` `LF` `System Default` +##### [E4x](#e4x) + +**Namespace**: `jsx` + +**Key**: `e4x` + +**Default**: `true` + +**Type**: `boolean` + **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: Override EOL from line-ending-selector (Supported by JS Beautify) +Support e4x/jsx syntax (Supported by JS Beautify) + **Example `.jsbeautifyrc` Configuration** ```json { "js": { "end_of_line": "System Default" + "e4x": true } } ``` @@ -8093,13 +8302,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by M **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) **Description**: -Wrap attributes to new lines [auto|force] (Supported by Marko Beautifier) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Marko Beautifier) **Example `.jsbeautifyrc` Configuration** @@ -8165,26 +8374,26 @@ Maximum characters per line (0 disables) (Supported by Marko Beautifier) #### [Mustache](#mustache) -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) -| Option | JS Beautify | -| --- | --- | -| `disabled` | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | -| `brace_style` | :white_check_mark: | -| `end_with_newline` | :white_check_mark: | -| `extra_liners` | :white_check_mark: | -| `indent_char` | :white_check_mark: | -| `indent_inner_html` | :white_check_mark: | -| `indent_scripts` | :white_check_mark: | -| `indent_size` | :white_check_mark: | -| `max_preserve_newlines` | :white_check_mark: | -| `preserve_newlines` | :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 | 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: | +| `end_with_newline` | :white_check_mark: | :x: | +| `extra_liners` | :white_check_mark: | :x: | +| `indent_char` | :white_check_mark: | :white_check_mark: | +| `indent_inner_html` | :white_check_mark: | :x: | +| `indent_scripts` | :white_check_mark: | :x: | +| `indent_size` | :white_check_mark: | :white_check_mark: | +| `max_preserve_newlines` | :white_check_mark: | :x: | +| `preserve_newlines` | :white_check_mark: | :white_check_mark: | +| `unformatted` | :white_check_mark: | :x: | +| `wrap_attributes` | :white_check_mark: | :x: | +| `wrap_attributes_indent_size` | :white_check_mark: | :x: | +| `wrap_line_length` | :white_check_mark: | :white_check_mark: | **Description**: @@ -8215,7 +8424,7 @@ Disable Mustache Beautification **Type**: `string` -**Enum**: `JS Beautify` +**Enum**: `JS Beautify` `Pretty Diff` **Description**: @@ -8337,11 +8546,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** @@ -8415,11 +8624,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** @@ -8467,11 +8676,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** @@ -8586,13 +8795,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -8640,11 +8849,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** @@ -8656,6 +8865,181 @@ Maximum characters per line (0 disables) (Supported by JS Beautify) } ``` +#### [Nginx](#nginx) + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +| Option | Nginx Beautify | +| --- | --- | +| `disabled` | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | +| `dontJoinCurlyBracet` | :white_check_mark: | +| `indent_char` | :white_check_mark: | +| `indent_size` | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | + +**Description**: + +Options for language Nginx + +##### [Disable Beautifying Language](#disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable Nginx 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**: `Nginx Beautify` + +**Type**: `string` + +**Enum**: `Nginx Beautify` + +**Description**: + +Default Beautifier to be used for Nginx + +**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 Nginx 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. + +##### [Don't join curly brackets](#don't-join-curly-brackets) + +**Namespace**: `nginx` + +**Key**: `dontJoinCurlyBracet` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +**Description**: + +undefined (Supported by Nginx Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "nginx": { + "dontJoinCurlyBracet": true + } +} +``` + +##### [Indent char](#indent-char) + +**Namespace**: `nginx` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +**Description**: + +Indentation character (Supported by Nginx Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "nginx": { + "indent_char": " " + } +} +``` + +##### [Indent size](#indent-size) + +**Namespace**: `nginx` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +**Description**: + +Indentation size/length (Supported by Nginx Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "nginx": { + "indent_size": 4 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `nginx` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Nginx Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "nginx": { + "indent_with_tabs": false + } +} +``` + #### [Nunjucks](#nunjucks) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -9194,9 +9578,8 @@ Specify a configuration file which will override the default name of .perltidyrc | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `cs_fixer_path` | :white_check_mark: | :x: | :x: | -| `fixers` | :white_check_mark: | :x: | :x: | -| `level` | :white_check_mark: | :x: | :x: | | `phpcbf_path` | :white_check_mark: | :x: | :x: | +| `rules` | :white_check_mark: | :x: | :x: | | `standard` | :white_check_mark: | :white_check_mark: | :x: | **Description**: @@ -9270,7 +9653,7 @@ Automatically beautify PHP files on save **Description**: -Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer) +Absolute path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer) **Example `.jsbeautifyrc` Configuration** @@ -9282,54 +9665,6 @@ Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer) } ``` -##### [Fixers](#fixers) - -**Namespace**: `php` - -**Key**: `fixers` - -**Type**: `string` - -**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) - -**Description**: - -Add fixer(s). i.e. linefeed,-short_tag,indentation (Supported by PHP-CS-Fixer) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "php": { - "fixers": "" - } -} -``` - -##### [Level](#level) - -**Namespace**: `php` - -**Key**: `level` - -**Type**: `string` - -**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) - -**Description**: - -By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP-CS-Fixer) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "php": { - "level": "" - } -} -``` - ##### [PHPCBF Path](#phpcbf-path) **Namespace**: `php` @@ -9354,6 +9689,30 @@ Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer) } ``` +##### [Rules](#rules) + +**Namespace**: `php` + +**Key**: `rules` + +**Type**: `string` + +**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) + +**Description**: + +Add rule(s). i.e. line_ending,-full_opening_tag,@PSR2 (Supported by PHP-CS-Fixer) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "php": { + "rules": "" + } +} +``` + ##### [PHPCBF Standard](#phpcbf-standard) **Namespace**: `php` @@ -9366,7 +9725,7 @@ Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer) **Description**: -Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules (Supported by PHP-CS-Fixer, PHPCBF) +Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules. Will use local `phpcs.xml`, `phpcs.xml.dist`, `phpcs.ruleset.xml` or `ruleset.xml` if found in the project root. (Supported by PHP-CS-Fixer, PHPCBF) **Example `.jsbeautifyrc` Configuration** @@ -9449,17 +9808,20 @@ Automatically beautify Puppet files on save #### [Python](#python) -**Supported Beautifiers**: [`autopep8`](#autopep8) [`yapf`](#yapf) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) [`yapf`](#yapf) -| Option | autopep8 | yapf | -| --- | --- | --- | -| `disabled` | :white_check_mark: | :white_check_mark: | -| `default_beautifier` | :white_check_mark: | :white_check_mark: | -| `beautify_on_save` | :white_check_mark: | :white_check_mark: | -| `ignore` | :white_check_mark: | :x: | -| `indent_size` | :white_check_mark: | :x: | -| `max_line_length` | :white_check_mark: | :x: | -| `sort_imports` | :white_check_mark: | :x: | +| Option | autopep8 | pybeautifier | yapf | +| --- | --- | --- | --- | +| `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: | +| `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: | +| `multi_line_output` | :white_check_mark: | :white_check_mark: | :x: | +| `sort_imports` | :white_check_mark: | :white_check_mark: | :x: | +| `style_config` | :white_check_mark: | :white_check_mark: | :x: | **Description**: @@ -9490,7 +9852,7 @@ Disable Python Beautification **Type**: `string` -**Enum**: `autopep8` `yapf` +**Enum**: `autopep8` `pybeautifier` `yapf` **Description**: @@ -9520,6 +9882,34 @@ 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) + +**Namespace**: `python` + +**Key**: `formater` + +**Default**: `autopep8` + +**Type**: `string` + +**Enum**: `autopep8` `yapf` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +formater used by pybeautifier (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "formater": "autopep8" + } +} +``` + ##### [Ignore](#ignore) **Namespace**: `python` @@ -9530,11 +9920,11 @@ Automatically beautify Python files on save **Type**: `array` -**Supported Beautifiers**: [`autopep8`](#autopep8) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) **Description**: -do not fix these errors/warnings (Supported by autopep8) +do not fix these errors/warnings (Supported by autopep8, pybeautifier) **Example `.jsbeautifyrc` Configuration** @@ -9558,11 +9948,11 @@ do not fix these errors/warnings (Supported by autopep8) **Type**: `integer` -**Supported Beautifiers**: [`autopep8`](#autopep8) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) **Description**: -Indentation size/length (Supported by autopep8) +Indentation size/length (Supported by autopep8, pybeautifier) **Example `.jsbeautifyrc` Configuration** @@ -9584,11 +9974,11 @@ Indentation size/length (Supported by autopep8) **Type**: `integer` -**Supported Beautifiers**: [`autopep8`](#autopep8) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) **Description**: -set maximum allowed line length (Supported by autopep8) +set maximum allowed line length (Supported by autopep8, pybeautifier) **Example `.jsbeautifyrc` Configuration** @@ -9600,6 +9990,34 @@ set maximum allowed line length (Supported by autopep8) } ``` +##### [Multi line output](#multi-line-output) + +**Namespace**: `python` + +**Key**: `multi_line_output` + +**Default**: `Hanging Grid Grouped` + +**Type**: `string` + +**Enum**: `Grid` `Vertical` `Hanging Indent` `Vertical Hanging Indent` `Hanging Grid` `Hanging Grid Grouped` `NOQA` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +defines how from imports wrap (requires isort installed) (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "multi_line_output": "Hanging Grid Grouped" + } +} +``` + ##### [Sort imports](#sort-imports) **Namespace**: `python` @@ -9608,11 +10026,11 @@ set maximum allowed line length (Supported by autopep8) **Type**: `boolean` -**Supported Beautifiers**: [`autopep8`](#autopep8) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) **Description**: -sort imports (requires isort installed) (Supported by autopep8) +sort imports (requires isort installed) (Supported by autopep8, pybeautifier) **Example `.jsbeautifyrc` Configuration** @@ -9624,6 +10042,32 @@ sort imports (requires isort installed) (Supported by autopep8) } ``` +##### [Style config](#style-config) + +**Namespace**: `python` + +**Key**: `style_config` + +**Default**: `pep8` + +**Type**: `string` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +formatting style used by yapf (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "style_config": "pep8" + } +} +``` + #### [R](#r) **Supported Beautifiers**: [`formatR`](#formatr) @@ -13704,13 +14148,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by V **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) **Description**: -Wrap attributes to new lines [auto|force] (Supported by Vue Beautifier) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) **Example `.jsbeautifyrc` Configuration** @@ -14199,13 +14643,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -15758,13 +16202,13 @@ Indent and sections. (Supported by JS Beautify) **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force] (Supported by JS Beautify) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -15927,6 +16371,32 @@ List of tags (defaults to [head,body,/html] that should have an extra newline be } ``` +##### [E4x](#e4x) + +**Namespace**: `jsx` + +**Key**: `e4x` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Support e4x/jsx syntax (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "jsx": { + "e4x": true + } +} +``` + ### Latex Beautify @@ -16310,13 +16780,13 @@ Maximum characters per line (0 disables) (Supported by Marko Beautifier) **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) **Description**: -Wrap attributes to new lines [auto|force] (Supported by Marko Beautifier) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Marko Beautifier) **Example `.jsbeautifyrc` Configuration** @@ -16556,6 +17026,111 @@ List of tags (defaults to [head,body,/html] that should have an extra newline be ``` +### Nginx Beautify + +##### [Indent size](#indent-size) + +**Namespace**: `nginx` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +**Description**: + +Indentation size/length (Supported by Nginx Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "nginx": { + "indent_size": 4 + } +} +``` + +##### [Indent char](#indent-char) + +**Namespace**: `nginx` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +**Description**: + +Indentation character (Supported by Nginx Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "nginx": { + "indent_char": " " + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `nginx` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Nginx Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "nginx": { + "indent_with_tabs": false + } +} +``` + +##### [Don't join curly brackets](#don't-join-curly-brackets) + +**Namespace**: `nginx` + +**Key**: `dontJoinCurlyBracet` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Nginx Beautify`](#nginx-beautify) + +**Description**: + +undefined (Supported by Nginx Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "nginx": { + "dontJoinCurlyBracet": true + } +} +``` + + ### PHP-CS-Fixer ##### [PHP-CS-Fixer Path](#php-cs-fixer-path) @@ -16570,7 +17145,7 @@ List of tags (defaults to [head,body,/html] that should have an extra newline be **Description**: -Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer) +Absolute path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer) **Example `.jsbeautifyrc` Configuration** @@ -16582,11 +17157,11 @@ Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer) } ``` -##### [Fixers](#fixers) +##### [Rules](#rules) **Namespace**: `php` -**Key**: `fixers` +**Key**: `rules` **Type**: `string` @@ -16594,38 +17169,14 @@ Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer) **Description**: -Add fixer(s). i.e. linefeed,-short_tag,indentation (Supported by PHP-CS-Fixer) +Add rule(s). i.e. line_ending,-full_opening_tag,@PSR2 (Supported by PHP-CS-Fixer) **Example `.jsbeautifyrc` Configuration** ```json { "php": { - "fixers": "" - } -} -``` - -##### [Level](#level) - -**Namespace**: `php` - -**Key**: `level` - -**Type**: `string` - -**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) - -**Description**: - -By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP-CS-Fixer) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "php": { - "level": "" + "rules": "" } } ``` @@ -16666,7 +17217,7 @@ Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer) **Description**: -Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules (Supported by PHP-CS-Fixer, PHPCBF) +Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules. Will use local `phpcs.xml`, `phpcs.xml.dist`, `phpcs.ruleset.xml` or `ruleset.xml` if found in the project root. (Supported by PHP-CS-Fixer, PHPCBF) **Example `.jsbeautifyrc` Configuration** @@ -16693,7 +17244,7 @@ Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS ru **Description**: -Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules (Supported by PHP-CS-Fixer, PHPCBF) +Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules. Will use local `phpcs.xml`, `phpcs.xml.dist`, `phpcs.ruleset.xml` or `ruleset.xml` if found in the project root. (Supported by PHP-CS-Fixer, PHPCBF) **Example `.jsbeautifyrc` Configuration** @@ -18448,13 +18999,13 @@ Indent and sections. (Supported by Vue Beautifier) **Type**: `string` -**Enum**: `auto` `force` +**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) **Description**: -Wrap attributes to new lines [auto|force] (Supported by Vue Beautifier) +Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) **Example `.jsbeautifyrc` Configuration** @@ -18630,11 +19181,11 @@ List of tags (defaults to [head,body,/html] that should have an extra newline be **Type**: `integer` -**Supported Beautifiers**: [`autopep8`](#autopep8) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) **Description**: -set maximum allowed line length (Supported by autopep8) +set maximum allowed line length (Supported by autopep8, pybeautifier) **Example `.jsbeautifyrc` Configuration** @@ -18656,11 +19207,11 @@ set maximum allowed line length (Supported by autopep8) **Type**: `integer` -**Supported Beautifiers**: [`autopep8`](#autopep8) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) **Description**: -Indentation size/length (Supported by autopep8) +Indentation size/length (Supported by autopep8, pybeautifier) **Example `.jsbeautifyrc` Configuration** @@ -18682,11 +19233,11 @@ Indentation size/length (Supported by autopep8) **Type**: `array` -**Supported Beautifiers**: [`autopep8`](#autopep8) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) **Description**: -do not fix these errors/warnings (Supported by autopep8) +do not fix these errors/warnings (Supported by autopep8, pybeautifier) **Example `.jsbeautifyrc` Configuration** @@ -18700,6 +19251,60 @@ do not fix these errors/warnings (Supported by autopep8) } ``` +##### [Formater](#formater) + +**Namespace**: `python` + +**Key**: `formater` + +**Default**: `autopep8` + +**Type**: `string` + +**Enum**: `autopep8` `yapf` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +formater used by pybeautifier (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "formater": "autopep8" + } +} +``` + +##### [Style config](#style-config) + +**Namespace**: `python` + +**Key**: `style_config` + +**Default**: `pep8` + +**Type**: `string` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +formatting style used by yapf (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "style_config": "pep8" + } +} +``` + ##### [Sort imports](#sort-imports) **Namespace**: `python` @@ -18708,11 +19313,11 @@ do not fix these errors/warnings (Supported by autopep8) **Type**: `boolean` -**Supported Beautifiers**: [`autopep8`](#autopep8) +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) **Description**: -sort imports (requires isort installed) (Supported by autopep8) +sort imports (requires isort installed) (Supported by autopep8, pybeautifier) **Example `.jsbeautifyrc` Configuration** @@ -18724,6 +19329,34 @@ sort imports (requires isort installed) (Supported by autopep8) } ``` +##### [Multi line output](#multi-line-output) + +**Namespace**: `python` + +**Key**: `multi_line_output` + +**Default**: `Hanging Grid Grouped` + +**Type**: `string` + +**Enum**: `Grid` `Vertical` `Hanging Indent` `Vertical Hanging Indent` `Hanging Grid` `Hanging Grid Grouped` `NOQA` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +defines how from imports wrap (requires isort installed) (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "multi_line_output": "Hanging Grid Grouped" + } +} +``` + ### beautysh @@ -18889,6 +19522,195 @@ Indentation size/length (Supported by formatR) ``` +### pybeautifier + +##### [Max line length](#max-line-length) + +**Namespace**: `python` + +**Key**: `max_line_length` + +**Default**: `79` + +**Type**: `integer` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +set maximum allowed line length (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "max_line_length": 79 + } +} +``` + +##### [Indent size](#indent-size) + +**Namespace**: `python` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +Indentation size/length (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "indent_size": 4 + } +} +``` + +##### [Ignore](#ignore) + +**Namespace**: `python` + +**Key**: `ignore` + +**Default**: `E24` + +**Type**: `array` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +do not fix these errors/warnings (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "ignore": [ + "E24" + ] + } +} +``` + +##### [Formater](#formater) + +**Namespace**: `python` + +**Key**: `formater` + +**Default**: `autopep8` + +**Type**: `string` + +**Enum**: `autopep8` `yapf` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +formater used by pybeautifier (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "formater": "autopep8" + } +} +``` + +##### [Style config](#style-config) + +**Namespace**: `python` + +**Key**: `style_config` + +**Default**: `pep8` + +**Type**: `string` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +formatting style used by yapf (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "style_config": "pep8" + } +} +``` + +##### [Sort imports](#sort-imports) + +**Namespace**: `python` + +**Key**: `sort_imports` + +**Type**: `boolean` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +sort imports (requires isort installed) (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "sort_imports": false + } +} +``` + +##### [Multi line output](#multi-line-output) + +**Namespace**: `python` + +**Key**: `multi_line_output` + +**Default**: `Hanging Grid Grouped` + +**Type**: `string` + +**Enum**: `Grid` `Vertical` `Hanging Indent` `Vertical Hanging Indent` `Hanging Grid` `Hanging Grid Grouped` `NOQA` + +**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) + +**Description**: + +defines how from imports wrap (requires isort installed) (Supported by autopep8, pybeautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "python": { + "multi_line_output": "Hanging Grid Grouped" + } +} +``` + + ### rustfmt ##### [Rustfmt path](#rustfmt-path) diff --git a/examples/nested-jsbeautifyrc/nginx/expected/nginx.conf b/examples/nested-jsbeautifyrc/nginx/expected/nginx.conf new file mode 100644 index 0000000..287f07e --- /dev/null +++ b/examples/nested-jsbeautifyrc/nginx/expected/nginx.conf @@ -0,0 +1,203 @@ + +#user html; +worker_processes 1; + +#error_log logs/error.log; +#error_log logs/error.log notice; +error_log logs/error.log info; + +#pid logs/nginx.pid; + +events +{ + worker_connections 1024; +} + + +http +{ + include mime.types; + default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' + # '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + #gzip on; + + server + { + listen 80; + server_name localhost; + + #charset koi8-r; + + #access_log logs/host.access.log main; + location / + { + root /usr/share/nginx/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html + { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} + } + + + server + { + listen 80; + include mime.types; + server_name dv; + location /nginxstatic/ + { + alias /srv/http/dv/; + limit_rate 250k; + } + + location / + { + #root /srv/http/dv/; + #index index.html; + limit_rate 1M; + #limit_conn addr 1; + proxy_pass http://localhost:3000/; + } + } + + server + { + listen 80; + server_name ip.dv; + root /home/http/ip/; + include mime.types; + location / + { + try_files $uri $uri/ /index.php; + } + location ~ .php$ + { + try_files $uri =404; + fastcgi_pass unix:/var/run/php5-fpm/socket_name.socket; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + } + + server + { + listen 80; + server_name pma.dv; + location / + { + root /home/http/pma/; + index index.php; + } + + location ~ \.php$ + { + fastcgi_pass unix:/run/php-fpm/php-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME /home/http/pma/$fastcgi_script_name; + include fastcgi_params; + } + } + server + { + listen 80; + server_name swissecurity.coelis; + location / + { + root /srv/http/swissecurity-fm/; + index index.html; + } + } + + server + { + listen 80; + server_name p1.dv; + location / + { + proxy_pass http://127.0.0.1:1337/; + } + } + + + server + { + listen 80; + server_name s.dev; + location / + { + proxy_pass http://127.0.0.1:1337/; + } + } + + + # another virtual host using mix of IP-, name-, and port-based configuration + # + #server { + # listen 8000; + # listen somename:8080; + # server_name somename alias another.alias; + # location / { + # root html; + # index index.html index.htm; + # } + #} + # HTTPS server + # + #server { + # listen 443 ssl; + # server_name localhost; + # ssl_certificate cert.pem; + # ssl_certificate_key cert.key; + # ssl_session_cache shared:SSL:1m; + # ssl_session_timeout 5m; + # ssl_ciphers HIGH:!aNULL:!MD5; + # ssl_prefer_server_ciphers on; + # location / { + # root html; + # index index.html index.htm; + # } + #} +} diff --git a/examples/nested-jsbeautifyrc/nginx/original/nginx.conf b/examples/nested-jsbeautifyrc/nginx/original/nginx.conf new file mode 100644 index 0000000..42475dc --- /dev/null +++ b/examples/nested-jsbeautifyrc/nginx/original/nginx.conf @@ -0,0 +1,194 @@ + +#user html; +worker_processes 1; + +#error_log logs/error.log; +#error_log logs/error.log notice; +error_log logs/error.log info; + +#pid logs/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include mime.types; + default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' + # '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + #gzip on; + + server { + listen 80; + server_name localhost; + + #charset koi8-r; + + #access_log logs/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} + } + + + server { + listen 80; + include mime.types; + server_name dv; + location /nginxstatic/ { + alias /srv/http/dv/; + limit_rate 250k; + } + + location / { + #root /srv/http/dv/; + #index index.html; + limit_rate 1M; + #limit_conn addr 1; + proxy_pass http://localhost:3000/; + } + } + + server { + listen 80; + server_name ip.dv; + root /home/http/ip/; + include mime.types; + location / { + try_files $uri $uri/ /index.php; + } + location ~ .php$ { + try_files $uri =404; + fastcgi_pass unix:/var/run/php5-fpm/socket_name.socket; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + } + + server { + listen 80; + server_name pma.dv; + location / { + root /home/http/pma/; + index index.php; + } + + location ~ \.php$ { + fastcgi_pass unix:/run/php-fpm/php-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME /home/http/pma/$fastcgi_script_name; + include fastcgi_params; + } + } + server { + listen 80; + server_name swissecurity.coelis; + location / { + root /srv/http/swissecurity-fm/; + index index.html; + } + } + + server { + listen 80; + server_name p1.dv; + location / { + proxy_pass http://127.0.0.1:1337/; + } + } + + + server { listen 80; + server_name s.dev; + location / { + proxy_pass http://127.0.0.1:1337/; + } + } + + + # another virtual host using mix of IP-, name-, and port-based configuration + # + #server { + # listen 8000; + # listen somename:8080; + # server_name somename alias another.alias; + + # location / { + # root html; + # index index.html index.htm; + # } + #} + + + # HTTPS server + # + #server { + # listen 443 ssl; + # server_name localhost; + + # ssl_certificate cert.pem; + # ssl_certificate_key cert.key; + + # ssl_session_cache shared:SSL:1m; + # ssl_session_timeout 5m; + + # ssl_ciphers HIGH:!aNULL:!MD5; + # ssl_prefer_server_ciphers on; + + # location / { + # root html; + # index index.html index.htm; + # } + #} + +} diff --git a/examples/simple-jsbeautifyrc/lua/expected/test.lua b/examples/simple-jsbeautifyrc/lua/expected/test.lua index 5c00e55..878d1c1 100644 --- a/examples/simple-jsbeautifyrc/lua/expected/test.lua +++ b/examples/simple-jsbeautifyrc/lua/expected/test.lua @@ -1,5 +1,34 @@ -- Ensure that that the element at i is in the right position, -- and return a closure which can be used for continuing the sort. +local a = 'a b c' +local b = '12345678' +local c = 'a b c' + 'a b c' +local t = { + a = 1, + b = 2, + c = 3, +} +if a ~= 'a' then + local b = a +end +local e = {a = 1, b = 2} +function aaa(a, b, c) + + -- comment 1 + -- comment 2 1231 + -- comment 1 123 123 123123 12 + -- [[ comment 1 ]] + --[[ + muli comments + ssss + @asdasd sad + ]] + local a = -1 + return a + b - c +end +local b = {a = 1, b = [[this is two space ; + ]], c = 2} + function quicksorter(i, vec, low, high) if low >= high then return quicksorter @@ -11,10 +40,10 @@ function quicksorter(i, vec, low, high) -- Create the promise local function self(i, vec, low, high) if i < middle then - left = left(i, vec, low, middle-1) + left = left(i, vec, low, middle - 1) return self elseif i > middle then - right = right(i, vec, middle+1, high) + right = right(i, vec, middle + 1, high) return self end end diff --git a/examples/simple-jsbeautifyrc/lua/original/test.lua b/examples/simple-jsbeautifyrc/lua/original/test.lua index 753deb3..fed0705 100644 --- a/examples/simple-jsbeautifyrc/lua/original/test.lua +++ b/examples/simple-jsbeautifyrc/lua/original/test.lua @@ -1,5 +1,34 @@ -- Ensure that that the element at i is in the right position, -- and return a closure which can be used for continuing the sort. +local a= 'a b c' +local b ='12345678' +local c = 'a b c' +'a b c' +local t = { +a = 1, + b =2 , + c= 3, +} +if a~='a' then +local b=a +end +local e={a=1,b=2} +function aaa(a,b,c) + +-- comment 1 + -- comment 2 1231 + -- comment 1 123 123 123123 12 +-- [[ comment 1 ]] + --[[ + muli comments + ssss + @asdasd sad + ]] +local a = -1 +return a+b-c +end +local b = {a=1,b=[[this is two space ; + ]],c=2} + function quicksorter(i, vec, low, high) if low >= high then return quicksorter @@ -18,7 +47,7 @@ right = right(i, vec, middle+1, high) return self end end - + -- Force the promise until i is in the right position return self(i, vec, low, high) end diff --git a/package.json b/package.json index a9f5bad..1935066 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom-beautify", "main": "./src/beautify", - "version": "0.29.16", + "version": "0.29.19", "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": { @@ -114,6 +114,26 @@ { "name": "Victor Uriarte", "url": "https://github.com/vmuriart" + }, + { + "name": "guyskk", + "url": "https://github.com/guyskk" + }, + { + "name": "Denys Vitali", + "url": "https://github.com/denysvitali" + }, + { + "name": "Daniel Brodin", + "url": "https://github.com/danielbrodin" + }, + { + "name": "Anton Brok-Volchansky", + "url": "https://github.com/re6exp" + }, + { + "name": "Taylon Silmer", + "url": "https://github.com/taylon" } ], "engines": { @@ -130,6 +150,7 @@ "csscomb": "^3.1.7", "diff": "3.0.0", "editorconfig": "^0.13.2", + "eslint": "^3.13.1", "event-kit": "^2.1.0", "expand-home-dir": "0.0.3", "extend": "^3.0.0", @@ -140,6 +161,7 @@ "lodash": "^4.14.2", "loophole": "^1.0.0", "marko-prettyprint": "^1.2.0", + "nginxbeautify": "^2.0.0", "node-dir": "^0.1.16", "node-cljfmt": "^0.5.3-1", "node-uuid": "^1.4.3", @@ -151,7 +173,7 @@ "space-pen": "^5.1.1", "strip-json-comments": "^2.0.1", "temp": "^0.8.3", - "tidy-markdown": "^2.0.3", + "tidy-markdown": "2.0.3", "typescript": "^1.8.10", "typescript-formatter": "^2.3.0", "underscore-plus": "^1.6.6", @@ -259,6 +281,8 @@ "fortran beautifier", "js beautify", "jscs fixer", + "eslint", + "eslint fixer", "lua beautifier", "ocp-indent", "perltidy", @@ -287,11 +311,15 @@ "clojure beautifier", "nunjucks", "ux markup", + "pybeautifier", "cljfmt", "bash", "beautysh", "glsl", - "hh_format" + "hh_format", + "nginx", + "nginx beautify", + "golang template" ], "devDependencies": { "coffeelint": "^1.10.1", diff --git a/script/build-options.js b/script/build-options.js index a0d3d6c..526e0d8 100644 --- a/script/build-options.js +++ b/script/build-options.js @@ -215,7 +215,7 @@ buildOptionsForBeautifiers = function(beautifiers, allLanguages) { if (_.isArray(objValue)) { return _.uniq(objValue.concat(srcValue)); } - } + } for (j = 0, len1 = allLanguages.length; j < len1; j++) { lang = allLanguages[j]; namespaceDest = lang.namespace; diff --git a/src/beautifiers/autopep8.coffee b/src/beautifiers/autopep8.coffee index 3f4b546..e38a648 100644 --- a/src/beautifiers/autopep8.coffee +++ b/src/beautifiers/autopep8.coffee @@ -9,6 +9,7 @@ module.exports = class Autopep8 extends Beautifier name: "autopep8" link: "https://github.com/hhatto/autopep8" + isPreInstalled: false options: { Python: true @@ -26,8 +27,12 @@ module.exports = class Autopep8 extends Beautifier }) .then(=> if options.sort_imports + editor = atom.workspace.getActiveTextEditor() + filePath = editor.getPath() + projectPath = atom.project.relativizePath(filePath)[0] + @run("isort", - [tempFile], + ["-sp", projectPath, tempFile], help: { link: "https://github.com/timothycrosley/isort" }) diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index d42253d..5d326a3 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -31,6 +31,11 @@ module.exports = class Beautifier ### options: {} + ### + Is the beautifier a command-line interface beautifier? + ### + isPreInstalled: true + ### Supported languages by this Beautifier diff --git a/src/beautifiers/beautysh.coffee b/src/beautifiers/beautysh.coffee index 62a22da..86626a3 100644 --- a/src/beautifiers/beautysh.coffee +++ b/src/beautifiers/beautysh.coffee @@ -4,6 +4,8 @@ Beautifier = require('./beautifier') module.exports = class BashBeautify extends Beautifier name: "beautysh" link: "https://github.com/bemeurer/beautysh" + isPreInstalled: false + options: { Bash: indent_size: true diff --git a/src/beautifiers/clang-format.coffee b/src/beautifiers/clang-format.coffee index 5fa9481..eb4fa32 100644 --- a/src/beautifiers/clang-format.coffee +++ b/src/beautifiers/clang-format.coffee @@ -11,6 +11,7 @@ module.exports = class ClangFormat extends Beautifier name: "clang-format" link: "https://clang.llvm.org/docs/ClangFormat.html" + isPreInstalled: false options: { "C++": false diff --git a/src/beautifiers/crystal.coffee b/src/beautifiers/crystal.coffee index 04c496c..cb1ad22 100644 --- a/src/beautifiers/crystal.coffee +++ b/src/beautifiers/crystal.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class Crystal extends Beautifier name: "Crystal" link: "http://crystal-lang.org" + isPreInstalled: false options: { Crystal: false diff --git a/src/beautifiers/dfmt.coffee b/src/beautifiers/dfmt.coffee index f77460b..0accd86 100644 --- a/src/beautifiers/dfmt.coffee +++ b/src/beautifiers/dfmt.coffee @@ -7,6 +7,7 @@ Beautifier = require('./beautifier') module.exports = class Dfmt extends Beautifier name: "dfmt" link: "https://github.com/Hackerpilot/dfmt" + isPreInstalled: false options: { D: false diff --git a/src/beautifiers/elm-format.coffee b/src/beautifiers/elm-format.coffee index 0623a79..af91cf5 100644 --- a/src/beautifiers/elm-format.coffee +++ b/src/beautifiers/elm-format.coffee @@ -7,6 +7,7 @@ Beautifier = require('./beautifier') module.exports = class ElmFormat extends Beautifier name: "elm-format" link: "https://github.com/avh4/elm-format" + isPreInstalled: false options: { Elm: true diff --git a/src/beautifiers/erl_tidy.coffee b/src/beautifiers/erl_tidy.coffee index a4d0bcd..c8e89ee 100644 --- a/src/beautifiers/erl_tidy.coffee +++ b/src/beautifiers/erl_tidy.coffee @@ -9,6 +9,7 @@ module.exports = class ErlTidy extends Beautifier name: "erl_tidy" link: "http://erlang.org/doc/man/erl_tidy.html" + isPreInstalled: false options: { Erlang: true diff --git a/src/beautifiers/eslint.coffee b/src/beautifiers/eslint.coffee new file mode 100644 index 0000000..2f9947d --- /dev/null +++ b/src/beautifiers/eslint.coffee @@ -0,0 +1,33 @@ +"use strict" + +Beautifier = require('./beautifier') +Path = require('path') +{allowUnsafeNewFunction} = require 'loophole' + +module.exports = class ESLintFixer extends Beautifier + name: "ESLint Fixer" + link: "https://github.com/eslint/eslint" + + options: { + JavaScript: false + } + + beautify: (text, language, options) -> + return new @Promise((resolve, reject) -> + editor = atom.workspace.getActiveTextEditor() + filePath = editor.getPath() + projectPath = atom.project.relativizePath(filePath)[0] + + result = null + allowUnsafeNewFunction -> + importPath = Path.join(projectPath, 'node_modules', 'eslint') + try + CLIEngine = require(importPath).CLIEngine + + cli = new CLIEngine(fix: true, cwd: projectPath) + result = cli.executeOnText(text).results[0] + + resolve result.output + catch err + reject(err) + ) diff --git a/src/beautifiers/formatR/index.coffee b/src/beautifiers/formatR/index.coffee index 7bfcee3..bf0e8f5 100644 --- a/src/beautifiers/formatR/index.coffee +++ b/src/beautifiers/formatR/index.coffee @@ -9,6 +9,7 @@ Beautifier = require('../beautifier') module.exports = class R extends Beautifier name: "formatR" link: "https://github.com/yihui/formatR" + isPreInstalled: false options: { R: true diff --git a/src/beautifiers/fortran-beautifier/index.coffee b/src/beautifiers/fortran-beautifier/index.coffee index 075290d..8fcd759 100644 --- a/src/beautifiers/fortran-beautifier/index.coffee +++ b/src/beautifiers/fortran-beautifier/index.coffee @@ -8,7 +8,8 @@ path = require("path") module.exports = class FortranBeautifier extends Beautifier name: "Fortran Beautifier" - link: "https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/fortran-beautifier/emacs-fortran-formating-script.lisp" + link: "https://www.gnu.org/software/emacs/" + isPreInstalled: false options: { Fortran: true diff --git a/src/beautifiers/gofmt.coffee b/src/beautifiers/gofmt.coffee index 760a64a..31ded4d 100644 --- a/src/beautifiers/gofmt.coffee +++ b/src/beautifiers/gofmt.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class Gofmt extends Beautifier name: "gofmt" link: "https://golang.org/cmd/gofmt/" + isPreInstalled: false options: { Go: true diff --git a/src/beautifiers/hh_format.coffee b/src/beautifiers/hh_format.coffee index a2e0949..08986d0 100644 --- a/src/beautifiers/hh_format.coffee +++ b/src/beautifiers/hh_format.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class HhFormat extends Beautifier name: "hh_format" link: "http://hhvm.com/" + isPreInstalled: false options: PHP: false diff --git a/src/beautifiers/htmlbeautifier.coffee b/src/beautifiers/htmlbeautifier.coffee index 67558e4..f934d2f 100644 --- a/src/beautifiers/htmlbeautifier.coffee +++ b/src/beautifiers/htmlbeautifier.coffee @@ -8,6 +8,8 @@ Beautifier = require('./beautifier') module.exports = class HTMLBeautifier extends Beautifier name: "HTML Beautifier" link: "https://github.com/threedaymonk/htmlbeautifier" + isPreInstalled: false + options: { ERB: indent_size: true diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index 077190e..6b806d8 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -52,12 +52,15 @@ module.exports = class Beautifiers extends EventEmitter 'fortran-beautifier' 'js-beautify' 'jscs' + 'eslint' 'lua-beautifier' + 'nginx-beautify' 'ocp-indent' 'perltidy' 'php-cs-fixer' 'phpcbf' 'prettydiff' + 'pybeautifier' 'pug-beautify' 'puppet-fix' 'remark' @@ -140,20 +143,32 @@ module.exports = class Beautifiers extends EventEmitter ) or beautifiers[0] return beautifier - getLanguage : (grammar, filePath) -> + getExtension : (filePath) -> + if filePath + return path.extname(filePath).substr(1) + + getLanguages : (grammar, filePath) -> # Get language - fileExtension = path.extname(filePath) - # Remove prefix "." (period) in fileExtension - fileExtension = fileExtension.substr(1) - languages = @languages.getLanguages({grammar, extension: fileExtension}) - logger.verbose(languages, grammar, fileExtension) - # Check if unsupported language - if languages.length < 1 - return null + fileExtension = @getExtension(filePath) + + if fileExtension + languages = @languages.getLanguages({grammar, extension: fileExtension}) else - # TODO: select appropriate language + languages = @languages.getLanguages({grammar}) + + logger.verbose(languages, grammar, fileExtension) + + return languages + + getLanguage : (grammar, filePath) -> + languages = @getLanguages(grammar, filePath) + + # Check if unsupported language + if languages.length > 0 language = languages[0] + return language + getOptionsForLanguage : (allOptions, language) -> # Options for Language selections = (language.fallback or []).concat([language.namespace]) @@ -241,15 +256,10 @@ module.exports = class Beautifiers extends EventEmitter logger.info('beautify', text, allOptions, grammar, filePath, onSave) logger.verbose(allOptions) - # Get language - fileExtension = path.extname(filePath) - # Remove prefix "." (period) in fileExtension - fileExtension = fileExtension.substr(1) - languages = @languages.getLanguages({grammar, extension: fileExtension}) - logger.verbose(languages, grammar, fileExtension) + language = @getLanguage(grammar, filePath) # Check if unsupported language - if languages.length < 1 + if !language unsupportedGrammar = true logger.verbose('Unsupported language') @@ -260,19 +270,14 @@ module.exports = class Beautifiers extends EventEmitter # not intended to be beautified return resolve( null ) else - # TODO: select appropriate language - language = languages[0] - logger.verbose("Language #{language.name} supported") # Get language config langDisabled = atom.config.get("atom-beautify.#{language.namespace}.disabled") - # Beautify! unsupportedGrammar = false - # Check if Language is disabled if langDisabled logger.verbose("Language #{language.name} is disabled") @@ -370,6 +375,7 @@ module.exports = class Beautifiers extends EventEmitter if atom.config.get("atom-beautify.general.muteUnsupportedLanguageErrors") return resolve( null ) else + fileExtension = @getExtension(filePath) repoBugsUrl = pkg.bugs.url title = "Atom Beautify could not find a supported beautifier for this file" detail = """ diff --git a/src/beautifiers/js-beautify.coffee b/src/beautifiers/js-beautify.coffee index d84fda5..6a178e5 100644 --- a/src/beautifiers/js-beautify.coffee +++ b/src/beautifiers/js-beautify.coffee @@ -51,6 +51,8 @@ module.exports = class JSBeautify extends Beautifier beautifyCSS = require("js-beautify").css text = beautifyCSS(text, options) resolve text + else + reject(new Error("Unknown language for JS Beautify: "+language)) catch err @error("JS Beautify error: #{err}") reject(err) diff --git a/src/beautifiers/latex-beautify.coffee b/src/beautifiers/latex-beautify.coffee index bccfa11..1e13e7a 100644 --- a/src/beautifiers/latex-beautify.coffee +++ b/src/beautifiers/latex-beautify.coffee @@ -8,6 +8,7 @@ temp = require("temp").track() module.exports = class LatexBeautify extends Beautifier name: "Latex Beautify" link: "https://github.com/cmhughes/latexindent.pl" + isPreInstalled: false options: { LaTeX: true diff --git a/src/beautifiers/lua-beautifier/beautifier.coffee b/src/beautifiers/lua-beautifier/beautifier.coffee new file mode 100644 index 0000000..e7aba13 --- /dev/null +++ b/src/beautifiers/lua-beautifier/beautifier.coffee @@ -0,0 +1,103 @@ +DEFAULT_INDENT = ' ' + +adjust_space = (line) -> + string_list = line.match /(['"])[^\1]*?\1/g + muli_string = line.match /\[(=*)\[([^\]\1\]]*)/ + comment = line.match /\-{2}[^\[].*$/ + line = line.replace /\s+/g, ' ' + # replace all whitespaces inside the string with one space, WARNING: the whitespaces in string will be replace too! + line = line.replace /\s?(==|>=|<=|~=|[=><\+\*\/])\s?/g, ' $1 ' + # add whitespace around the operator + line = line.replace /([^=|\-|(|\s])\s?\-\s?([^\-|\[])/g, '$1 - $2' + # just format minus, not for -- or negative number or commentary. + line = line.replace /,([^\s])/g, ', $1' + # adjust ',' + line = line.replace /\s+,/g, ',' + # recover the whitespaces in string. + line = line.replace /(['"])[^\1]*?\1/g, -> + string_list.shift() + if muli_string and muli_string[0] + line = line.replace /\[(=*)\[([^\]\1\]]*)/, muli_string[0] + if comment and comment[0] + line = line.replace /\-{2}[^\[].*$/, comment[0] + line + +DEFAULT_WARN_FN = (msg) -> + console.log('WARNING:', msg) + +module.exports = (str, indent, warn_fn) -> + indent = indent or DEFAULT_INDENT + warn_fn = if typeof warn_fn == 'function' then warn_fn else DEFAULT_WARN_FN + indent = ' '.repeat(indent) if Number.isInteger(indent) + $currIndent = 0 + $nextIndent = 0 + $prevLength = 0 + $extIndent = 0 + $lastIndent = 0 + $template = 0 + new_code = str.split(/\r?\n/g).map (line, line_number) -> + $template_flag = false + if $template + res2 = line.match(/\](=*)\]/) + if res2 and $template == res2[1].length + 1 + $template_flag = true + if $template and !/]=*]$/.test(line) + arr = line.split(/\]=*\]/, 2) + comment = arr[0] + code = arr[1] + line = comment + ']' + '='.repeat($template - 1) + ']' + adjust_space(code) + $template = 0 + $template = 0 + else + return line + res1 = line.match(/\[(=*)\[/) + if res1 + $template = res1[1].length + 1 + if !$template_flag + line = line.trim() + # remote all spaces on both ends + line = adjust_space(line) + if !line.length + return '' + raw_line = line + line = line.replace(/(['"])[^\1]*?\1/, '') + # remove all quoted fragments for proper bracket processing + line = line.replace(/\s*--.+/, '') + # remove all comments; this ignores long bracket style comments + if /^((local )?function|repeat|while)\b/.test(line) and !/\bend\s*[\),;]*$/.test(line) or /\b(then|do)$/.test(line) and !/^elseif\b/.test(line) or /^if\b/.test(line) and /\bthen\b/.test(line) and !/\bend$/.test(line) or /\bfunction ?(?:\w+ )?\([^\)]*\)$/.test(line) and !/\bend$/.test(line) + $nextIndent = $currIndent + 1 + else if /^until\b/.test(line) or /^end\s*[\),;]*$/.test(line) or /^end\s*\)\s*\.\./.test(line) or /^else(if)?\b/.test(line) and /\bend$/.test(line) + $nextIndent = --$currIndent + else if /^else\b/.test(line) or /^elseif\b/.test(line) + $nextIndent = $currIndent + $currIndent = $currIndent - 1 + $brackets = (line.match(/\(/g) or []).length - ((line.match(/\)/g) or []).length) + # capture unbalanced brackets + $curly = (line.match(/\{/g) or []).length - ((line.match(/\}/g) or []).length) + # capture unbalanced curly brackets + # close (curly) brackets if needed + if $curly < 0 + $currIndent += $curly + if $brackets < 0 + $currIndent += $brackets + $nextIndent += $brackets + $curly + # console.log({last: $lastIndent, curr: $currIndent, next: $nextIndent, ext: $extIndent}) + if $currIndent - $lastIndent > 1 + $extIndent += $nextIndent - $lastIndent - 1 + $nextIndent = $currIndent = 1 + $lastIndent + if $currIndent - $lastIndent < -1 and $extIndent > 0 + $extIndent += $currIndent - $lastIndent + 1 + $currIndent = -1 + $lastIndent + if $nextIndent < $currIndent + $nextIndent = $currIndent + # console.log({last: $lastIndent, curr: $currIndent, next: $nextIndent, ext: $extIndent}) + warn_fn """negative indentation at line #{line_number}: #{raw_line}""" if $currIndent < 0 + new_line = (if raw_line.length and $currIndent > 0 and !$template_flag then indent.repeat($currIndent) else '') + raw_line + $useful = $prevLength > 0 or raw_line.length > 0 + $lastIndent = $currIndent + $currIndent = $nextIndent + $prevLength = raw_line.length + new_line or undefined + + warn_fn 'positive indentation at the end' if $currIndent > 0 + new_code.join '\n' diff --git a/src/beautifiers/lua-beautifier/beautifier.pl b/src/beautifiers/lua-beautifier/beautifier.pl deleted file mode 100644 index 349831a..0000000 --- a/src/beautifiers/lua-beautifier/beautifier.pl +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2011 Paul Kulchenko -# Credits: http://notebook.kulchenko.com/programming/lua-beautifier-in-55-lines-of-perl -use strict; -use warnings; - -use constant INDENT => ' '; -my($currIndent, $nextIndent, $prevLength) = (0, 0, 0); - -while (<>) { - chomp; - s/^\s+|\s+$//g; # remote all spaces on both ends - s/\s+/ /g; # replace all whitespaces inside the string with one space - - my $orig = $_; - - s/(['"])[^\1]*?\1//g; # remove all quoted fragments for proper bracket processing - s/\s*--.+//; # remove all comments; this ignores long bracket style comments - - # open a level; increase next indentation; don't change current one - if (/^((local )?function|repeat|while)\b/ && !/\bend\s*[\),;]*$/ - || /\b(then|do)$/ && !/^elseif\b/ # only open on 'then' if there is no 'elseif' - || /^if\b/ && /\bthen\b/ && !/\bend$/ # only open on 'if' if there is no 'end' at the end - || /\bfunction\s*\([^\)]*\)$/) { - $nextIndent = $currIndent + 1; - } - # close the level; change both current and next indentation - elsif (/^until\b/ - || /^end\s*[\),;]*$/ - || /^end\s*\)\s*\.\./ # this is a special case of 'end).."some string"' - || /^else(if)?\b/ && /\bend$/) { - $nextIndent = $currIndent = $currIndent - 1; - } - # keep the level; decrease the current indentation; keep the next one - elsif (/^else\b/ - || /^elseif\b/) { - ($nextIndent, $currIndent) = ($currIndent, $currIndent-1); - } - - my $brackets = y/(// - y/)//; # capture unbalanced brackets - my $curly = y/{// - y/}//; # capture unbalanced curly brackets - - # close (curly) brackets if needed - $currIndent += $curly if $curly < 0 && /^\}/; - $currIndent += $brackets if $brackets < 0 && /^\)/; - - warn "WARNING: negative indentation at line $.: $orig\n" if $currIndent < 0; - - print((length($orig) ? (INDENT x $currIndent) : ''), $orig, "\n") - if $prevLength > 0 || length($orig) > 0; # this is to collapse empty lines - - $nextIndent += $brackets + $curly; - - $currIndent = $nextIndent; - $prevLength = length($orig); -} - -warn "WARNING: positive indentation at the end\n" if $nextIndent > 0; diff --git a/src/beautifiers/lua-beautifier/index.coffee b/src/beautifiers/lua-beautifier/index.coffee index c96c743..24f9376 100644 --- a/src/beautifiers/lua-beautifier/index.coffee +++ b/src/beautifiers/lua-beautifier/index.coffee @@ -4,19 +4,20 @@ path = require("path") "use strict" Beautifier = require('../beautifier') +format = require './beautifier' module.exports = class Lua extends Beautifier name: "Lua beautifier" - link: "https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/lua-beautifier/beautifier.pl" + link: "https://www.perl.org/" + isPreInstalled: false options: { Lua: true } beautify: (text, language, options) -> - lua_beautifier = path.resolve(__dirname, "beautifier.pl") - @run("perl", [ - lua_beautifier, - '<', - @tempFile("input", text) - ]) + new @Promise (resolve, reject) -> + try + resolve format text, options.indent_char.repeat options.indent_size + catch error + reject error diff --git a/src/beautifiers/nginx-beautify.coffee b/src/beautifiers/nginx-beautify.coffee new file mode 100644 index 0000000..2e41a4b --- /dev/null +++ b/src/beautifiers/nginx-beautify.coffee @@ -0,0 +1,37 @@ +"use strict" +Beautifier = require('./beautifier') + +module.exports = class NginxBeautify extends Beautifier + name: "Nginx Beautify" + link: "https://github.com/denysvitali/nginxbeautify" + isPreInstalled: false + + options: { + Nginx: { + spaces: ["indent_with_tabs", "indent_size", "indent_char", (indent_with_tabs, indent_size, indent_char) -> + if indent_with_tabs or indent_char is "\t" + 0 + else + indent_size + ] + tabs: ["indent_with_tabs", "indent_size", "indent_char", (indent_with_tabs, indent_size, indent_char) -> + if indent_with_tabs or indent_char is "\t" + indent_size + else + 0 + ] + dontJoinCurlyBracet: true + } + } + + beautify: (text, language, options) -> + + return new @Promise((resolve, reject) -> + Beautify = require("nginxbeautify") + instance = new Beautify(options) + try + resolve(instance.parse(text)) + catch error + # Error occurred + reject(error) + ) diff --git a/src/beautifiers/ocp-indent.coffee b/src/beautifiers/ocp-indent.coffee index a7ea475..22c0463 100644 --- a/src/beautifiers/ocp-indent.coffee +++ b/src/beautifiers/ocp-indent.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class OCPIndent extends Beautifier name: "ocp-indent" link: "https://www.typerex.org/ocp-indent.html" + isPreInstalled: false options: { OCaml: true diff --git a/src/beautifiers/perltidy.coffee b/src/beautifiers/perltidy.coffee index 1823701..9ce6c00 100644 --- a/src/beautifiers/perltidy.coffee +++ b/src/beautifiers/perltidy.coffee @@ -7,6 +7,7 @@ Beautifier = require('./beautifier') module.exports = class PerlTidy extends Beautifier name: "Perltidy" link: "http://perltidy.sourceforge.net/" + isPreInstalled: false options: { Perl: true diff --git a/src/beautifiers/php-cs-fixer.coffee b/src/beautifiers/php-cs-fixer.coffee index 0cf8f01..92d5073 100644 --- a/src/beautifiers/php-cs-fixer.coffee +++ b/src/beautifiers/php-cs-fixer.coffee @@ -10,6 +10,7 @@ module.exports = class PHPCSFixer extends Beautifier name: 'PHP-CS-Fixer' link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer" + isPreInstalled: false options: PHP: true @@ -18,63 +19,55 @@ module.exports = class PHPCSFixer extends Beautifier @debug('php-cs-fixer', options) configFile = if context? and context.filePath? then @findFile(path.dirname(context.filePath), '.php_cs') + phpCsFixerOptions = [ + "fix" + "--rules=#{options.rules}" if options.rules + "--config=#{configFile}" if configFile + "--using-cache=no" + ] + runOptions = { + ignoreReturnCode: true + help: { + link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer" + } + } - if @isWindows - # Find php-cs-fixer.phar script - @Promise.all([ - @which(options.cs_fixer_path) if options.cs_fixer_path - @which('php-cs-fixer') - ]).then((paths) => - @debug('php-cs-fixer paths', paths) - _ = require 'lodash' - # Get first valid, absolute path - phpCSFixerPath = _.find(paths, (p) -> p and path.isAbsolute(p) ) - @verbose('phpCSFixerPath', phpCSFixerPath) - @debug('phpCSFixerPath', phpCSFixerPath, paths) - # Check if PHP-CS-Fixer path was found - if phpCSFixerPath? - # Found PHP-CS-Fixer path - @run("php", [ - phpCSFixerPath - "fix" - "--level=#{options.level}" if options.level - "--fixers=#{options.fixers}" if options.fixers - "--config-file=#{configFile}" if configFile - tempFile = @tempFile("temp", text) - ], { - ignoreReturnCode: true - help: { - link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer" - } - }) + # Find php-cs-fixer.phar script + @Promise.all([ + @which(options.cs_fixer_path) if options.cs_fixer_path + @which('php-cs-fixer') + ]).then((paths) => + @debug('php-cs-fixer paths', paths) + _ = require 'lodash' + # Get first valid, absolute path + phpCSFixerPath = _.find(paths, (p) -> p and path.isAbsolute(p) ) + @verbose('phpCSFixerPath', phpCSFixerPath) + @debug('phpCSFixerPath', phpCSFixerPath, paths) + + # Check if PHP-CS-Fixer path was found + if phpCSFixerPath? + # Found PHP-CS-Fixer path + tempFile = @tempFile("temp", text) + + if @isWindows + @run("php", [phpCSFixerPath, phpCsFixerOptions, tempFile], runOptions) .then(=> @readFile(tempFile) ) else - @verbose('php-cs-fixer not found!') - # Could not find PHP-CS-Fixer path - @Promise.reject(@commandNotFoundError( - 'php-cs-fixer' - { + @run(phpCSFixerPath, [phpCsFixerOptions, tempFile], runOptions) + .then(=> + @readFile(tempFile) + ) + else + @verbose('php-cs-fixer not found!') + # Could not find PHP-CS-Fixer path + @Promise.reject(@commandNotFoundError( + 'php-cs-fixer' + { link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer" program: "php-cs-fixer.phar" pathOption: "PHP - CS Fixer Path" - }) - ) - ) - else - @run("php-cs-fixer", [ - "fix" - "--level=#{options.level}" if options.level - "--fixers=#{options.fixers}" if options.fixers - "--config-file=#{configFile}" if configFile - tempFile = @tempFile("temp", text) - ], { - ignoreReturnCode: true - help: { - link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer" - } - }) - .then(=> - @readFile(tempFile) + }) ) + ) diff --git a/src/beautifiers/phpcbf.coffee b/src/beautifiers/phpcbf.coffee index 67ebd2f..935a18d 100644 --- a/src/beautifiers/phpcbf.coffee +++ b/src/beautifiers/phpcbf.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class PHPCBF extends Beautifier name: "PHPCBF" link: "http://php.net/manual/en/install.php" + isPreInstalled: false options: { _: @@ -20,6 +21,10 @@ module.exports = class PHPCBF extends Beautifier beautify: (text, language, options) -> @debug('phpcbf', options) + standardFiles = ['phpcs.xml', 'phpcs.xml.dist', 'phpcs.ruleset.xml', 'ruleset.xml'] + standardFile = @findFile(atom.project.getPaths()[0], standardFiles); + + options.standard = standardFile if standardFile isWin = @isWindows if isWin diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index 104494c..ace7be2 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -49,6 +49,7 @@ module.exports = class PrettyDiff extends Beautifier EJS: true HTML: true Handlebars: true + Mustache: true Nunjucks: true XML: true SVG: true @@ -66,6 +67,7 @@ module.exports = class PrettyDiff extends Beautifier Visualforce: true "Riot.js": true XTemplate: true + "Golang Template": true } beautify: (text, language, options) -> @@ -109,6 +111,8 @@ module.exports = class PrettyDiff extends Beautifier lang = "scss" when "TSS" lang = "tss" + when "Golang Template" + lang = "go" else lang = "auto" diff --git a/src/beautifiers/puppet-fix.coffee b/src/beautifiers/puppet-fix.coffee index 20bd84c..4ae96ed 100644 --- a/src/beautifiers/puppet-fix.coffee +++ b/src/beautifiers/puppet-fix.coffee @@ -8,6 +8,7 @@ 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 diff --git a/src/beautifiers/pybeautifier.coffee b/src/beautifiers/pybeautifier.coffee new file mode 100644 index 0000000..696428e --- /dev/null +++ b/src/beautifiers/pybeautifier.coffee @@ -0,0 +1,67 @@ +'use strict' +net = require('net') +Beautifier = require('./beautifier') + +HOST = '127.0.0.1' +PORT = 36805 +MULTI_LINE_OUTPUT_TABLE = { + 'Grid': 0, + 'Vertical': 1, + 'Hanging Indent': 2, + 'Vertical Hanging Indent': 3, + 'Hanging Grid': 4, + 'Hanging Grid Grouped': 5, + 'NOQA': 6 +} + +format = (data, formaters) -> + return new Promise (resolve, reject) -> + client = new net.Socket() + client.on 'error', (error) -> + client.destroy() + reject(error) + client.connect PORT, HOST, -> + client.setEncoding('utf8') + client.write(JSON.stringify({'data': data, 'formaters': formaters})) + response = '' + client.on 'data', (chunk) -> + response += chunk + client.on 'end', -> + response = JSON.parse(response) + if response.error? + reject(Error(response.error)) + else + resolve(response.data) + client.destroy() + +module.exports = class PythonBeautifier extends Beautifier + + name: "pybeautifier" + link: "https://github.com/guyskk/pybeautifier" + isPreInstalled: false + + options: { + Python: true + } + + beautify: (text, language, options) -> + formater = {'name': options.formater} + if options.formater == 'autopep8' + formater.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] + if options.sort_imports + multi_line_output = MULTI_LINE_OUTPUT_TABLE[options.multi_line_output] + formaters.push + 'name': 'isort' + 'config': {'multi_line_output': multi_line_output} + return new @Promise (resolve, reject) -> + format(text, formaters) + .then (data) -> + resolve(data) + .catch (error) -> + reject(error) diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee index 20062a3..8a4d366 100644 --- a/src/beautifiers/rubocop.coffee +++ b/src/beautifiers/rubocop.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class Rubocop extends Beautifier name: "Rubocop" link: "https://github.com/bbatsov/rubocop" + isPreInstalled: false options: { Ruby: diff --git a/src/beautifiers/ruby-beautify.coffee b/src/beautifiers/ruby-beautify.coffee index 27a2c80..f710ec7 100644 --- a/src/beautifiers/ruby-beautify.coffee +++ b/src/beautifiers/ruby-beautify.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class RubyBeautify extends Beautifier name: "Ruby Beautify" link: "https://github.com/erniebrodeur/ruby-beautify" + isPreInstalled: false options: { Ruby: diff --git a/src/beautifiers/rustfmt.coffee b/src/beautifiers/rustfmt.coffee index e877820..8277653 100644 --- a/src/beautifiers/rustfmt.coffee +++ b/src/beautifiers/rustfmt.coffee @@ -11,6 +11,7 @@ versionCheckState = false module.exports = class Rustfmt extends Beautifier name: "rustfmt" link: "https://github.com/nrc/rustfmt" + isPreInstalled: false options: { Rust: true diff --git a/src/beautifiers/sass-convert.coffee b/src/beautifiers/sass-convert.coffee index 8e65da9..e53fa98 100644 --- a/src/beautifiers/sass-convert.coffee +++ b/src/beautifiers/sass-convert.coffee @@ -4,6 +4,7 @@ Beautifier = require('./beautifier') module.exports = class SassConvert extends Beautifier name: "SassConvert" link: "http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax" + isPreInstalled: false options: # TODO: Add support for options diff --git a/src/beautifiers/sqlformat.coffee b/src/beautifiers/sqlformat.coffee index 7095f3a..e6b0058 100644 --- a/src/beautifiers/sqlformat.coffee +++ b/src/beautifiers/sqlformat.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class Sqlformat extends Beautifier name: "sqlformat" link: "https://github.com/andialbrecht/sqlparse" + isPreInstalled: false options: { SQL: true diff --git a/src/beautifiers/stylish-haskell.coffee b/src/beautifiers/stylish-haskell.coffee index 65db98d..95ba9ad 100644 --- a/src/beautifiers/stylish-haskell.coffee +++ b/src/beautifiers/stylish-haskell.coffee @@ -8,6 +8,7 @@ Beautifier = require('./beautifier') module.exports = class StylishHaskell extends Beautifier name: "stylish-haskell" link: "https://github.com/jaspervdj/stylish-haskell" + isPreInstalled: false options: { Haskell: true diff --git a/src/beautifiers/uncrustify/index.coffee b/src/beautifiers/uncrustify/index.coffee index 92724c8..2ee1ae7 100644 --- a/src/beautifiers/uncrustify/index.coffee +++ b/src/beautifiers/uncrustify/index.coffee @@ -11,6 +11,8 @@ _ = require('lodash') module.exports = class Uncrustify extends Beautifier name: "Uncrustify" link: "https://github.com/uncrustify/uncrustify" + isPreInstalled: false + options: { Apex: true C: true diff --git a/src/beautifiers/vue-beautifier.coffee b/src/beautifiers/vue-beautifier.coffee index bdfc661..f62d8f8 100644 --- a/src/beautifiers/vue-beautifier.coffee +++ b/src/beautifiers/vue-beautifier.coffee @@ -5,13 +5,14 @@ _ = require('lodash') module.exports = class VueBeautifier extends Beautifier name: "Vue Beautifier" + link: "https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/vue-beautifier.coffee" options: Vue: true beautify: (text, language, options) -> return new @Promise((resolve, reject) -> - regexp = /(<(template|script|style)[^>]*>)((\s|\S)*?)<\/\2>/gi + regexp = /(^<(template|script|style)[^>]*>)((\s|\S)*)^<\/\2>/gim resolve(text.replace(regexp, (match, begin, type, text) -> lang = /lang\s*=\s*['"](\w+)["']/.exec(begin)?[1] diff --git a/src/beautifiers/yapf.coffee b/src/beautifiers/yapf.coffee index affd32e..3ac7092 100644 --- a/src/beautifiers/yapf.coffee +++ b/src/beautifiers/yapf.coffee @@ -9,6 +9,7 @@ module.exports = class Yapf extends Beautifier name: "yapf" link: "https://github.com/google/yapf" + isPreInstalled: false options: { Python: false @@ -23,8 +24,12 @@ module.exports = class Yapf extends Beautifier }, ignoreReturnCode: true) .then(=> if options.sort_imports + editor = atom.workspace.getActiveTextEditor() + filePath = editor.getPath() + projectPath = atom.project.relativizePath(filePath)[0] + @run("isort", - [tempFile], + ["-sp", projectPath, tempFile], help: { link: "https://github.com/timothycrosley/isort" }) diff --git a/src/beautify.coffee b/src/beautify.coffee index 9e998c7..46a535b 100644 --- a/src/beautify.coffee +++ b/src/beautify.coffee @@ -56,9 +56,10 @@ setCursors = (editor, posArray) -> # Show beautification progress/loading view beautifier.on('beautify::start', -> - LoadingView ?= require "./views/loading-view" - loadingView ?= new LoadingView() - loadingView.show() + if atom.config.get("atom-beautify.general.showLoadingView") + LoadingView ?= require "./views/loading-view" + loadingView ?= new LoadingView() + loadingView.show() ) beautifier.on('beautify::end', -> loadingView?.hide() diff --git a/src/config.coffee b/src/config.coffee index 6d3a80d..5c6ceaf 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -42,4 +42,9 @@ module.exports = { type : 'boolean' default : false description : "Do not show any/all errors when they occur" + showLoadingView : + title: "Show Loading View" + type : 'boolean' + default : true + description : "Show loading view when beautifying" } diff --git a/src/languages/cpp.coffee b/src/languages/cpp.coffee index 6f7c6f8..cd5fb0e 100644 --- a/src/languages/cpp.coffee +++ b/src/languages/cpp.coffee @@ -20,10 +20,12 @@ module.exports = { "cpp" "cxx" "C" + "cu" "c++" "hpp" "hxx" "h++" + "cuh" ] options: diff --git a/src/languages/gohtml.coffee b/src/languages/gohtml.coffee new file mode 100644 index 0000000..76fdf67 --- /dev/null +++ b/src/languages/gohtml.coffee @@ -0,0 +1,27 @@ +module.exports = { + + name: "Golang Template" + description: "Comma-Separated Values" + namespace: "gohtml" + fallback: ["html"] + + ### + Supported Grammars + ### + grammars: [ + "HTML (Go)", + "Go Template" + ] + + ### + Supported extensions + ### + extensions: [ + 'gohtml' + ] + + defaultBeautifier: "Pretty Diff" + + options: [] + +} diff --git a/src/languages/html.coffee b/src/languages/html.coffee index 6fd85bb..8d6746d 100644 --- a/src/languages/html.coffee +++ b/src/languages/html.coffee @@ -56,8 +56,8 @@ module.exports = { wrap_attributes: type: 'string' default: "auto" - enum: ["auto", "force"] - description: "Wrap attributes to new lines [auto|force]" + enum: ["auto", "force", "force-aligned", "force-expand-multiline"] + description: "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline]" wrap_attributes_indent_size: type: 'integer' default: defaultIndentSize diff --git a/src/languages/index.coffee b/src/languages/index.coffee index d41c759..3c7f92d 100644 --- a/src/languages/index.coffee +++ b/src/languages/index.coffee @@ -32,6 +32,7 @@ module.exports = class Languages "gherkin" "glsl" "go" + "gohtml" "fortran" "handlebars" "haskell" @@ -47,6 +48,7 @@ module.exports = class Languages "markdown" 'marko' "mustache" + "nginx" "nunjucks" "objective-c" "ocaml" diff --git a/src/languages/jsx.coffee b/src/languages/jsx.coffee index 6c26e95..f2af260 100644 --- a/src/languages/jsx.coffee +++ b/src/languages/jsx.coffee @@ -24,4 +24,10 @@ module.exports = { defaultBeautifier: "Pretty Diff" + options: + e4x: + type: 'boolean' + default: true + description: "Support e4x/jsx syntax" + } diff --git a/src/languages/nginx.coffee b/src/languages/nginx.coffee new file mode 100644 index 0000000..1ea7f2c --- /dev/null +++ b/src/languages/nginx.coffee @@ -0,0 +1,49 @@ +# Get Atom defaults +scope = ['source.conf'] +tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4 +softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true +defaultIndentSize = (if softTabs then tabLength else 1) +defaultIndentChar = (if softTabs then " " else "\t") +defaultIndentWithTabs = not softTabs + +module.exports = { + + name: "Nginx" + namespace: "nginx" + + ### + Supported Grammars + ### + grammars: [ + "nginx" + ] + + ### + Supported extensions + ### + extensions: [ + "conf" + ] + + defaultBeautifier: "Nginx Beautify" + + options: + indent_size: + type: 'integer' + default: defaultIndentSize + minimum: 0 + description: "Indentation size/length" + indent_char: + type: 'string' + default: defaultIndentChar + description: "Indentation character" + indent_with_tabs: + type: 'boolean' + default: defaultIndentWithTabs + description: "Indentation uses tabs, overrides `Indent Size` and `Indent Char`" + dontJoinCurlyBracet: + title: "Don't join curly brackets" + type: "boolean" + default: true + descriotion: "" +} diff --git a/src/languages/php.coffee b/src/languages/php.coffee index ef8eade..6bcbf40 100644 --- a/src/languages/php.coffee +++ b/src/languages/php.coffee @@ -26,15 +26,11 @@ module.exports = { title: "PHP-CS-Fixer Path" type: 'string' default: "" - description: "Path to the `php-cs-fixer` CLI executable" - fixers: + description: "Absolute path to the `php-cs-fixer` CLI executable" + rules: type: 'string' default: "" - description: "Add fixer(s). i.e. linefeed,-short_tag,indentation" - level: - type: 'string' - default: "" - description: "By default, all PSR-2 fixers and some additional ones are run." + description: "Add rule(s). i.e. line_ending,-full_opening_tag,@PSR2" phpcbf_path: title: "PHPCBF Path" type: 'string' @@ -44,6 +40,6 @@ module.exports = { title: "PHPCBF Standard" type: 'string' default: "", - description: "Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules" + description: "Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules. Will use local `phpcs.xml`, `phpcs.xml.dist`, `phpcs.ruleset.xml` or `ruleset.xml` if found in the project root." } diff --git a/src/languages/python.coffee b/src/languages/python.coffee index f598815..d62e0f5 100644 --- a/src/languages/python.coffee +++ b/src/languages/python.coffee @@ -41,9 +41,30 @@ module.exports = { items: type: 'string' description: "do not fix these errors/warnings" + formater: + type: 'string' + default: 'autopep8' + enum: ['autopep8', 'yapf'] + description: "formater used by pybeautifier" + style_config: + type: 'string' + default: 'pep8' + description: "formatting style used by yapf" sort_imports: type: 'boolean' default: false description: "sort imports (requires isort installed)" - + multi_line_output: + type: 'string' + default: 'Hanging Grid Grouped' + enum: [ + 'Grid' + 'Vertical' + 'Hanging Indent' + 'Vertical Hanging Indent' + 'Hanging Grid' + 'Hanging Grid Grouped' + 'NOQA' + ] + description: "defines how from imports wrap (requires isort installed)" }