Merge branch 'master' of https://github.com/petrui/atom-beautify into petrui-master
This commit is contained in:
commit
0cf2ee5954
|
@ -74,4 +74,5 @@ before_install:
|
|||
- brew install ocaml opam
|
||||
- opam init --auto-setup
|
||||
- opam install --yes ocp-indent
|
||||
|
||||
# Crystal
|
||||
- brew install crystal-lang
|
||||
|
|
|
@ -74,6 +74,7 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
|
|||
- Requires [Elm-Format](https://github.com/avh4/elm-format)
|
||||
- [x] [Erlang](https://github.com/Glavin001/atom-beautify/pull/683)
|
||||
- Requires erlang syntax_tools to be installed
|
||||
- [x] [Crystal](https://github.com/Glavin001/atom-beautify/pull/900)
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
@ -1179,6 +1179,69 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
|
|||
}
|
||||
```
|
||||
|
||||
#### [Crystal](#crystal)
|
||||
|
||||
**Supported Beautifiers**: [`crystal`](#crystal)
|
||||
|
||||
**Description**:
|
||||
|
||||
Options for language Crystal
|
||||
|
||||
##### [Disable Beautifying Language](#disable-beautifying-language)
|
||||
|
||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable Crystal 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**: `crystal`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `crystal`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for Crystal
|
||||
|
||||
**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 Crystal 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.
|
||||
|
||||
#### [C#](#c-)
|
||||
|
||||
**Supported Beautifiers**: [`Uncrustify`](#uncrustify)
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
# A unicorn is a **legendary animal** (see the `Legendary` module) that has been
|
||||
# described since antiquity as a beast with a large, spiraling horn projecting
|
||||
# from its forhead.
|
||||
#
|
||||
# To create a unicorn:
|
||||
#
|
||||
# ```
|
||||
# unicorn = Unicorn.new
|
||||
# unicorn.speak
|
||||
# ```
|
||||
#
|
||||
# The above produces:
|
||||
#
|
||||
# ```text
|
||||
# "I'm a unicorn"
|
||||
# ```
|
||||
#
|
||||
# Check the number of horns with `#horns`.
|
||||
class Unicorn
|
||||
include Legendary
|
||||
|
||||
# Creates a unicorn with the specified number of *horns*.
|
||||
def initialize(@horns = 1)
|
||||
raise "Not a unicorn" if @horns != 1
|
||||
end
|
||||
|
||||
# Returns the number of horns this unicorn has
|
||||
#
|
||||
# ```
|
||||
# Unicorn.new.horns # => 1
|
||||
# ```
|
||||
def horns
|
||||
@horns
|
||||
end
|
||||
|
||||
# ditto
|
||||
def number_of_horns
|
||||
horns
|
||||
end
|
||||
|
||||
# Makes the unicorn speak to STDOUT
|
||||
def speak
|
||||
puts "I'm a unicorn"
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
class Helper
|
||||
end
|
||||
end
|
|
@ -0,0 +1,49 @@
|
|||
# A unicorn is a **legendary animal** (see the `Legendary` module) that has been
|
||||
# described since antiquity as a beast with a large, spiraling horn projecting
|
||||
# from its forhead.
|
||||
#
|
||||
# To create a unicorn:
|
||||
#
|
||||
# ```
|
||||
# unicorn = Unicorn.new
|
||||
# unicorn.speak
|
||||
# ```
|
||||
#
|
||||
# The above produces:
|
||||
#
|
||||
# ```text
|
||||
# "I'm a unicorn"
|
||||
# ```
|
||||
#
|
||||
# Check the number of horns with `#horns`.
|
||||
class Unicorn
|
||||
include Legendary
|
||||
|
||||
# Creates a unicorn with the specified number of *horns*.
|
||||
def initialize(@horns = 1)
|
||||
raise "Not a unicorn" if @horns != 1
|
||||
end
|
||||
|
||||
# Returns the number of horns this unicorn has
|
||||
#
|
||||
# ```
|
||||
# Unicorn.new.horns # => 1
|
||||
# ```
|
||||
def horns
|
||||
@horns
|
||||
end
|
||||
|
||||
# ditto
|
||||
def number_of_horns
|
||||
horns
|
||||
end
|
||||
|
||||
# Makes the unicorn speak to STDOUT
|
||||
def speak
|
||||
puts "I'm a unicorn"
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
class Helper
|
||||
end
|
||||
end
|
|
@ -0,0 +1,33 @@
|
|||
###
|
||||
Requires https://github.com/jaspervdj/stylish-haskell
|
||||
###
|
||||
|
||||
"use strict"
|
||||
Beautifier = require('./beautifier')
|
||||
|
||||
module.exports = class Crystal extends Beautifier
|
||||
name: "crystal"
|
||||
|
||||
options: {
|
||||
Crystal: true
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
# Seems that Crystal dosen't have Windows support yet.
|
||||
if @isWindows
|
||||
@Promise.reject(@commandNotFoundError(
|
||||
'crystal'
|
||||
{
|
||||
link: "http://crystal-lang.org"
|
||||
program: "crystal"
|
||||
})
|
||||
)
|
||||
else
|
||||
@run("crystal", [
|
||||
'tool',
|
||||
'format',
|
||||
tempFile = @tempFile("temp", text)
|
||||
], {ignoreReturnCode: true})
|
||||
.then(=>
|
||||
@readFile(tempFile)
|
||||
)
|
|
@ -38,6 +38,7 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
'coffee-formatter'
|
||||
'coffee-fmt'
|
||||
'clang-format'
|
||||
'crystal'
|
||||
'dfmt'
|
||||
'elm-format'
|
||||
'htmlbeautifier'
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
module.exports = {
|
||||
|
||||
name: "Crystal"
|
||||
namespace: "crystal"
|
||||
|
||||
###
|
||||
Supported Grammars
|
||||
###
|
||||
grammars: [
|
||||
"Crystal"
|
||||
]
|
||||
|
||||
###
|
||||
Supported extensions
|
||||
###
|
||||
extensions: [
|
||||
"cr"
|
||||
]
|
||||
|
||||
options: []
|
||||
|
||||
}
|
|
@ -19,6 +19,7 @@ module.exports = class Languages
|
|||
"coffeescript"
|
||||
"coldfusion"
|
||||
"cpp"
|
||||
"crystal"
|
||||
"css"
|
||||
"csv"
|
||||
"d"
|
||||
|
|
Loading…
Reference in New Issue