Merge branch 'master' into master_bash_beautifier
This commit is contained in:
commit
674c5ca69f
|
@ -89,7 +89,6 @@ before_install:
|
||||||
# Sass language support
|
# Sass language support
|
||||||
- gem install sass
|
- gem install sass
|
||||||
# Python language support
|
# Python language support
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo chmod 777 -R /opt/python; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo chmod 777 -R /opt/python; fi
|
||||||
- pip install --upgrade pip
|
- pip install --upgrade pip
|
||||||
- pip install --upgrade autopep8
|
- pip install --upgrade autopep8
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# dev
|
# dev
|
||||||
|
- Update to `remark`'s new API and fix [#1196](https://github.com/Glavin001/atom-beautify/issues/1196)
|
||||||
- Add beautifier for the Lua language.
|
- Add beautifier for the Lua language.
|
||||||
- Add [ocp-indent](https://github.com/OCamlPro/ocp-indent) beautifier for the OCaml 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 [elm-format](https://github.com/avh4/elm-format) beautifier for the Elm language.
|
||||||
|
|
|
@ -2,14 +2,31 @@
|
||||||
|
|
||||||
The results of beautification are not what I expect.
|
The results of beautification are not what I expect.
|
||||||
|
|
||||||
# Expected Results
|
# Input Before Beautification
|
||||||
|
|
||||||
The beautified code should have looked like:
|
This is what the code looked like before:
|
||||||
|
|
||||||
```
|
```
|
||||||
<INSERT CODE HERE>
|
<INSERT CODE HERE>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Expected Output
|
||||||
|
|
||||||
|
The beautified code should have looked like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
<INSERT CODE HERE>
|
||||||
|
```
|
||||||
|
|
||||||
|
# Actual Output
|
||||||
|
|
||||||
|
The beautified code actually looked like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
<INSERT CODE HERE>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
# Steps to Reproduce
|
# Steps to Reproduce
|
||||||
|
|
||||||
1. Add code to Atom editor
|
1. Add code to Atom editor
|
||||||
|
@ -22,8 +39,11 @@ Here is a link to the `debug.md` Gist: <INSERT GIST HERE>
|
||||||
|
|
||||||
# Checklist
|
# Checklist
|
||||||
|
|
||||||
- [ ] I have tried uninstalling and reinstalling Atom Beautify to ensure it installed properly
|
I have:
|
||||||
- [ ] I have reloaded (or restarted) Atom to ensure it is not a caching issue
|
- [ ] Tried uninstalling and reinstalling Atom Beautify to ensure it installed properly
|
||||||
- [ ] Searched for existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues
|
- [ ] Reloaded (or restarted) Atom to ensure it is not a caching issue
|
||||||
|
- [ ] Searched through existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues
|
||||||
so I know this is not a duplicate issue
|
so I know this is not a duplicate issue
|
||||||
|
- [ ] Filled out the Input, Expected, and Actual sections above or have edited/removed them in a way that fully describes the issue.
|
||||||
- [ ] Generated debugging information and added link for `debug.md` Gist to this issue
|
- [ ] Generated debugging information and added link for `debug.md` Gist to this issue
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# :lipstick: [{{package.name}}](https://github.com/Glavin001/atom-beautify)
|
# :lipstick: [{{package.name}}](https://github.com/Glavin001/atom-beautify)
|
||||||
|
|
||||||
| Mac OS <img src="https://cloud.githubusercontent.com/assets/1885333/17059766/2530c9d8-4ffd-11e6-9529-3fa47dbff616.png" width="50px"> | <img src="https://cloud.githubusercontent.com/assets/1885333/17059750/11c4474e-4ffd-11e6-89e1-2486ca5b3234.png" width="100px"> | <img src="https://cloud.githubusercontent.com/assets/1885333/17059763/206a7d4a-4ffd-11e6-859e-7856902fb300.png" width="100px"> |
|
| Mac OS <img src="https://cloud.githubusercontent.com/assets/1885333/17059766/2530c9d8-4ffd-11e6-9529-3fa47dbff616.png" width="50px"> and <img src="https://cloud.githubusercontent.com/assets/1885333/17059750/11c4474e-4ffd-11e6-89e1-2486ca5b3234.png" width="100px"> | <img src="https://cloud.githubusercontent.com/assets/1885333/17059763/206a7d4a-4ffd-11e6-859e-7856902fb300.png" width="100px"> |
|
||||||
| --- | --- | --- |
|
| --- | --- |
|
||||||
| [![Build Status](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master)](https://travis-ci.org/Glavin001/atom-beautify) | [![Build Status](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master)](https://travis-ci.org/Glavin001/atom-beautify) | [![Build status](https://ci.appveyor.com/api/projects/status/himnq7tjxl2fdc8u?svg=true)](https://ci.appveyor.com/project/Glavin001/atom-beautify) |
|
| [![Build Status](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master)](https://travis-ci.org/Glavin001/atom-beautify) | [![Build status](https://ci.appveyor.com/api/projects/status/himnq7tjxl2fdc8u?svg=true)](https://ci.appveyor.com/project/Glavin001/atom-beautify) |
|
||||||
|
|
||||||
|
|
||||||
[![Gitter chat](https://img.shields.io/badge/gitter-Glavin001%2Fatom--beautify-1dce73.svg)](https://gitter.im/Glavin001/atom-beautify)
|
[![Gitter chat](https://img.shields.io/badge/gitter-Glavin001%2Fatom--beautify-1dce73.svg)](https://gitter.im/Glavin001/atom-beautify)
|
||||||
|
@ -46,12 +46,18 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
|
||||||
|
|
||||||
By default `Anonymous Analytics` is enabled.
|
By default `Anonymous Analytics` is enabled.
|
||||||
If you do not wish to have usage data sent to Google Analytics then please disable `Anonymous Analytics` option before using Atom-Beautify.
|
If you do not wish to have usage data sent to Google Analytics then please disable `Anonymous Analytics` option before using Atom-Beautify.
|
||||||
See [`Anonymous Analytics` section of docs](https://github.com/Glavin001/atom-beautify/blob/master/docs/options.md#anonymous-analytics) for details.
|
See [`Anonymous Analytics` section of docs](docs/options.md#anonymous-analytics) for details.
|
||||||
Thank you.
|
Thank you.
|
||||||
|
|
||||||
|
### Next Version: [Unibeautify](https://github.com/Unibeautify/unibeautify)
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
|
||||||
## Language Support
|
## Language Support
|
||||||
|
|
||||||
See [all supported options in the documentation at `docs/options.md`](https://github.com/Glavin001/atom-beautify/blob/master/docs/options.md).
|
See [all supported options in the documentation at `docs/options.md`](docs/options.md).
|
||||||
|
|
||||||
{{language-beautifiers-support languageOptions}}
|
{{language-beautifiers-support languageOptions}}
|
||||||
|
|
||||||
|
@ -98,22 +104,22 @@ For example:
|
||||||
|
|
||||||
Edit your `.jsbeautifyrc` file in any of the following locations:
|
Edit your `.jsbeautifyrc` file in any of the following locations:
|
||||||
|
|
||||||
- Atom Package Settings
|
- Atom Package Settings
|
||||||
`Atom` ➔ `Preferences` ➔ Search for `atom-beautify`
|
`Atom` ➔ `Preferences` ➔ Search for `atom-beautify`
|
||||||
- Same directory as current file
|
- Same directory as current file
|
||||||
- Project root
|
- Project root
|
||||||
`atom-beautify` will recursively look up from the current file's directory to find `.jsbeautifyrc`.
|
`atom-beautify` will recursively look up from the current file's directory to find `.jsbeautifyrc`.
|
||||||
- Your user's home directory
|
- Your user's home directory
|
||||||
|
|
||||||
**Note**: *Comments are supported in `.jsbeautifyrc` thanks to [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).*
|
**Note**: *Comments are supported in `.jsbeautifyrc` thanks to [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).*
|
||||||
|
|
||||||
See examples of both ways inside [`examples/`](https://github.com/donaldpipowitch/atom-beautify/tree/master/examples)
|
See examples of both ways inside [`examples/`](examples)
|
||||||
|
|
||||||
See [all supported options in the documentation at `docs/options.md`](https://github.com/Glavin001/atom-beautify/blob/master/docs/options.md).
|
See [all supported options in the documentation at `docs/options.md`](docs/options.md).
|
||||||
|
|
||||||
### Simple
|
### Simple
|
||||||
|
|
||||||
See [examples/simple-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowitch/atom-beautify/blob/master/examples/simple-jsbeautifyrc/.jsbeautifyrc).
|
See [examples/simple-jsbeautifyrc/.jsbeautifyrc](examples/simple-jsbeautifyrc/.jsbeautifyrc).
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
@ -131,7 +137,7 @@ See [examples/simple-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowi
|
||||||
|
|
||||||
### Nested (Recommended)
|
### Nested (Recommended)
|
||||||
|
|
||||||
See [examples/nested-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowitch/atom-beautify/blob/master/examples/nested-jsbeautifyrc/.jsbeautifyrc).
|
See [examples/nested-jsbeautifyrc/.jsbeautifyrc](examples/nested-jsbeautifyrc/.jsbeautifyrc).
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
@ -169,16 +175,16 @@ See [examples/nested-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowi
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
See [`docs/troubleshooting.md`](https://github.com/Glavin001/atom-beautify/blob/master/docs/troubleshooting.md).
|
See [`docs/troubleshooting.md`](docs/troubleshooting.md).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
[See all contributors on GitHub](https://github.com/donaldpipowitch/atom-beautify/graphs/contributors).
|
[See all contributors on GitHub](../../graphs/contributors).
|
||||||
|
|
||||||
Please update the [CHANGELOG.md](https://github.com/donaldpipowitch/atom-beautify/blob/master/CHANGELOG.md),
|
Please update the [CHANGELOG.md](CHANGELOG.md),
|
||||||
add yourself as a contributor to the [package.json](https://github.com/donaldpipowitch/atom-beautify/blob/master/package.json),
|
add yourself as a contributor to the [package.json](package.json),
|
||||||
and submit a [Pull Request on GitHub](https://help.github.com/articles/using-pull-requests/).
|
and submit a [Pull Request on GitHub](https://help.github.com/articles/using-pull-requests/).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[MIT](https://github.com/donaldpipowitch/atom-beautify/blob/master/LICENSE.md) © [Glavin Wiechert](https://github.com/Glavin001)
|
[MIT](LICENSE.md) © [Glavin Wiechert](https://github.com/Glavin001)
|
||||||
|
|
41
README.md
41
README.md
|
@ -1,8 +1,8 @@
|
||||||
# :lipstick: [atom-beautify](https://github.com/Glavin001/atom-beautify)
|
# :lipstick: [atom-beautify](https://github.com/Glavin001/atom-beautify)
|
||||||
|
|
||||||
| Mac OS <img src="https://cloud.githubusercontent.com/assets/1885333/17059766/2530c9d8-4ffd-11e6-9529-3fa47dbff616.png" width="50px"> | <img src="https://cloud.githubusercontent.com/assets/1885333/17059750/11c4474e-4ffd-11e6-89e1-2486ca5b3234.png" width="100px"> | <img src="https://cloud.githubusercontent.com/assets/1885333/17059763/206a7d4a-4ffd-11e6-859e-7856902fb300.png" width="100px"> |
|
| Mac OS <img src="https://cloud.githubusercontent.com/assets/1885333/17059766/2530c9d8-4ffd-11e6-9529-3fa47dbff616.png" width="50px"> and <img src="https://cloud.githubusercontent.com/assets/1885333/17059750/11c4474e-4ffd-11e6-89e1-2486ca5b3234.png" width="100px"> | <img src="https://cloud.githubusercontent.com/assets/1885333/17059763/206a7d4a-4ffd-11e6-859e-7856902fb300.png" width="100px"> |
|
||||||
| --- | --- | --- |
|
| --- | --- |
|
||||||
| [![Build Status](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master)](https://travis-ci.org/Glavin001/atom-beautify) | [![Build Status](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master)](https://travis-ci.org/Glavin001/atom-beautify) | [![Build status](https://ci.appveyor.com/api/projects/status/himnq7tjxl2fdc8u?svg=true)](https://ci.appveyor.com/project/Glavin001/atom-beautify) |
|
| [![Build Status](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master)](https://travis-ci.org/Glavin001/atom-beautify) | [![Build status](https://ci.appveyor.com/api/projects/status/himnq7tjxl2fdc8u?svg=true)](https://ci.appveyor.com/project/Glavin001/atom-beautify) |
|
||||||
|
|
||||||
|
|
||||||
[![Gitter chat](https://img.shields.io/badge/gitter-Glavin001%2Fatom--beautify-1dce73.svg)](https://gitter.im/Glavin001/atom-beautify)
|
[![Gitter chat](https://img.shields.io/badge/gitter-Glavin001%2Fatom--beautify-1dce73.svg)](https://gitter.im/Glavin001/atom-beautify)
|
||||||
|
@ -46,12 +46,18 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
|
||||||
|
|
||||||
By default `Anonymous Analytics` is enabled.
|
By default `Anonymous Analytics` is enabled.
|
||||||
If you do not wish to have usage data sent to Google Analytics then please disable `Anonymous Analytics` option before using Atom-Beautify.
|
If you do not wish to have usage data sent to Google Analytics then please disable `Anonymous Analytics` option before using Atom-Beautify.
|
||||||
See [`Anonymous Analytics` section of docs](https://github.com/Glavin001/atom-beautify/blob/master/docs/options.md#anonymous-analytics) for details.
|
See [`Anonymous Analytics` section of docs](docs/options.md#anonymous-analytics) for details.
|
||||||
Thank you.
|
Thank you.
|
||||||
|
|
||||||
|
### Next Version: [Unibeautify](https://github.com/Unibeautify/unibeautify)
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
|
||||||
## Language Support
|
## Language Support
|
||||||
|
|
||||||
See [all supported options in the documentation at `docs/options.md`](https://github.com/Glavin001/atom-beautify/blob/master/docs/options.md).
|
See [all supported options in the documentation at `docs/options.md`](docs/options.md).
|
||||||
|
|
||||||
| Language | Grammars | File Extensions | Supported Beautifiers |
|
| Language | Grammars | File Extensions | Supported Beautifiers |
|
||||||
| --- | --- | --- | ---- |
|
| --- | --- | --- | ---- |
|
||||||
|
@ -74,6 +80,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g
|
||||||
| Erlang | `Erlang` |`.erl` | [`erl_tidy`](http://erlang.org/doc/man/erl_tidy.html) (Default) |
|
| Erlang | `Erlang` |`.erl` | [`erl_tidy`](http://erlang.org/doc/man/erl_tidy.html) (Default) |
|
||||||
| Fortran | `Fortran - Modern` |`.f90`, `.F90` | [`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` | [`Fortran Beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/fortran-beautifier/emacs-fortran-formating-script.lisp) (Default) |
|
||||||
| gherkin | `Gherkin` |`.feature` | [`Gherkin formatter`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/gherkin.coffee) (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) |
|
| Go | `Go` |`.go` | [`gofmt`](https://golang.org/cmd/gofmt/) (Default) |
|
||||||
| Handlebars | `Handlebars`, `HTML (Handlebars)` |`.hbs`, `.handlebars` | [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) |
|
| 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) |
|
| Haskell | `Haskell` |`.hs` | [`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell) (Default) |
|
||||||
|
@ -94,7 +101,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g
|
||||||
| OCaml | `OCaml` |`.ml` | [`ocp-indent`](https://www.typerex.org/ocp-indent.html) (Default) |
|
| OCaml | `OCaml` |`.ml` | [`ocp-indent`](https://www.typerex.org/ocp-indent.html) (Default) |
|
||||||
| Pawn | `Pawn` | | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) |
|
| Pawn | `Pawn` | | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) |
|
||||||
| Perl | `Perl`, `Perl 6` |`.pl` | [`Perltidy`](http://perltidy.sourceforge.net/) (Default) |
|
| Perl | `Perl`, `Perl 6` |`.pl` | [`Perltidy`](http://perltidy.sourceforge.net/) (Default) |
|
||||||
| PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](http://php.net/manual/en/install.php) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) |
|
| PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) |
|
||||||
| Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) |
|
| 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), [`yapf`](https://github.com/google/yapf) |
|
||||||
| R | `R` |`.r`, `.R` | [`formatR`](https://github.com/yihui/formatR) (Default) |
|
| R | `R` |`.r`, `.R` | [`formatR`](https://github.com/yihui/formatR) (Default) |
|
||||||
|
@ -160,22 +167,22 @@ For example:
|
||||||
|
|
||||||
Edit your `.jsbeautifyrc` file in any of the following locations:
|
Edit your `.jsbeautifyrc` file in any of the following locations:
|
||||||
|
|
||||||
- Atom Package Settings
|
- Atom Package Settings
|
||||||
`Atom` ➔ `Preferences` ➔ Search for `atom-beautify`
|
`Atom` ➔ `Preferences` ➔ Search for `atom-beautify`
|
||||||
- Same directory as current file
|
- Same directory as current file
|
||||||
- Project root
|
- Project root
|
||||||
`atom-beautify` will recursively look up from the current file's directory to find `.jsbeautifyrc`.
|
`atom-beautify` will recursively look up from the current file's directory to find `.jsbeautifyrc`.
|
||||||
- Your user's home directory
|
- Your user's home directory
|
||||||
|
|
||||||
**Note**: *Comments are supported in `.jsbeautifyrc` thanks to [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).*
|
**Note**: *Comments are supported in `.jsbeautifyrc` thanks to [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).*
|
||||||
|
|
||||||
See examples of both ways inside [`examples/`](https://github.com/donaldpipowitch/atom-beautify/tree/master/examples)
|
See examples of both ways inside [`examples/`](examples)
|
||||||
|
|
||||||
See [all supported options in the documentation at `docs/options.md`](https://github.com/Glavin001/atom-beautify/blob/master/docs/options.md).
|
See [all supported options in the documentation at `docs/options.md`](docs/options.md).
|
||||||
|
|
||||||
### Simple
|
### Simple
|
||||||
|
|
||||||
See [examples/simple-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowitch/atom-beautify/blob/master/examples/simple-jsbeautifyrc/.jsbeautifyrc).
|
See [examples/simple-jsbeautifyrc/.jsbeautifyrc](examples/simple-jsbeautifyrc/.jsbeautifyrc).
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
@ -193,7 +200,7 @@ See [examples/simple-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowi
|
||||||
|
|
||||||
### Nested (Recommended)
|
### Nested (Recommended)
|
||||||
|
|
||||||
See [examples/nested-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowitch/atom-beautify/blob/master/examples/nested-jsbeautifyrc/.jsbeautifyrc).
|
See [examples/nested-jsbeautifyrc/.jsbeautifyrc](examples/nested-jsbeautifyrc/.jsbeautifyrc).
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
@ -231,16 +238,16 @@ See [examples/nested-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowi
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
See [`docs/troubleshooting.md`](https://github.com/Glavin001/atom-beautify/blob/master/docs/troubleshooting.md).
|
See [`docs/troubleshooting.md`](docs/troubleshooting.md).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
[See all contributors on GitHub](https://github.com/donaldpipowitch/atom-beautify/graphs/contributors).
|
[See all contributors on GitHub](../../graphs/contributors).
|
||||||
|
|
||||||
Please update the [CHANGELOG.md](https://github.com/donaldpipowitch/atom-beautify/blob/master/CHANGELOG.md),
|
Please update the [CHANGELOG.md](CHANGELOG.md),
|
||||||
add yourself as a contributor to the [package.json](https://github.com/donaldpipowitch/atom-beautify/blob/master/package.json),
|
add yourself as a contributor to the [package.json](package.json),
|
||||||
and submit a [Pull Request on GitHub](https://help.github.com/articles/using-pull-requests/).
|
and submit a [Pull Request on GitHub](https://help.github.com/articles/using-pull-requests/).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[MIT](https://github.com/donaldpipowitch/atom-beautify/blob/master/LICENSE.md) © [Glavin Wiechert](https://github.com/Glavin001)
|
[MIT](LICENSE.md) © [Glavin Wiechert](https://github.com/Glavin001)
|
||||||
|
|
121
docs/options.md
121
docs/options.md
|
@ -3000,6 +3000,100 @@ Indentation size/length (Supported by Gherkin formatter)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### [GLSL](#glsl)
|
||||||
|
|
||||||
|
**Supported Beautifiers**: [`clang-format`](#clang-format)
|
||||||
|
|
||||||
|
| Option | clang-format |
|
||||||
|
| --- | --- |
|
||||||
|
| `disabled` | :white_check_mark: |
|
||||||
|
| `default_beautifier` | :white_check_mark: |
|
||||||
|
| `beautify_on_save` | :white_check_mark: |
|
||||||
|
| `configPath` | :white_check_mark: |
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Options for language GLSL
|
||||||
|
|
||||||
|
##### [Disable Beautifying Language](#disable-beautifying-language)
|
||||||
|
|
||||||
|
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||||
|
|
||||||
|
**Type**: `boolean`
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Disable GLSL 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**: `clang-format`
|
||||||
|
|
||||||
|
**Type**: `string`
|
||||||
|
|
||||||
|
**Enum**: `clang-format`
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Default Beautifier to be used for GLSL
|
||||||
|
|
||||||
|
**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 GLSL 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.
|
||||||
|
|
||||||
|
##### [Config Path](#config-path)
|
||||||
|
|
||||||
|
**Namespace**: `glsl`
|
||||||
|
|
||||||
|
**Key**: `configPath`
|
||||||
|
|
||||||
|
**Type**: `string`
|
||||||
|
|
||||||
|
**Supported Beautifiers**: [`clang-format`](#clang-format)
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Path to clang-format config file. i.e. clang-format.cfg (Supported by clang-format)
|
||||||
|
|
||||||
|
**Example `.jsbeautifyrc` Configuration**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"glsl": {
|
||||||
|
"configPath": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### [Go](#go)
|
#### [Go](#go)
|
||||||
|
|
||||||
**Supported Beautifiers**: [`gofmt`](#gofmt)
|
**Supported Beautifiers**: [`gofmt`](#gofmt)
|
||||||
|
@ -16946,6 +17040,33 @@ sort imports (requires isort installed) (Supported by autopep8)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### clang-format
|
||||||
|
|
||||||
|
##### [Config Path](#config-path)
|
||||||
|
|
||||||
|
**Namespace**: `glsl`
|
||||||
|
|
||||||
|
**Key**: `configPath`
|
||||||
|
|
||||||
|
**Type**: `string`
|
||||||
|
|
||||||
|
**Supported Beautifiers**: [`clang-format`](#clang-format)
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Path to clang-format config file. i.e. clang-format.cfg (Supported by clang-format)
|
||||||
|
|
||||||
|
**Example `.jsbeautifyrc` Configuration**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"glsl": {
|
||||||
|
"configPath": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### coffee-fmt
|
### coffee-fmt
|
||||||
|
|
||||||
##### [Indent size](#indent-size)
|
##### [Indent size](#indent-size)
|
||||||
|
|
14
package.json
14
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "atom-beautify",
|
"name": "atom-beautify",
|
||||||
"main": "./src/beautify",
|
"main": "./src/beautify",
|
||||||
"version": "0.29.12",
|
"version": "0.29.14",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom",
|
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -110,6 +110,10 @@
|
||||||
{
|
{
|
||||||
"name": "Elias Baryshnikov",
|
"name": "Elias Baryshnikov",
|
||||||
"url": "https://github.com/qwemaze"
|
"url": "https://github.com/qwemaze"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Victor Uriarte",
|
||||||
|
"url": "https://github.com/vmuriart"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
|
@ -122,15 +126,14 @@
|
||||||
"bluebird": "^3.4.3",
|
"bluebird": "^3.4.3",
|
||||||
"coffee-fmt": "^0.12.0",
|
"coffee-fmt": "^0.12.0",
|
||||||
"coffee-formatter": "^0.1.2",
|
"coffee-formatter": "^0.1.2",
|
||||||
"coffee-script": "^1.10.0",
|
"coffee-script": "^1.11.0",
|
||||||
"csscomb": "^3.1.7",
|
"csscomb": "^3.1.7",
|
||||||
"diff": "^3.0.0",
|
"diff": "3.0.0",
|
||||||
"editorconfig": "^0.13.2",
|
"editorconfig": "^0.13.2",
|
||||||
"event-kit": "^2.1.0",
|
"event-kit": "^2.1.0",
|
||||||
"expand-home-dir": "0.0.3",
|
"expand-home-dir": "0.0.3",
|
||||||
"extend": "^3.0.0",
|
"extend": "^3.0.0",
|
||||||
"gherkin": "2.12.2",
|
"gherkin": "2.12.2",
|
||||||
"github": "^3.1.0",
|
|
||||||
"handlebars": "^4.0.2",
|
"handlebars": "^4.0.2",
|
||||||
"js-beautify": "^1.6.3",
|
"js-beautify": "^1.6.3",
|
||||||
"jscs": "^3.0.7",
|
"jscs": "^3.0.7",
|
||||||
|
@ -286,7 +289,8 @@
|
||||||
"ux markup",
|
"ux markup",
|
||||||
"cljfmt",
|
"cljfmt",
|
||||||
"bash",
|
"bash",
|
||||||
"beautysh"
|
"beautysh",
|
||||||
|
"glsl"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coffeelint": "^1.10.1",
|
"coffeelint": "^1.10.1",
|
||||||
|
|
|
@ -16,6 +16,7 @@ module.exports = class ClangFormat extends Beautifier
|
||||||
"C++": false
|
"C++": false
|
||||||
"C": false
|
"C": false
|
||||||
"Objective-C": false
|
"Objective-C": false
|
||||||
|
"GLSL": true
|
||||||
}
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
|
@ -11,6 +11,8 @@ module.exports = class JSBeautify extends Beautifier
|
||||||
Handlebars: true
|
Handlebars: true
|
||||||
Mustache: true
|
Mustache: true
|
||||||
JavaScript: true
|
JavaScript: true
|
||||||
|
EJS: true
|
||||||
|
JSX: true
|
||||||
JSON: true
|
JSON: true
|
||||||
CSS:
|
CSS:
|
||||||
indent_size: true
|
indent_size: true
|
||||||
|
|
|
@ -9,7 +9,7 @@ path = require('path')
|
||||||
module.exports = class PHPCSFixer extends Beautifier
|
module.exports = class PHPCSFixer extends Beautifier
|
||||||
|
|
||||||
name: 'PHP-CS-Fixer'
|
name: 'PHP-CS-Fixer'
|
||||||
link: "http://php.net/manual/en/install.php"
|
link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer"
|
||||||
|
|
||||||
options:
|
options:
|
||||||
PHP: true
|
PHP: true
|
||||||
|
@ -44,7 +44,7 @@ module.exports = class PHPCSFixer extends Beautifier
|
||||||
], {
|
], {
|
||||||
ignoreReturnCode: true
|
ignoreReturnCode: true
|
||||||
help: {
|
help: {
|
||||||
link: "http://php.net/manual/en/install.php"
|
link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(=>
|
.then(=>
|
||||||
|
|
|
@ -36,7 +36,7 @@ module.exports = class Remark extends Beautifier
|
||||||
return new @Promise((resolve, reject) ->
|
return new @Promise((resolve, reject) ->
|
||||||
try
|
try
|
||||||
remark = require 'remark'
|
remark = require 'remark'
|
||||||
cleanMarkdown = remark.process(text, options)
|
cleanMarkdown = remark().process(text, options).toString()
|
||||||
resolve cleanMarkdown
|
resolve cleanMarkdown
|
||||||
catch err
|
catch err
|
||||||
@error("Remark error: #{err}")
|
@error("Remark error: #{err}")
|
||||||
|
|
|
@ -29,10 +29,10 @@ $ = null
|
||||||
# }
|
# }
|
||||||
getScrollTop = (editor) ->
|
getScrollTop = (editor) ->
|
||||||
view = atom.views.getView(editor)
|
view = atom.views.getView(editor)
|
||||||
view.getScrollTop()
|
view?.getScrollTop()
|
||||||
setScrollTop = (editor, value) ->
|
setScrollTop = (editor, value) ->
|
||||||
view = atom.views.getView(editor)
|
view = atom.views.getView(editor)
|
||||||
view.setScrollTop value
|
view?.setScrollTop value
|
||||||
|
|
||||||
getCursors = (editor) ->
|
getCursors = (editor) ->
|
||||||
cursors = editor.getCursors()
|
cursors = editor.getCursors()
|
||||||
|
@ -281,239 +281,227 @@ beautifyDirectory = ({target}) ->
|
||||||
return
|
return
|
||||||
|
|
||||||
debug = () ->
|
debug = () ->
|
||||||
|
try
|
||||||
|
open = require("open")
|
||||||
|
fs ?= require "fs"
|
||||||
|
|
||||||
open = require("open")
|
plugin.checkUnsupportedOptions()
|
||||||
fs ?= require "fs"
|
|
||||||
GitHubApi = require("github")
|
|
||||||
github = new GitHubApi()
|
|
||||||
|
|
||||||
plugin.checkUnsupportedOptions()
|
# Get current editor
|
||||||
|
editor = atom.workspace.getActiveTextEditor()
|
||||||
|
|
||||||
# Get current editor
|
linkifyTitle = (title) ->
|
||||||
editor = atom.workspace.getActiveTextEditor()
|
title = title.toLowerCase()
|
||||||
|
p = title.split(/[\s,+#;,\/?:@&=+$]+/) # split into parts
|
||||||
|
sep = "-"
|
||||||
|
p.join(sep)
|
||||||
|
|
||||||
linkifyTitle = (title) ->
|
# Check if there is an active editor
|
||||||
title = title.toLowerCase()
|
if not editor?
|
||||||
p = title.split(/[\s,+#;,\/?:@&=+$]+/) # split into parts
|
return confirm("Active Editor not found.\n" +
|
||||||
sep = "-"
|
"Please select a Text Editor first to beautify.")
|
||||||
p.join(sep)
|
return unless confirm('Are you ready to debug Atom Beautify?')
|
||||||
|
debugInfo = ""
|
||||||
|
headers = []
|
||||||
|
tocEl = "<TABLEOFCONTENTS/>"
|
||||||
|
addInfo = (key, val) ->
|
||||||
|
if key?
|
||||||
|
debugInfo += "**#{key}**: #{val}\n\n"
|
||||||
|
else
|
||||||
|
debugInfo += "#{val}\n\n"
|
||||||
|
addHeader = (level, title) ->
|
||||||
|
debugInfo += "#{Array(level+1).join('#')} #{title}\n\n"
|
||||||
|
headers.push({
|
||||||
|
level, title
|
||||||
|
})
|
||||||
|
addHeader(1, "Atom Beautify - Debugging information")
|
||||||
|
debugInfo += "The following debugging information was " +
|
||||||
|
"generated by `Atom Beautify` on `#{new Date()}`." +
|
||||||
|
"\n\n---\n\n" +
|
||||||
|
tocEl +
|
||||||
|
"\n\n---\n\n"
|
||||||
|
|
||||||
# Check if there is an active editor
|
# Platform
|
||||||
if not editor?
|
addInfo('Platform', process.platform)
|
||||||
return confirm("Active Editor not found.\n" +
|
addHeader(2, "Versions")
|
||||||
"Please select a Text Editor first to beautify.")
|
|
||||||
return unless confirm('Are you ready to debug Atom Beautify?\n\n'+
|
|
||||||
'Warning: This will create an anonymous Gist on GitHub (publically accessible and cannot be easily deleted) '+
|
|
||||||
'containing the contents of your active Text Editor.\n'+
|
|
||||||
'Be sure to delete any private text from your active Text Editor before continuing '+
|
|
||||||
'to ensure you are not sharing undesirable private information.')
|
|
||||||
debugInfo = ""
|
|
||||||
headers = []
|
|
||||||
tocEl = "<TABLEOFCONTENTS/>"
|
|
||||||
addInfo = (key, val) ->
|
|
||||||
if key?
|
|
||||||
debugInfo += "**#{key}**: #{val}\n\n"
|
|
||||||
else
|
|
||||||
debugInfo += "#{val}\n\n"
|
|
||||||
addHeader = (level, title) ->
|
|
||||||
debugInfo += "#{Array(level+1).join('#')} #{title}\n\n"
|
|
||||||
headers.push({
|
|
||||||
level, title
|
|
||||||
})
|
|
||||||
addHeader(1, "Atom Beautify - Debugging information")
|
|
||||||
debugInfo += "The following debugging information was " +
|
|
||||||
"generated by `Atom Beautify` on `#{new Date()}`." +
|
|
||||||
"\n\n---\n\n" +
|
|
||||||
tocEl +
|
|
||||||
"\n\n---\n\n"
|
|
||||||
|
|
||||||
# Platform
|
|
||||||
addInfo('Platform', process.platform)
|
|
||||||
addHeader(2, "Versions")
|
|
||||||
|
|
||||||
|
|
||||||
# Atom Version
|
# Atom Version
|
||||||
addInfo('Atom Version', atom.appVersion)
|
addInfo('Atom Version', atom.appVersion)
|
||||||
|
|
||||||
|
|
||||||
# Atom Beautify Version
|
# Atom Beautify Version
|
||||||
addInfo('Atom Beautify Version', pkg.version)
|
addInfo('Atom Beautify Version', pkg.version)
|
||||||
addHeader(2, "Original file to be beautified")
|
addHeader(2, "Original file to be beautified")
|
||||||
|
|
||||||
|
|
||||||
# Original file
|
# Original file
|
||||||
#
|
|
||||||
# Get editor path and configurations for paths
|
|
||||||
filePath = editor.getPath()
|
|
||||||
|
|
||||||
# Path
|
|
||||||
addInfo('Original File Path', "`#{filePath}`")
|
|
||||||
|
|
||||||
# Get Grammar
|
|
||||||
grammarName = editor.getGrammar().name
|
|
||||||
|
|
||||||
# Grammar
|
|
||||||
addInfo('Original File Grammar', grammarName)
|
|
||||||
|
|
||||||
# Language
|
|
||||||
language = beautifier.getLanguage(grammarName, filePath)
|
|
||||||
addInfo('Original File Language', language?.name)
|
|
||||||
addInfo('Language namespace', language?.namespace)
|
|
||||||
|
|
||||||
# Beautifier
|
|
||||||
beautifiers = beautifier.getBeautifiers(language.name)
|
|
||||||
addInfo('Supported Beautifiers', _.map(beautifiers, 'name').join(', '))
|
|
||||||
selectedBeautifier = beautifier.getBeautifierForLanguage(language)
|
|
||||||
addInfo('Selected Beautifier', selectedBeautifier.name)
|
|
||||||
|
|
||||||
# Get current editor's text
|
|
||||||
text = editor.getText()
|
|
||||||
|
|
||||||
# Contents
|
|
||||||
codeBlockSyntax = (language?.name ? grammarName).toLowerCase().split(' ')[0]
|
|
||||||
addHeader(3, 'Original File Contents')
|
|
||||||
addInfo(null, "\n```#{codeBlockSyntax}\n#{text}\n```")
|
|
||||||
|
|
||||||
addHeader(3, 'Package Settings')
|
|
||||||
addInfo(null,
|
|
||||||
"The raw package settings options\n" +
|
|
||||||
"```json\n#{JSON.stringify(atom.config.get('atom-beautify'), undefined, 4)}\n```")
|
|
||||||
|
|
||||||
# Beautification Options
|
|
||||||
addHeader(2, "Beautification options")
|
|
||||||
# Get all options
|
|
||||||
allOptions = beautifier.getOptionsForPath(filePath, editor)
|
|
||||||
# Resolve options with promises
|
|
||||||
Promise.all(allOptions)
|
|
||||||
.then((allOptions) ->
|
|
||||||
# Extract options
|
|
||||||
[
|
|
||||||
editorOptions
|
|
||||||
configOptions
|
|
||||||
homeOptions
|
|
||||||
editorConfigOptions
|
|
||||||
] = allOptions
|
|
||||||
projectOptions = allOptions[4..]
|
|
||||||
|
|
||||||
preTransformedOptions = beautifier.getOptionsForLanguage(allOptions, language)
|
|
||||||
|
|
||||||
if selectedBeautifier
|
|
||||||
finalOptions = beautifier.transformOptions(selectedBeautifier, language.name, preTransformedOptions)
|
|
||||||
|
|
||||||
# Show options
|
|
||||||
# addInfo('All Options', "\n" +
|
|
||||||
# "All options extracted for file\n" +
|
|
||||||
# "```json\n#{JSON.stringify(allOptions, undefined, 4)}\n```")
|
|
||||||
addInfo('Editor Options', "\n" +
|
|
||||||
"Options from Atom Editor settings\n" +
|
|
||||||
"```json\n#{JSON.stringify(editorOptions, undefined, 4)}\n```")
|
|
||||||
addInfo('Config Options', "\n" +
|
|
||||||
"Options from Atom Beautify package settings\n" +
|
|
||||||
"```json\n#{JSON.stringify(configOptions, undefined, 4)}\n```")
|
|
||||||
addInfo('Home Options', "\n" +
|
|
||||||
"Options from `#{path.resolve(beautifier.getUserHome(), '.jsbeautifyrc')}`\n" +
|
|
||||||
"```json\n#{JSON.stringify(homeOptions, undefined, 4)}\n```")
|
|
||||||
addInfo('EditorConfig Options', "\n" +
|
|
||||||
"Options from [EditorConfig](http://editorconfig.org/) file\n" +
|
|
||||||
"```json\n#{JSON.stringify(editorConfigOptions, undefined, 4)}\n```")
|
|
||||||
addInfo('Project Options', "\n" +
|
|
||||||
"Options from `.jsbeautifyrc` files starting from directory `#{path.dirname(filePath)}` and going up to root\n" +
|
|
||||||
"```json\n#{JSON.stringify(projectOptions, undefined, 4)}\n```")
|
|
||||||
addInfo('Pre-Transformed Options', "\n" +
|
|
||||||
"Combined options before transforming them given a beautifier's specifications\n" +
|
|
||||||
"```json\n#{JSON.stringify(preTransformedOptions, undefined, 4)}\n```")
|
|
||||||
if selectedBeautifier
|
|
||||||
addHeader(3, 'Final Options')
|
|
||||||
addInfo(null,
|
|
||||||
"Final combined and transformed options that are used\n" +
|
|
||||||
"```json\n#{JSON.stringify(finalOptions, undefined, 4)}\n```")
|
|
||||||
|
|
||||||
#
|
#
|
||||||
logs = ""
|
# Get editor path and configurations for paths
|
||||||
logFilePathRegex = new RegExp('\\: \\[(.*)\\]')
|
filePath = editor.getPath()
|
||||||
subscription = logger.onLogging((msg) ->
|
|
||||||
# console.log('logging', msg)
|
# Path
|
||||||
sep = path.sep
|
addInfo('Original File Path', "`#{filePath}`")
|
||||||
logs += msg.replace(logFilePathRegex, (a,b) ->
|
|
||||||
s = b.split(sep)
|
# Get Grammar
|
||||||
i = s.indexOf('atom-beautify')
|
grammarName = editor.getGrammar().name
|
||||||
p = s.slice(i+2).join(sep)
|
|
||||||
# console.log('logging', arguments, s, i, p)
|
# Grammar
|
||||||
return ': ['+p+']'
|
addInfo('Original File Grammar', grammarName)
|
||||||
|
|
||||||
|
# Language
|
||||||
|
language = beautifier.getLanguage(grammarName, filePath)
|
||||||
|
addInfo('Original File Language', language?.name)
|
||||||
|
addInfo('Language namespace', language?.namespace)
|
||||||
|
|
||||||
|
# Beautifier
|
||||||
|
beautifiers = beautifier.getBeautifiers(language.name)
|
||||||
|
addInfo('Supported Beautifiers', _.map(beautifiers, 'name').join(', '))
|
||||||
|
selectedBeautifier = beautifier.getBeautifierForLanguage(language)
|
||||||
|
addInfo('Selected Beautifier', selectedBeautifier.name)
|
||||||
|
|
||||||
|
# Get current editor's text
|
||||||
|
text = editor.getText() or ""
|
||||||
|
|
||||||
|
# Contents
|
||||||
|
codeBlockSyntax = (language?.name ? grammarName).toLowerCase().split(' ')[0]
|
||||||
|
addHeader(3, 'Original File Contents')
|
||||||
|
addInfo(null, "\n```#{codeBlockSyntax}\n#{text}\n```")
|
||||||
|
|
||||||
|
addHeader(3, 'Package Settings')
|
||||||
|
addInfo(null,
|
||||||
|
"The raw package settings options\n" +
|
||||||
|
"```json\n#{JSON.stringify(atom.config.get('atom-beautify'), undefined, 4)}\n```")
|
||||||
|
|
||||||
|
# Beautification Options
|
||||||
|
addHeader(2, "Beautification options")
|
||||||
|
# Get all options
|
||||||
|
allOptions = beautifier.getOptionsForPath(filePath, editor)
|
||||||
|
# Resolve options with promises
|
||||||
|
Promise.all(allOptions)
|
||||||
|
.then((allOptions) ->
|
||||||
|
# Extract options
|
||||||
|
[
|
||||||
|
editorOptions
|
||||||
|
configOptions
|
||||||
|
homeOptions
|
||||||
|
editorConfigOptions
|
||||||
|
] = allOptions
|
||||||
|
projectOptions = allOptions[4..]
|
||||||
|
|
||||||
|
preTransformedOptions = beautifier.getOptionsForLanguage(allOptions, language)
|
||||||
|
|
||||||
|
if selectedBeautifier
|
||||||
|
finalOptions = beautifier.transformOptions(selectedBeautifier, language.name, preTransformedOptions)
|
||||||
|
|
||||||
|
# Show options
|
||||||
|
# addInfo('All Options', "\n" +
|
||||||
|
# "All options extracted for file\n" +
|
||||||
|
# "```json\n#{JSON.stringify(allOptions, undefined, 4)}\n```")
|
||||||
|
addInfo('Editor Options', "\n" +
|
||||||
|
"Options from Atom Editor settings\n" +
|
||||||
|
"```json\n#{JSON.stringify(editorOptions, undefined, 4)}\n```")
|
||||||
|
addInfo('Config Options', "\n" +
|
||||||
|
"Options from Atom Beautify package settings\n" +
|
||||||
|
"```json\n#{JSON.stringify(configOptions, undefined, 4)}\n```")
|
||||||
|
addInfo('Home Options', "\n" +
|
||||||
|
"Options from `#{path.resolve(beautifier.getUserHome(), '.jsbeautifyrc')}`\n" +
|
||||||
|
"```json\n#{JSON.stringify(homeOptions, undefined, 4)}\n```")
|
||||||
|
addInfo('EditorConfig Options', "\n" +
|
||||||
|
"Options from [EditorConfig](http://editorconfig.org/) file\n" +
|
||||||
|
"```json\n#{JSON.stringify(editorConfigOptions, undefined, 4)}\n```")
|
||||||
|
addInfo('Project Options', "\n" +
|
||||||
|
"Options from `.jsbeautifyrc` files starting from directory `#{path.dirname(filePath)}` and going up to root\n" +
|
||||||
|
"```json\n#{JSON.stringify(projectOptions, undefined, 4)}\n```")
|
||||||
|
addInfo('Pre-Transformed Options', "\n" +
|
||||||
|
"Combined options before transforming them given a beautifier's specifications\n" +
|
||||||
|
"```json\n#{JSON.stringify(preTransformedOptions, undefined, 4)}\n```")
|
||||||
|
if selectedBeautifier
|
||||||
|
addHeader(3, 'Final Options')
|
||||||
|
addInfo(null,
|
||||||
|
"Final combined and transformed options that are used\n" +
|
||||||
|
"```json\n#{JSON.stringify(finalOptions, undefined, 4)}\n```")
|
||||||
|
|
||||||
|
#
|
||||||
|
logs = ""
|
||||||
|
logFilePathRegex = new RegExp('\\: \\[(.*)\\]')
|
||||||
|
subscription = logger.onLogging((msg) ->
|
||||||
|
# console.log('logging', msg)
|
||||||
|
sep = path.sep
|
||||||
|
logs += msg.replace(logFilePathRegex, (a,b) ->
|
||||||
|
s = b.split(sep)
|
||||||
|
i = s.indexOf('atom-beautify')
|
||||||
|
p = s.slice(i+2).join(sep)
|
||||||
|
# console.log('logging', arguments, s, i, p)
|
||||||
|
return ': ['+p+']'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
cb = (result) ->
|
||||||
cb = (result) ->
|
subscription.dispose()
|
||||||
subscription.dispose()
|
addHeader(2, "Results")
|
||||||
addHeader(2, "Results")
|
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
addInfo('Beautified File Contents', "\n```#{codeBlockSyntax}\n#{result}\n```")
|
addInfo('Beautified File Contents', "\n```#{codeBlockSyntax}\n#{result}\n```")
|
||||||
# Diff
|
# Diff
|
||||||
JsDiff = require('diff')
|
JsDiff = require('diff')
|
||||||
diff = JsDiff.createPatch(filePath, text, \
|
if typeof result is "string"
|
||||||
result, "original", "beautified")
|
diff = JsDiff.createPatch(filePath or "", text or "", \
|
||||||
addInfo('Original vs. Beautified Diff', "\n```#{codeBlockSyntax}\n#{diff}\n```")
|
result or "", "original", "beautified")
|
||||||
|
addInfo('Original vs. Beautified Diff', "\n```#{codeBlockSyntax}\n#{diff}\n```")
|
||||||
|
|
||||||
addHeader(3, "Logs")
|
addHeader(3, "Logs")
|
||||||
addInfo(null, "```\n#{logs}\n```")
|
addInfo(null, "```\n#{logs}\n```")
|
||||||
|
|
||||||
# Build Table of Contents
|
# Build Table of Contents
|
||||||
toc = "## Table Of Contents\n"
|
toc = "## Table Of Contents\n"
|
||||||
for header in headers
|
for header in headers
|
||||||
###
|
###
|
||||||
- Heading 1
|
- Heading 1
|
||||||
- Heading 1.1
|
- Heading 1.1
|
||||||
###
|
###
|
||||||
indent = " " # 2 spaces
|
indent = " " # 2 spaces
|
||||||
bullet = "-"
|
bullet = "-"
|
||||||
indentNum = header.level - 2
|
indentNum = header.level - 2
|
||||||
if indentNum >= 0
|
if indentNum >= 0
|
||||||
toc += ("#{Array(indentNum+1).join(indent)}#{bullet} [#{header.title}](\##{linkifyTitle(header.title)})\n")
|
toc += ("#{Array(indentNum+1).join(indent)}#{bullet} [#{header.title}](\##{linkifyTitle(header.title)})\n")
|
||||||
# Replace TABLEOFCONTENTS
|
# Replace TABLEOFCONTENTS
|
||||||
debugInfo = debugInfo.replace(tocEl, toc)
|
debugInfo = debugInfo.replace(tocEl, toc)
|
||||||
|
|
||||||
# Save to clipboard
|
# Save to new TextEditor
|
||||||
# atom.clipboard.write(debugInfo)
|
atom.workspace.open()
|
||||||
github.gists.create({
|
.then((editor) ->
|
||||||
files: {
|
editor.setText(debugInfo)
|
||||||
"debug.md": {
|
confirm("""Please login to GitHub and create a Gist named \"debug.md\" (Markdown file) with your debugging information.
|
||||||
"content": debugInfo
|
Then add a link to your Gist in your GitHub Issue.
|
||||||
}
|
Thank you!
|
||||||
},
|
|
||||||
public: true,
|
Gist: https://gist.github.com/
|
||||||
description: "Atom-Beautify debugging information"
|
GitHub Issues: https://github.com/Glavin001/atom-beautify/issues
|
||||||
}, (err, res) ->
|
""")
|
||||||
# console.log(err, res)
|
|
||||||
if err
|
|
||||||
confirm("An error occurred when creating the Gist: "+err)
|
|
||||||
else
|
|
||||||
gistUrl = res.html_url
|
|
||||||
# Create Gist
|
|
||||||
open(gistUrl)
|
|
||||||
confirm("Your Atom Beautify debugging information can be found in the public Gist:\n#{res.html_url}\n\n" +
|
|
||||||
# 'You can now paste this into an Issue you are reporting here\n' +
|
|
||||||
# 'https://github.com/Glavin001/atom-beautify/issues/\n\n' +
|
|
||||||
# 'Please follow the contribution guidelines found at\n' +
|
|
||||||
# 'https://github.com/Glavin001/atom-beautify/blob/master/CONTRIBUTING.md\n\n' +
|
|
||||||
'Warning: Be sure to look over the debug info before you send it '+
|
|
||||||
'to ensure you are not sharing undesirable private information.\n\n'+
|
|
||||||
'If you want to delete this anonymous Gist read\n'+
|
|
||||||
'https://help.github.com/articles/deleting-an-anonymous-gist/'
|
|
||||||
)
|
)
|
||||||
# Create GitHub Issue
|
.catch((error) ->
|
||||||
return unless confirm("Would you like to create a new Issue on GitHub now?")
|
confirm("An error occurred when creating the Gist: "+error.message)
|
||||||
issueTemplate = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE.md")).toString()
|
)
|
||||||
body = issueTemplate.replace("<INSERT GIST HERE>", gistUrl)#.replace("<INSERT CODE HERE>", text)
|
try
|
||||||
open("https://github.com/Glavin001/atom-beautify/issues/new?body=#{encodeURIComponent(body)}")
|
beautifier.beautify(text, allOptions, grammarName, filePath)
|
||||||
|
.then(cb)
|
||||||
)
|
.catch(cb)
|
||||||
try
|
catch e
|
||||||
beautifier.beautify(text, allOptions, grammarName, filePath)
|
return cb(e)
|
||||||
.then(cb)
|
)
|
||||||
.catch(cb)
|
.catch((error) ->
|
||||||
catch e
|
stack = error.stack
|
||||||
return cb(e)
|
detail = error.description or error.message
|
||||||
)
|
atom?.notifications?.addError(error.message, {
|
||||||
|
stack, detail, dismissable : true
|
||||||
|
})
|
||||||
|
)
|
||||||
|
catch error
|
||||||
|
stack = error.stack
|
||||||
|
detail = error.description or error.message
|
||||||
|
atom?.notifications?.addError(error.message, {
|
||||||
|
stack, detail, dismissable : true
|
||||||
|
})
|
||||||
|
|
||||||
handleSaveEvent = ->
|
handleSaveEvent = ->
|
||||||
atom.workspace.observeTextEditors (editor) ->
|
atom.workspace.observeTextEditors (editor) ->
|
||||||
|
|
|
@ -9,6 +9,7 @@ module.exports = {
|
||||||
Supported Grammars
|
Supported Grammars
|
||||||
###
|
###
|
||||||
grammars: [
|
grammars: [
|
||||||
|
"EJS"
|
||||||
"JavaScript Template"
|
"JavaScript Template"
|
||||||
"HTML (Angular)"
|
"HTML (Angular)"
|
||||||
]
|
]
|
||||||
|
|
|
@ -16,6 +16,8 @@ module.exports = {
|
||||||
extensions: [
|
extensions: [
|
||||||
"f90"
|
"f90"
|
||||||
"F90"
|
"F90"
|
||||||
|
"f95"
|
||||||
|
"F95"
|
||||||
]
|
]
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
name: "GLSL"
|
||||||
|
namespace: "glsl"
|
||||||
|
|
||||||
|
###
|
||||||
|
Supported Grammars
|
||||||
|
###
|
||||||
|
grammars: [
|
||||||
|
"C"
|
||||||
|
"opencl"
|
||||||
|
"GLSL"
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
Supported extensions
|
||||||
|
###
|
||||||
|
extensions: [
|
||||||
|
"vert"
|
||||||
|
"frag"
|
||||||
|
]
|
||||||
|
|
||||||
|
options:
|
||||||
|
configPath:
|
||||||
|
type: 'string'
|
||||||
|
default: ""
|
||||||
|
description: "Path to clang-format config file. i.e. clang-format.cfg"
|
||||||
|
|
||||||
|
}
|
|
@ -30,6 +30,7 @@ module.exports = class Languages
|
||||||
"erb"
|
"erb"
|
||||||
"erlang"
|
"erlang"
|
||||||
"gherkin"
|
"gherkin"
|
||||||
|
"glsl"
|
||||||
"go"
|
"go"
|
||||||
"fortran"
|
"fortran"
|
||||||
"handlebars"
|
"handlebars"
|
||||||
|
|
|
@ -16,7 +16,7 @@ module.exports = {
|
||||||
Supported extensions
|
Supported extensions
|
||||||
###
|
###
|
||||||
extensions: [
|
extensions: [
|
||||||
'sld', 'xml', 'xhtml', 'xsd', 'xsl', 'jsp', 'gsp'
|
'sld', 'xml', 'xhtml', 'xsd', 'xsl', 'jsp', 'gsp', 'plist', 'recipe'
|
||||||
]
|
]
|
||||||
|
|
||||||
defaultBeautifier: "Pretty Diff"
|
defaultBeautifier: "Pretty Diff"
|
||||||
|
|
Loading…
Reference in New Issue