Merge branch 'master' into fix-beautify-file-option-for-lua-files
This commit is contained in:
commit
818cd5eec4
10
.travis.yml
10
.travis.yml
|
@ -82,9 +82,9 @@ before_install:
|
||||||
# CoffeeScript
|
# CoffeeScript
|
||||||
- npm install coffee-formatter
|
- npm install coffee-formatter
|
||||||
# OCaml
|
# OCaml
|
||||||
- opam init --auto-setup
|
# - opam init --auto-setup
|
||||||
# Init environment variables for opam
|
# Init environment variables for opam
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
# - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||||
eval `opam config env`;
|
# eval `opam config env`;
|
||||||
fi
|
# fi
|
||||||
- opam install --yes ocp-indent
|
# - opam install --yes ocp-indent
|
||||||
|
|
1
Brewfile
1
Brewfile
|
@ -1,4 +1,3 @@
|
||||||
tap 'homebrew/science'
|
|
||||||
tap 'homebrew/php'
|
tap 'homebrew/php'
|
||||||
tap 'caskroom/versions'
|
tap 'caskroom/versions'
|
||||||
brew 'uncrustify'
|
brew 'uncrustify'
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Next
|
# Next
|
||||||
- Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable
|
- Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable
|
||||||
|
- See [#601](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for tsx files
|
||||||
- Fix Beauify File option for .lua files
|
- Fix Beauify File option for .lua files
|
||||||
|
|
||||||
# v0.30.9 (2017-11-22)
|
# v0.30.9 (2017-11-22)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
[![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted)
|
[![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted)
|
||||||
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify)
|
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify)
|
||||||
|
|
||||||
**Sign up for Unibeautify Bot: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)**
|
**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)**
|
||||||
|
|
||||||
**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)**
|
**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)**
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
[![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted)
|
[![Paypal Donations](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X2RK5DKN6YXPJ&lc=CA&item_name=Atom%2dBeautify&item_number=atom%2dbeautify¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted)
|
||||||
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify)
|
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/unibeautify)
|
||||||
|
|
||||||
**Sign up for Unibeautify Bot: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)**
|
**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN](https://goo.gl/jmM4QN)**
|
||||||
|
|
||||||
**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)**
|
**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr](https://goo.gl/iEHBNr)**
|
||||||
|
|
||||||
|
@ -199,6 +199,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti
|
||||||
| Swig | `HTML (Swig)`, `SWIG` |`.swig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
| Swig | `HTML (Swig)`, `SWIG` |`.swig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||||
| Terraform | `Terraform` |`.tf` | **[`terraformfmt`](https://www.terraform.io/docs/commands/fmt.html)** |
|
| Terraform | `Terraform` |`.tf` | **[`terraformfmt`](https://www.terraform.io/docs/commands/fmt.html)** |
|
||||||
| TSS | `TSS` |`.tss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
| TSS | `TSS` |`.tss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||||
|
| TSX | `TypeScriptReact` |`.tsx` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** |
|
||||||
| Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
| Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||||
| TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** |
|
| TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** |
|
||||||
| UX Markup | `UX` |`.ux` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
| UX Markup | `UX` |`.ux` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||||
|
|
|
@ -7,3 +7,4 @@ language-lua
|
||||||
language-elm
|
language-elm
|
||||||
language-puppet
|
language-puppet
|
||||||
fuse
|
fuse
|
||||||
|
react
|
||||||
|
|
|
@ -12676,6 +12676,75 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### [TSX](#tsx)
|
||||||
|
|
||||||
|
**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter)
|
||||||
|
|
||||||
|
| Option | TypeScript Formatter |
|
||||||
|
| --- | --- |
|
||||||
|
| `disabled` | :white_check_mark: |
|
||||||
|
| `default_beautifier` | :white_check_mark: |
|
||||||
|
| `beautify_on_save` | :white_check_mark: |
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Options for language TSX
|
||||||
|
|
||||||
|
##### [Disable Beautifying Language](#disable-beautifying-language)
|
||||||
|
|
||||||
|
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||||
|
|
||||||
|
**Type**: `boolean`
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Disable TSX 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**: `TypeScript Formatter`
|
||||||
|
|
||||||
|
**Type**: `string`
|
||||||
|
|
||||||
|
**Enum**: `TypeScript Formatter`
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Default Beautifier to be used for TSX
|
||||||
|
|
||||||
|
**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 TSX 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.
|
||||||
|
|
||||||
#### [Twig](#twig)
|
#### [Twig](#twig)
|
||||||
|
|
||||||
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
|
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
class Test extends React.Component<Foo> {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="class">
|
||||||
|
<h2 className="anotherClass">
|
||||||
|
{this.foo.bar}
|
||||||
|
</h2>
|
||||||
|
{this.foo.bar.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
class Test extends React.Component<Foo> {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="class">
|
||||||
|
<h2 className= "anotherClass">
|
||||||
|
{this.foo.bar}
|
||||||
|
</h2>
|
||||||
|
{this.foo.bar.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
40
package.json
40
package.json
|
@ -161,27 +161,27 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"align-yaml": "^0.1.8",
|
"align-yaml": "^0.1.8",
|
||||||
"async": "^2.4.1",
|
"async": "^2.6.0",
|
||||||
"atom-message-panel": "^1.3.0",
|
"atom-message-panel": "^1.3.0",
|
||||||
"atom-space-pen-views": "^2.2.0",
|
"atom-space-pen-views": "^2.2.0",
|
||||||
"bluebird": "^3.5.0",
|
"bluebird": "^3.5.1",
|
||||||
"coffee-fmt": "^0.12.0",
|
"coffee-fmt": "^0.12.0",
|
||||||
"coffee-formatter": "^0.1.2",
|
"coffee-formatter": "^0.1.2",
|
||||||
"coffee-script": "^1.12.6",
|
"coffee-script": "^1.12.6",
|
||||||
"csscomb": "^4.2.0",
|
"csscomb": "^4.2.0",
|
||||||
"diff": "^3.2.0",
|
"diff": "^3.4.0",
|
||||||
"editorconfig": "^0.13.2",
|
"editorconfig": "^0.15.0",
|
||||||
"eslint": "^4.0.0",
|
"eslint": "^4.16.0",
|
||||||
"event-kit": "^2.3.0",
|
"event-kit": "^2.4.0",
|
||||||
"expand-home-dir": "0.0.3",
|
"expand-home-dir": "0.0.3",
|
||||||
"extend": "^3.0.1",
|
"extend": "^3.0.1",
|
||||||
"gherkin": "^2.12.2",
|
"gherkin": "^2.12.2",
|
||||||
"handlebars": "^4.0.10",
|
"handlebars": "^4.0.11",
|
||||||
"js-beautify": "^1.6.14",
|
"js-beautify": "^1.7.5",
|
||||||
"jscs": "^3.0.7",
|
"jscs": "^3.0.7",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"loophole": "^1.1.0",
|
"loophole": "^1.1.0",
|
||||||
"marko-prettyprint": "^1.3.6",
|
"marko-prettyprint": "^1.4.0",
|
||||||
"nginxbeautify": "^2.0.1",
|
"nginxbeautify": "^2.0.1",
|
||||||
"node-cljfmt": "0.5.3",
|
"node-cljfmt": "0.5.3",
|
||||||
"node-dir": "0.1.17",
|
"node-dir": "0.1.17",
|
||||||
|
@ -190,19 +190,19 @@
|
||||||
"prettydiff2": "^2.2.7",
|
"prettydiff2": "^2.2.7",
|
||||||
"pug-beautify": "^0.1.1",
|
"pug-beautify": "^0.1.1",
|
||||||
"remark": "6.0.1",
|
"remark": "6.0.1",
|
||||||
"season": "6.0.0",
|
"season": "^6.0.2",
|
||||||
"semver": "^5.3.0",
|
"semver": "^5.5.0",
|
||||||
"shell-env": "^0.3.0",
|
"shell-env": "^0.3.0",
|
||||||
"space-pen": "5.1.2",
|
"space-pen": "5.1.2",
|
||||||
"strip-json-comments": "^2.0.1",
|
"strip-json-comments": "^2.0.1",
|
||||||
"temp": "^0.8.3",
|
"temp": "^0.8.3",
|
||||||
"tidy-markdown": "2.0.3",
|
"tidy-markdown": "2.0.4",
|
||||||
"typescript": "2.4.1",
|
"typescript": "^2.6.2",
|
||||||
"typescript-formatter": "5.2.0",
|
"typescript-formatter": "^7.0.0",
|
||||||
"underscore-plus": "^1.6.6",
|
"underscore-plus": "^1.6.6",
|
||||||
"universal-analytics": "0.4.13",
|
"universal-analytics": "^0.4.16",
|
||||||
"which": "1.2.14",
|
"which": "^1.3.0",
|
||||||
"winston": "2.3.1",
|
"winston": "^2.4.0",
|
||||||
"yaml-front-matter": "3.4.0"
|
"yaml-front-matter": "3.4.0"
|
||||||
},
|
},
|
||||||
"activationHooks": [
|
"activationHooks": [
|
||||||
|
@ -281,7 +281,8 @@
|
||||||
"atom-beautify:beautify-language-xml",
|
"atom-beautify:beautify-language-xml",
|
||||||
"atom-beautify:beautify-language-xtemplate",
|
"atom-beautify:beautify-language-xtemplate",
|
||||||
"atom-beautify:beautify-language-yaml",
|
"atom-beautify:beautify-language-yaml",
|
||||||
"atom-beautify:beautify-language-terraform"
|
"atom-beautify:beautify-language-terraform",
|
||||||
|
"atom-beautify:beautify-language-tsx"
|
||||||
],
|
],
|
||||||
".tree-view .file .name": [
|
".tree-view .file .name": [
|
||||||
"atom-beautify:beautify-file"
|
"atom-beautify:beautify-file"
|
||||||
|
@ -416,7 +417,8 @@
|
||||||
"align-yaml",
|
"align-yaml",
|
||||||
"goimports",
|
"goimports",
|
||||||
"terraform",
|
"terraform",
|
||||||
"terraformfmt"
|
"terraformfmt",
|
||||||
|
"tsx"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coffeelint": "1.16.0"
|
"coffeelint": "1.16.0"
|
||||||
|
|
|
@ -54,6 +54,7 @@ describe "BeautifyLanguages", ->
|
||||||
dependentPackages = [
|
dependentPackages = [
|
||||||
'autocomplete-plus'
|
'autocomplete-plus'
|
||||||
'fuse'
|
'fuse'
|
||||||
|
'react'
|
||||||
# 'linter'
|
# 'linter'
|
||||||
# 'atom-typescript' # it logs too much...
|
# 'atom-typescript' # it logs too much...
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,14 @@ module.exports = class TypeScriptFormatter extends Beautifier
|
||||||
link: "https://github.com/vvakame/typescript-formatter"
|
link: "https://github.com/vvakame/typescript-formatter"
|
||||||
options: {
|
options: {
|
||||||
TypeScript: true
|
TypeScript: true
|
||||||
|
TSX: true
|
||||||
}
|
}
|
||||||
|
|
||||||
beautify: (text, language, options) ->
|
beautify: (text, language, options) ->
|
||||||
return new @Promise((resolve, reject) =>
|
return new @Promise((resolve, reject) =>
|
||||||
|
|
||||||
try
|
try
|
||||||
format = require("typescript-formatter/lib/formatter").default
|
format = require("typescript-formatter/lib/formatter").format
|
||||||
formatterUtils = require("typescript-formatter/lib/utils")
|
formatterUtils = require("typescript-formatter/lib/utils")
|
||||||
# @verbose('format', format, formatterUtils)
|
# @verbose('format', format, formatterUtils)
|
||||||
|
|
||||||
|
@ -25,8 +26,13 @@ module.exports = class TypeScriptFormatter extends Beautifier
|
||||||
opts.indentSize = options.indent_size
|
opts.indentSize = options.indent_size
|
||||||
opts.indentStyle = 'space'
|
opts.indentStyle = 'space'
|
||||||
|
|
||||||
|
if language is "TSX"
|
||||||
|
fileName = 'test.tsx'
|
||||||
|
else
|
||||||
|
fileName = ''
|
||||||
|
|
||||||
@verbose('typescript', text, opts)
|
@verbose('typescript', text, opts)
|
||||||
result = format('', text, opts)
|
result = format(fileName, text, opts)
|
||||||
@verbose(result)
|
@verbose(result)
|
||||||
resolve result
|
resolve result
|
||||||
catch e
|
catch e
|
||||||
|
|
|
@ -68,6 +68,7 @@ module.exports = class Languages
|
||||||
"svg"
|
"svg"
|
||||||
"swig"
|
"swig"
|
||||||
"tss"
|
"tss"
|
||||||
|
"tsx"
|
||||||
"twig"
|
"twig"
|
||||||
"typescript"
|
"typescript"
|
||||||
"ux_markup"
|
"ux_markup"
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
name: "TSX"
|
||||||
|
namespace: "tsx"
|
||||||
|
fallback: ['ts']
|
||||||
|
|
||||||
|
###
|
||||||
|
Supported Grammars
|
||||||
|
###
|
||||||
|
grammars: [
|
||||||
|
"TypeScriptReact"
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
Supported extensions
|
||||||
|
###
|
||||||
|
extensions: [
|
||||||
|
"tsx"
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
|
@ -7394,6 +7394,47 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tsx": {
|
||||||
|
"title": "TSX",
|
||||||
|
"type": "object",
|
||||||
|
"description": "Options for language TSX",
|
||||||
|
"collapsed": true,
|
||||||
|
"beautifiers": [
|
||||||
|
"TypeScript Formatter"
|
||||||
|
],
|
||||||
|
"grammars": [
|
||||||
|
"TypeScriptReact"
|
||||||
|
],
|
||||||
|
"extensions": [
|
||||||
|
"tsx"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"disabled": {
|
||||||
|
"title": "Disable Beautifying Language",
|
||||||
|
"order": -3,
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Disable TSX Beautification"
|
||||||
|
},
|
||||||
|
"default_beautifier": {
|
||||||
|
"title": "Default Beautifier",
|
||||||
|
"order": -2,
|
||||||
|
"type": "string",
|
||||||
|
"default": "TypeScript Formatter",
|
||||||
|
"description": "Default Beautifier to be used for TSX",
|
||||||
|
"enum": [
|
||||||
|
"TypeScript Formatter"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"beautify_on_save": {
|
||||||
|
"title": "Beautify On Save",
|
||||||
|
"order": -1,
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Automatically beautify TSX files on save"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"twig": {
|
"twig": {
|
||||||
"title": "Twig",
|
"title": "Twig",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
Loading…
Reference in New Issue