Added language support for GLSL via clang-format

This commit is contained in:
Pascal Häusler 2016-12-05 15:05:43 +01:00
parent 55dad2903e
commit 640c71c2b9
6 changed files with 170 additions and 16 deletions

View File

@ -46,18 +46,18 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
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.
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.
### 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](https://github.com/Glavin001/atom-beautify/tree/unibeautify) for work in progress and [Issue #1174](https://github.com/Glavin001/atom-beautify/issues/1174).
See [`unibeautify` branch](../../tree/unibeautify) for work in progress and [Issue #1174](https://github.com/Glavin001/atom-beautify/issues/1174).
## 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 |
| --- | --- | --- | ---- |
@ -79,6 +79,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) |
| 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) |
| 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) |
| 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) |
@ -99,7 +100,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) |
| Pawn | `Pawn` | | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (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) |
| 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) |
@ -174,13 +175,13 @@ Edit your `.jsbeautifyrc` file in any of the following locations:
**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
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
{
@ -198,7 +199,7 @@ See [examples/simple-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowi
### 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
{
@ -236,16 +237,16 @@ See [examples/nested-jsbeautifyrc/.jsbeautifyrc](https://github.com/donaldpipowi
## Troubleshooting
See [`docs/troubleshooting.md`](https://github.com/Glavin001/atom-beautify/blob/master/docs/troubleshooting.md).
See [`docs/troubleshooting.md`](docs/troubleshooting.md).
## 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),
add yourself as a contributor to the [package.json](https://github.com/donaldpipowitch/atom-beautify/blob/master/package.json),
Please update the [CHANGELOG.md](CHANGELOG.md),
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/).
## 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)

View File

@ -2931,6 +2931,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)
**Supported Beautifiers**: [`gofmt`](#gofmt)
@ -16877,6 +16971,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
##### [Indent size](#indent-size)

View File

@ -288,7 +288,8 @@
"clojure beautifier",
"nunjucks",
"ux markup",
"cljfmt"
"cljfmt",
"glsl"
],
"devDependencies": {
"coffeelint": "^1.10.1",

View File

@ -16,6 +16,7 @@ module.exports = class ClangFormat extends Beautifier
"C++": false
"C": false
"Objective-C": false
"GLSL": true
}
###

29
src/languages/glsl.coffee Normal file
View File

@ -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"
}

View File

@ -29,6 +29,7 @@ module.exports = class Languages
"erb"
"erlang"
"gherkin"
"glsl"
"go"
"fortran"
"handlebars"