Add GN beautifier
This commit is contained in:
parent
8de12b9777
commit
187857e933
|
@ -1,4 +1,5 @@
|
||||||
# Next
|
# Next
|
||||||
|
- Add GN language and beautifier
|
||||||
- ...
|
- ...
|
||||||
|
|
||||||
# v0.30.9 (2017-11-22)
|
# v0.30.9 (2017-11-22)
|
||||||
|
|
|
@ -101,6 +101,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall
|
||||||
| formatR | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [Rscript (`rscript`)](https://github.com/yihui/formatR) with `docker pull unibeautify/rscript`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [Rscript (`rscript`)](https://github.com/yihui/formatR) by following https://github.com/yihui/formatR<br/> |
|
| formatR | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [Rscript (`rscript`)](https://github.com/yihui/formatR) with `docker pull unibeautify/rscript`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [Rscript (`rscript`)](https://github.com/yihui/formatR) by following https://github.com/yihui/formatR<br/> |
|
||||||
| Fortran Beautifier | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:<br/>1. Install [Emacs (`emacs`)](https://www.gnu.org/software/emacs/) by following https://www.gnu.org/software/emacs/<br/> |
|
| Fortran Beautifier | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:<br/>1. Install [Emacs (`emacs`)](https://www.gnu.org/software/emacs/) by following https://www.gnu.org/software/emacs/<br/> |
|
||||||
| Gherkin formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
|
| Gherkin formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
|
||||||
|
| GN | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:<br/>1. Install [gn (`gn`)](https://chromium.googlesource.com/chromium/src/tools/gn) by following https://www.chromium.org/developers/how-tos/get-the-code<br/> |
|
||||||
| gofmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://golang.org/cmd/gofmt/ and follow the instructions. |
|
| gofmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://golang.org/cmd/gofmt/ and follow the instructions. |
|
||||||
| goimports | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [goimports (`goimports`)](https://godoc.org/golang.org/x/tools/cmd/goimports) with `docker pull unibeautify/goimports`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [goimports (`goimports`)](https://godoc.org/golang.org/x/tools/cmd/goimports) by following https://godoc.org/golang.org/x/tools/cmd/goimports<br/> |
|
| goimports | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [goimports (`goimports`)](https://godoc.org/golang.org/x/tools/cmd/goimports) with `docker pull unibeautify/goimports`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [goimports (`goimports`)](https://godoc.org/golang.org/x/tools/cmd/goimports) by following https://godoc.org/golang.org/x/tools/cmd/goimports<br/> |
|
||||||
| hh_format | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://hhvm.com/ and follow the instructions. |
|
| hh_format | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://hhvm.com/ and follow the instructions. |
|
||||||
|
@ -159,6 +160,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti
|
||||||
| Fortran | `Fortran - Modern` |`.f90`, `.F90`, `.f95`, `.F95`, `.f03`, `.F03`, `.f08`, `.F08` | **[`Fortran Beautifier`](https://www.gnu.org/software/emacs/)** |
|
| Fortran | `Fortran - Modern` |`.f90`, `.F90`, `.f95`, `.F95`, `.f03`, `.F03`, `.f08`, `.F08` | **[`Fortran Beautifier`](https://www.gnu.org/software/emacs/)** |
|
||||||
| gherkin | `Gherkin` |`.feature` | **[`Gherkin formatter`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/gherkin.coffee)** |
|
| gherkin | `Gherkin` |`.feature` | **[`Gherkin formatter`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/gherkin.coffee)** |
|
||||||
| GLSL | `C`, `opencl`, `GLSL` |`.vert`, `.frag` | **[`clang-format`](https://clang.llvm.org/docs/ClangFormat.html)** |
|
| GLSL | `C`, `opencl`, `GLSL` |`.vert`, `.frag` | **[`clang-format`](https://clang.llvm.org/docs/ClangFormat.html)** |
|
||||||
|
| GN | `gn` |`.gn`, `.gni` | **[`GN`](https://chromium.googlesource.com/chromium/src/tools/gn)** |
|
||||||
| Go | `Go` |`.go` | **[`gofmt`](https://golang.org/cmd/gofmt/)**, [`goimports`](https://godoc.org/golang.org/x/tools/cmd/goimports) |
|
| Go | `Go` |`.go` | **[`gofmt`](https://golang.org/cmd/gofmt/)**, [`goimports`](https://godoc.org/golang.org/x/tools/cmd/goimports) |
|
||||||
| Golang Template | `HTML (Go)`, `Go Template` |`.gohtml` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
| Golang Template | `HTML (Go)`, `Go Template` |`.gohtml` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
|
||||||
| Handlebars | `Handlebars`, `HTML (Handlebars)` |`.hbs`, `.handlebars` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) |
|
| Handlebars | `Handlebars`, `HTML (Handlebars)` |`.hbs`, `.handlebars` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) |
|
||||||
|
|
|
@ -249,6 +249,23 @@ Options for Emacs executable.
|
||||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||||
3. Find the option "*Emacs*" and change it to your desired configuration.
|
3. Find the option "*Emacs*" and change it to your desired configuration.
|
||||||
|
|
||||||
|
##### [gn](#gn)
|
||||||
|
|
||||||
|
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||||
|
|
||||||
|
**Type**: `object`
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Options for gn executable.
|
||||||
|
|
||||||
|
**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 "*gn*" and change it to your desired configuration.
|
||||||
|
|
||||||
##### [goimports](#goimports)
|
##### [goimports](#goimports)
|
||||||
|
|
||||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||||
|
@ -3952,6 +3969,75 @@ Path to clang-format config file. i.e. clang-format.cfg (Supported by clang-form
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### [GN](#gn)
|
||||||
|
|
||||||
|
**Supported Beautifiers**: [`GN`](#gn)
|
||||||
|
|
||||||
|
| Option | GN |
|
||||||
|
| --- | --- |
|
||||||
|
| `disabled` | :white_check_mark: |
|
||||||
|
| `default_beautifier` | :white_check_mark: |
|
||||||
|
| `beautify_on_save` | :white_check_mark: |
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Options for language GN
|
||||||
|
|
||||||
|
##### [Disable Beautifying Language](#disable-beautifying-language)
|
||||||
|
|
||||||
|
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||||
|
|
||||||
|
**Type**: `boolean`
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Disable GN 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**: `GN`
|
||||||
|
|
||||||
|
**Type**: `string`
|
||||||
|
|
||||||
|
**Enum**: `GN`
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Default Beautifier to be used for GN
|
||||||
|
|
||||||
|
**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 GN 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.
|
||||||
|
|
||||||
#### [Go](#go)
|
#### [Go](#go)
|
||||||
|
|
||||||
**Supported Beautifiers**: [`gofmt`](#gofmt) [`goimports`](#goimports)
|
**Supported Beautifiers**: [`gofmt`](#gofmt) [`goimports`](#goimports)
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
shared_library("test") {
|
||||||
|
# NOSORT
|
||||||
|
sources = [
|
||||||
|
"z.cc",
|
||||||
|
"a.cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"//abc:deps",
|
||||||
|
]
|
||||||
|
include_dirs = [ "." ]
|
||||||
|
|
||||||
|
if (is_win) {
|
||||||
|
sources += [
|
||||||
|
"a.cpp",
|
||||||
|
"b.cpp",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
shared_library("test") {
|
||||||
|
|
||||||
|
# NOSORT
|
||||||
|
sources = [
|
||||||
|
"z.cc",
|
||||||
|
"a.cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
deps=["//abc:deps"]
|
||||||
|
include_dirs = [
|
||||||
|
".",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (is_win) {
|
||||||
|
sources += ["b.cpp","a.cpp"]
|
||||||
|
}
|
||||||
|
}
|
|
@ -277,7 +277,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-gn"
|
||||||
],
|
],
|
||||||
".tree-view .file .name": [
|
".tree-view .file .name": [
|
||||||
"atom-beautify:beautify-file"
|
"atom-beautify:beautify-file"
|
||||||
|
@ -412,7 +413,8 @@
|
||||||
"align-yaml",
|
"align-yaml",
|
||||||
"goimports",
|
"goimports",
|
||||||
"terraform",
|
"terraform",
|
||||||
"terraformfmt"
|
"terraformfmt",
|
||||||
|
"gn"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coffeelint": "1.16.0"
|
"coffeelint": "1.16.0"
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
###
|
||||||
|
Requires [gn](https://chromium.googlesource.com/chromium/src/tools/gn)
|
||||||
|
###
|
||||||
|
"use strict"
|
||||||
|
Beautifier = require('./beautifier')
|
||||||
|
path = require('path')
|
||||||
|
semver = require('semver')
|
||||||
|
|
||||||
|
module.exports = class GN extends Beautifier
|
||||||
|
name: "GN"
|
||||||
|
link: "https://chromium.googlesource.com/chromium/src/tools/gn"
|
||||||
|
executables: [
|
||||||
|
{
|
||||||
|
name: "gn"
|
||||||
|
cmd: "gn"
|
||||||
|
homepage: "https://chromium.googlesource.com/chromium/src/tools/gn"
|
||||||
|
installation: "https://www.chromium.org/developers/how-tos/get-the-code"
|
||||||
|
version: {
|
||||||
|
parse: (text) -> semver.clean("0.0." + text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
options: {
|
||||||
|
GN: false
|
||||||
|
}
|
||||||
|
|
||||||
|
beautify: (text, language, options, context) ->
|
||||||
|
cwd = context.filePath and path.dirname context.filePath
|
||||||
|
@exe("gn").run(["format", "--stdin"], {
|
||||||
|
cwd: cwd
|
||||||
|
onStdin: (stdin) ->
|
||||||
|
stdin.end text
|
||||||
|
})
|
|
@ -48,6 +48,7 @@ module.exports = class Beautifiers extends EventEmitter
|
||||||
'htmlbeautifier'
|
'htmlbeautifier'
|
||||||
'csscomb'
|
'csscomb'
|
||||||
'gherkin'
|
'gherkin'
|
||||||
|
'gn'
|
||||||
'gofmt'
|
'gofmt'
|
||||||
'goimports'
|
'goimports'
|
||||||
'latex-beautify'
|
'latex-beautify'
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
name: "GN"
|
||||||
|
namespace: "gn"
|
||||||
|
|
||||||
|
###
|
||||||
|
Supported Grammars
|
||||||
|
###
|
||||||
|
grammars: [
|
||||||
|
"gn"
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
Supported extensions
|
||||||
|
###
|
||||||
|
extensions: [
|
||||||
|
"gn"
|
||||||
|
"gni"
|
||||||
|
]
|
||||||
|
|
||||||
|
defaultBeautifier: "GN"
|
||||||
|
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ module.exports = class Languages
|
||||||
"erlang"
|
"erlang"
|
||||||
"gherkin"
|
"gherkin"
|
||||||
"glsl"
|
"glsl"
|
||||||
|
"gn"
|
||||||
"go"
|
"go"
|
||||||
"gohtml"
|
"gohtml"
|
||||||
"fortran"
|
"fortran"
|
||||||
|
|
|
@ -2079,6 +2079,48 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"gn": {
|
||||||
|
"title": "GN",
|
||||||
|
"type": "object",
|
||||||
|
"description": "Options for language GN",
|
||||||
|
"collapsed": true,
|
||||||
|
"beautifiers": [
|
||||||
|
"GN"
|
||||||
|
],
|
||||||
|
"grammars": [
|
||||||
|
"gn"
|
||||||
|
],
|
||||||
|
"extensions": [
|
||||||
|
"gn",
|
||||||
|
"gni"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"disabled": {
|
||||||
|
"title": "Disable Beautifying Language",
|
||||||
|
"order": -3,
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Disable GN Beautification"
|
||||||
|
},
|
||||||
|
"default_beautifier": {
|
||||||
|
"title": "Default Beautifier",
|
||||||
|
"order": -2,
|
||||||
|
"type": "string",
|
||||||
|
"default": "GN",
|
||||||
|
"description": "Default Beautifier to be used for GN",
|
||||||
|
"enum": [
|
||||||
|
"GN"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"beautify_on_save": {
|
||||||
|
"title": "Beautify On Save",
|
||||||
|
"order": -1,
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Automatically beautify GN files on save"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"go": {
|
"go": {
|
||||||
"title": "Go",
|
"title": "Go",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -9288,6 +9330,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"gn": {
|
||||||
|
"key": "gn",
|
||||||
|
"title": "gn",
|
||||||
|
"type": "object",
|
||||||
|
"collapsed": true,
|
||||||
|
"description": "Options for gn executable.",
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"key": "path",
|
||||||
|
"title": "Binary/Script Path",
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "Absolute path to the \"gn\" executable's binary/script."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"goimports": {
|
"goimports": {
|
||||||
"key": "goimports",
|
"key": "goimports",
|
||||||
"title": "goimports",
|
"title": "goimports",
|
||||||
|
|
Loading…
Reference in New Issue