Merge branch 'master' of github.com:Glavin001/atom-beautify

This commit is contained in:
Glavin Wiechert 2016-09-04 22:53:10 -03:00
commit 2e1499fb6d
19 changed files with 362 additions and 385 deletions

View File

@ -86,6 +86,8 @@ before_install:
- gem install rubocop
- gem install htmlbeautifier
- gem install puppet-lint
# Sass language support
- gem install sass
# 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
@ -96,6 +98,9 @@ before_install:
- pip install --upgrade sqlparse
# Java, C, C++, C#, Objective-C, D, Pawn, Vala
- brew install uncrustify
# R
- brew tap homebrew/science
- brew install r
# PHP
- brew tap homebrew/homebrew-php
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then

View File

@ -63,7 +63,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g
| 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) |
| 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) |
| 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) |
| CSV | `CSV` |`.csv` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
| D | `D` |`.d` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default), [`dfmt`](https://github.com/Hackerpilot/dfmt) |
| EJS | `JavaScript Template`, `HTML (Angular)` | | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
@ -94,11 +94,12 @@ See [all supported options in the documentation at `docs/options.md`](https://g
| PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](http://php.net/manual/en/install.php) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) |
| 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) |
| 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) |
| Rust | `Rust` |`.rs`, `.rlib` | [`rustfmt`](https://github.com/nrc/rustfmt) (Default) |
| Sass | `Sass` |`.sass` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
| SCSS | `SCSS` |`.scss` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
| Sass | `Sass` |`.sass` | [`SassConvert`](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) (Default) |
| SCSS | `SCSS` |`.scss` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default), [`SassConvert`](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) |
| Spacebars | `Spacebars` | | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
| SQL | `SQL (Rails)`, `SQL` |`.sql` | [`sqlformat`](https://github.com/andialbrecht/sqlparse) (Default) |
| SVG | `SVG` |`.svg` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |

View File

@ -93,6 +93,9 @@ install:
# Puppet-Lint
- gem install puppet-lint
- where puppet-lint
# Sass
- gem install sass
- where sass-convert
# emacs
- cinst emacs -y

View File

@ -1407,27 +1407,27 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
#### [CSS](#css)
**Supported Beautifiers**: [`CSScomb`](#csscomb) [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff)
**Supported Beautifiers**: [`CSScomb`](#csscomb) [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) [`SassConvert`](#sassconvert)
| Option | CSScomb | JS Beautify | Pretty Diff |
| --- | --- | --- | --- |
| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `align_assignments` | :x: | :x: | :white_check_mark: |
| `configPath` | :white_check_mark: | :x: | :x: |
| `convert_quotes` | :x: | :x: | :white_check_mark: |
| `end_with_newline` | :x: | :white_check_mark: | :x: |
| `force_indentation` | :x: | :x: | :white_check_mark: |
| `indent_char` | :x: | :white_check_mark: | :white_check_mark: |
| `indent_comments` | :x: | :x: | :white_check_mark: |
| `indent_size` | :x: | :white_check_mark: | :white_check_mark: |
| `newline_between_rules` | :x: | :white_check_mark: | :white_check_mark: |
| `no_lead_zero` | :x: | :x: | :white_check_mark: |
| `predefinedConfig` | :white_check_mark: | :x: | :x: |
| `preserve_newlines` | :x: | :white_check_mark: | :white_check_mark: |
| `selector_separator_newline` | :x: | :white_check_mark: | :x: |
| `wrap_line_length` | :x: | :white_check_mark: | :white_check_mark: |
| Option | CSScomb | JS Beautify | Pretty Diff | SassConvert |
| --- | --- | --- | --- | --- |
| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `align_assignments` | :x: | :x: | :white_check_mark: | :x: |
| `configPath` | :white_check_mark: | :x: | :x: | :x: |
| `convert_quotes` | :x: | :x: | :white_check_mark: | :x: |
| `end_with_newline` | :x: | :white_check_mark: | :x: | :x: |
| `force_indentation` | :x: | :x: | :white_check_mark: | :x: |
| `indent_char` | :x: | :white_check_mark: | :white_check_mark: | :x: |
| `indent_comments` | :x: | :x: | :white_check_mark: | :x: |
| `indent_size` | :x: | :white_check_mark: | :white_check_mark: | :x: |
| `newline_between_rules` | :x: | :white_check_mark: | :white_check_mark: | :x: |
| `no_lead_zero` | :x: | :x: | :white_check_mark: | :x: |
| `predefinedConfig` | :white_check_mark: | :x: | :x: | :x: |
| `preserve_newlines` | :x: | :white_check_mark: | :white_check_mark: | :x: |
| `selector_separator_newline` | :x: | :white_check_mark: | :x: | :x: |
| `wrap_line_length` | :x: | :white_check_mark: | :white_check_mark: | :x: |
**Description**:
@ -1458,7 +1458,7 @@ Disable CSS Beautification
**Type**: `string`
**Enum**: `CSScomb` `JS Beautify` `Pretty Diff`
**Enum**: `CSScomb` `JS Beautify` `Pretty Diff` `SassConvert`
**Description**:
@ -8242,6 +8242,102 @@ sort imports (requires isort installed) (Supported by autopep8)
}
```
#### [R](#r)
**Supported Beautifiers**: [`formatR`](#formatr)
| Option | formatR |
| --- | --- |
| `disabled` | :white_check_mark: |
| `default_beautifier` | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: |
| `indent_size` | :white_check_mark: |
**Description**:
Options for language R
##### [Disable Beautifying Language](#disable-beautifying-language)
**Important**: This option is only configurable from within Atom Beautify's setting panel.
**Type**: `boolean`
**Description**:
Disable R 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**: `formatR`
**Type**: `string`
**Enum**: `formatR`
**Description**:
Default Beautifier to be used for R
**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 R 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 size](#indent-size)
**Namespace**: `r`
**Key**: `indent_size`
**Default**: `4`
**Type**: `integer`
**Supported Beautifiers**: [`formatR`](#formatr)
**Description**:
Indentation size/length (Supported by formatR)
**Example `.jsbeautifyrc` Configuration**
```json
{
"r": {
"indent_size": 4
}
}
```
#### [Riot.js](#riot.js)
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
@ -8665,25 +8761,13 @@ Path to rustfmt program (Supported by rustfmt)
#### [Sass](#sass)
**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff)
**Supported Beautifiers**: [`SassConvert`](#sassconvert)
| Option | CSScomb | Pretty Diff |
| --- | --- | --- |
| `disabled` | :white_check_mark: | :white_check_mark: |
| `default_beautifier` | :white_check_mark: | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: |
| `align_assignments` | :x: | :white_check_mark: |
| `configPath` | :white_check_mark: | :x: |
| `convert_quotes` | :x: | :white_check_mark: |
| `force_indentation` | :x: | :white_check_mark: |
| `indent_char` | :x: | :white_check_mark: |
| `indent_comments` | :x: | :white_check_mark: |
| `indent_size` | :x: | :white_check_mark: |
| `newline_between_rules` | :x: | :white_check_mark: |
| `no_lead_zero` | :x: | :white_check_mark: |
| `predefinedConfig` | :white_check_mark: | :x: |
| `preserve_newlines` | :x: | :white_check_mark: |
| `wrap_line_length` | :x: | :white_check_mark: |
| Option | SassConvert |
| --- | --- |
| `disabled` | :white_check_mark: |
| `default_beautifier` | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: |
**Description**:
@ -8710,11 +8794,11 @@ Disable Sass Beautification
**Important**: This option is only configurable from within Atom Beautify's setting panel.
**Default**: `Pretty Diff`
**Default**: `SassConvert`
**Type**: `string`
**Enum**: `CSScomb` `Pretty Diff`
**Enum**: `SassConvert`
**Description**:
@ -8744,331 +8828,27 @@ Automatically beautify Sass 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.
##### [Align assignments](#align-assignments)
**Namespace**: `css`
**Key**: `align_assignments`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
If lists of assignments or properties should be vertically aligned for faster and easier reading. (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"align_assignments": false
}
}
```
##### [comb custom config file](#comb-custom-config-file)
**Namespace**: `css`
**Key**: `configPath`
**Type**: `string`
**Supported Beautifiers**: [`CSScomb`](#csscomb)
**Description**:
Path to custom CSScomb config file, used in absense of a `.csscomb.json` or `.csscomb.cson` at the root of your project. (Supported by CSScomb)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"configPath": ""
}
}
```
##### [Convert quotes](#convert-quotes)
**Namespace**: `css`
**Key**: `convert_quotes`
**Default**: `none`
**Type**: `string`
**Enum**: `none` `double` `single`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Convert the quote characters delimiting strings from either double or single quotes to the other. (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"convert_quotes": "none"
}
}
```
##### [Force indentation](#force-indentation)
**Namespace**: `css`
**Key**: `force_indentation`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
if indentation should be forcefully applied to markup even if it disruptively adds unintended whitespace to the documents rendered output (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"force_indentation": false
}
}
```
##### [Indent char](#indent-char)
**Namespace**: `css`
**Key**: `indent_char`
**Default**: ` `
**Type**: `string`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Indentation character (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"indent_char": " "
}
}
```
##### [Indent comments](#indent-comments)
**Namespace**: `css`
**Key**: `indent_comments`
**Default**: `true`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Determines whether comments should be indented. (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"indent_comments": true
}
}
```
##### [Indent size](#indent-size)
**Namespace**: `css`
**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
{
"css": {
"indent_size": 4
}
}
```
##### [Newline between rules](#newline-between-rules)
**Namespace**: `css`
**Key**: `newline_between_rules`
**Default**: `true`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Add a newline between CSS rules (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"newline_between_rules": true
}
}
```
##### [No lead zero](#no-lead-zero)
**Namespace**: `css`
**Key**: `no_lead_zero`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
If in CSS values leading 0s immediately preceeding a decimal should be removed or prevented. (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"no_lead_zero": false
}
}
```
##### [comb predefined config](#comb-predefined-config)
**Namespace**: `css`
**Key**: `predefinedConfig`
**Default**: `csscomb`
**Type**: `string`
**Enum**: `csscomb` `yandex` `zen`
**Supported Beautifiers**: [`CSScomb`](#csscomb)
**Description**:
Used if neither a project or custom config file exists. (Supported by CSScomb)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"predefinedConfig": "csscomb"
}
}
```
##### [Preserve newlines](#preserve-newlines)
**Namespace**: `css`
**Key**: `preserve_newlines`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Retain empty lines. Consecutive empty lines will be converted to a single empty line. (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"preserve_newlines": false
}
}
```
##### [Wrap line length](#wrap-line-length)
**Namespace**: `css`
**Key**: `wrap_line_length`
**Type**: `integer`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"css": {
"wrap_line_length": 0
}
}
```
#### [SCSS](#scss)
**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff)
**Supported Beautifiers**: [`CSScomb`](#csscomb) [`Pretty Diff`](#pretty-diff) [`SassConvert`](#sassconvert)
| Option | CSScomb | Pretty Diff |
| --- | --- | --- |
| `disabled` | :white_check_mark: | :white_check_mark: |
| `default_beautifier` | :white_check_mark: | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: |
| `align_assignments` | :x: | :white_check_mark: |
| `configPath` | :white_check_mark: | :x: |
| `convert_quotes` | :x: | :white_check_mark: |
| `force_indentation` | :x: | :white_check_mark: |
| `indent_char` | :x: | :white_check_mark: |
| `indent_comments` | :x: | :white_check_mark: |
| `indent_size` | :x: | :white_check_mark: |
| `newline_between_rules` | :x: | :white_check_mark: |
| `no_lead_zero` | :x: | :white_check_mark: |
| `predefinedConfig` | :white_check_mark: | :x: |
| `preserve_newlines` | :x: | :white_check_mark: |
| `wrap_line_length` | :x: | :white_check_mark: |
| Option | CSScomb | Pretty Diff | SassConvert |
| --- | --- | --- | --- |
| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `align_assignments` | :x: | :white_check_mark: | :x: |
| `configPath` | :white_check_mark: | :x: | :x: |
| `convert_quotes` | :x: | :white_check_mark: | :x: |
| `force_indentation` | :x: | :white_check_mark: | :x: |
| `indent_char` | :x: | :white_check_mark: | :x: |
| `indent_comments` | :x: | :white_check_mark: | :x: |
| `indent_size` | :x: | :white_check_mark: | :x: |
| `newline_between_rules` | :x: | :white_check_mark: | :x: |
| `no_lead_zero` | :x: | :white_check_mark: | :x: |
| `predefinedConfig` | :white_check_mark: | :x: | :x: |
| `preserve_newlines` | :x: | :white_check_mark: | :x: |
| `wrap_line_length` | :x: | :white_check_mark: | :x: |
**Description**:
@ -9099,7 +8879,7 @@ Disable SCSS Beautification
**Type**: `string`
**Enum**: `CSScomb` `Pretty Diff`
**Enum**: `CSScomb` `Pretty Diff` `SassConvert`
**Description**:
@ -16654,6 +16434,35 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by C
```
### formatR
##### [Indent size](#indent-size)
**Namespace**: `r`
**Key**: `indent_size`
**Default**: `4`
**Type**: `integer`
**Supported Beautifiers**: [`formatR`](#formatr)
**Description**:
Indentation size/length (Supported by formatR)
**Example `.jsbeautifyrc` Configuration**
```json
{
"r": {
"indent_size": 4
}
}
```
### rustfmt
##### [Rustfmt path](#rustfmt-path)

View File

@ -5,6 +5,10 @@
Note that this will include a copy of your code.
If your code is private, please create a different sample of code that reproduces the problem.
Steps 2-5 are for older versions of Atom-Beautify.
In newer/latest version, Atom-Beautify will provide you with a
series of prompts and guide you to create an anonymous Gist with your debugging information.
1. In the Atom [command-palette](https://atom.io/packages/command-palette),
search for and run the command `Atom Beautify: Help Debug Editor`.
The debugging results will be copied to your clipboard.

View File

@ -0,0 +1,20 @@
# a single line of comments is preserved
1 + 1
if (TRUE) {
x = 1 # inline comments
} else {
x = 2
print("Oh no... ask the right bracket to go away!")
}
1 * 3 # one space before this comment will become two!
2 + 2 + 2 # 'short comments'
# only 'single quotes' are allowed in comments
df = data.frame(y = rnorm(100), x1 = rnorm(100), x2 = rnorm(100))
lm(y ~ x1 + x2, data = df)
1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 +
1 + 1 ## comments after a long line
## here is a long long long long long long long long long long long long long long
## long long long long long long comment

View File

@ -0,0 +1,16 @@
# a single line of comments is preserved
1+1
if(TRUE){
x=1 # inline comments
}else{
x=2;print('Oh no... ask the right bracket to go away!')}
1*3 # one space before this comment will become two!
2+2+2 # 'short comments'
# only 'single quotes' are allowed in comments
df=data.frame(y=rnorm(100),x1=rnorm(100),x2=rnorm(100))
lm(y~x1+x2, data=df)
1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 ## comments after a long line
## here is a long long long long long long long long long long long long long long long long long long long long comment

View File

@ -1,7 +1,18 @@
a {
line-height: 56px;
nav
ul
padding: 0
margin: 0
list-style: none
&:hover {
color: blue;
}
}
li
display: inline-block
a
display: block
text-decoration: none
padding: 6px 12px
html, body,
ul, ol
margin: 0
padding: 0

View File

@ -1,6 +1,21 @@
a {
line-height: 56px;
&:hover {
color: blue;
}
}
nav
ul
padding: 0
margin: 0
list-style: none
li
display: inline-block
a
display: block
text-decoration: none
padding: 6px 12px
html,body,
ul, ol
margin: 0
padding: 0

View File

@ -95,6 +95,10 @@
"name": "Arman Yessenamanov",
"url": "https://github.com/yesenarman"
},
{
"name": "Sebastian DiLorenzo",
"url": "https://github.com/Sebastian-D"
},
{
"name": "Émile Bergeron",
"url": "https://github.com/emileber"
@ -251,6 +255,7 @@
"pretty diff",
"pug beautify",
"puppet-lint",
"r",
"remark",
"rubocop",
"ruby beautify",
@ -263,7 +268,9 @@
"erl_tidy",
"marko beautifier",
"vue",
"vue beautifier"
"vue beautifier",
"sassconvert",
"formatr"
],
"devDependencies": {
"coffeelint": "^1.10.1",

View File

@ -12,7 +12,6 @@ module.exports = class JSBeautify extends Beautifier
predefinedConfig: true
CSS: true
LESS: true
Sass: true
SCSS: true
}

View File

@ -0,0 +1,5 @@
if(!("formatR" %in% installed.packages()[,"Package"])) install.packages("formatR",repos='http://cran.us.r-project.org')
library(formatR)
indent_size <- commandArgs(trailingOnly = TRUE)[1]
file <- commandArgs(trailingOnly = TRUE)[2]
tidy_source(text = readLines(file), indent = indent_size)

View File

@ -0,0 +1,25 @@
###
Requires [formatR](https://github.com/yihui/formatR)
###
path = require("path")
"use strict"
Beautifier = require('../beautifier')
module.exports = class R extends Beautifier
name: "formatR"
link: "https://github.com/yihui/formatR"
options: {
R: true
}
beautify: (text, language, options) ->
r_beautifier = path.resolve(__dirname, "formatR.r")
@run("Rscript", [
r_beautifier,
options.indent_size,
@tempFile("input", text),
'>',
@tempFile("input", text)
])

View File

@ -62,6 +62,7 @@ module.exports = class Beautifiers extends EventEmitter
'rubocop'
'ruby-beautify'
'rustfmt'
'sass-convert'
'sqlformat'
'stylish-haskell'
'tidy-markdown'
@ -70,6 +71,7 @@ module.exports = class Beautifiers extends EventEmitter
'yapf'
'erl_tidy'
'marko-beautifier'
'formatR'
]
###

View File

@ -55,7 +55,6 @@ module.exports = class PrettyDiff extends Beautifier
JavaScript: true
CSS: true
SCSS: true
Sass: true
JSON: true
TSS: true
Twig: true
@ -103,7 +102,7 @@ module.exports = class PrettyDiff extends Beautifier
lang = "css"
when "LESS"
lang = "less"
when "SCSS", "Sass"
when "SCSS"
lang = "scss"
when "TSS"
lang = "tss"

View File

@ -0,0 +1,20 @@
"use strict"
Beautifier = require('./beautifier')
module.exports = class SassConvert extends Beautifier
name: "SassConvert"
link: "http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax"
options:
# TODO: Add support for options
CSS: false
Sass: false
SCSS: false
beautify: (text, language, options, context) ->
lang = language.toLowerCase()
@run("sass-convert", [
@tempFile("input", text),
"--from", lang, "--to", lang
])

View File

@ -51,6 +51,7 @@ module.exports = class Languages
"php"
"puppet"
"python"
"r"
"riotjs"
"ruby"
"rust"

35
src/languages/r.coffee Normal file
View File

@ -0,0 +1,35 @@
# Get Atom defaults
scope = ['text.html']
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: "R"
namespace: "r"
###
Supported Grammars
###
grammars: [
"R"
]
###
Supported extensions
###
extensions: [
"r"
"R"
]
options:
indent_size:
type: 'integer'
default: defaultIndentSize
description: "Indentation size/length"
}

View File

@ -2,7 +2,7 @@ module.exports = {
name: "Sass"
namespace: "sass"
fallback: ['css', 'scss']
fallback: ['css']
###
Supported Grammars
@ -18,6 +18,6 @@ module.exports = {
"sass"
]
defaultBeautifier: "Pretty Diff"
defaultBeautifier: "SassConvert"
}