Seems that Crystal dosen't have Windows support yet.

This commit is contained in:
Mark Tofan 2016-04-08 22:38:07 +03:00
parent 39e7901d5c
commit 992999b347
2 changed files with 81 additions and 8 deletions

View File

@ -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)

View File

@ -9,15 +9,25 @@ module.exports = class Crystal extends Beautifier
name: "crystal"
options: {
Crystal: false
Crystal: true
}
beautify: (text, language, options) ->
@run("crystal", [
'tool'
'format'
tempFile = @tempFile("temp", text)
], {ignoreReturnCode: true})
.then(=>
@readFile(tempFile)
# 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)
)