diff --git a/.github/stale.yml b/.github/stale.yml
new file mode 100644
index 0000000..f951363
--- /dev/null
+++ b/.github/stale.yml
@@ -0,0 +1,19 @@
+# Number of days of inactivity before an issue becomes stale
+daysUntilStale: 60
+# Number of days of inactivity before a stale issue is closed
+daysUntilClose: 7
+# Issues with these labels will never be considered stale
+exemptLabels:
+ - high priority
+ - pending-publication
+ - add-language
+ - add-beautifier
+# Label to use when marking an issue as stale
+staleLabel: stale
+# Comment to post when marking an issue as stale. Set to `false` to disable
+markComment: >
+ This issue has been automatically marked as stale because it has not had
+ recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you
+ for your contributions.
+# Comment to post when closing a stale issue. Set to `false` to disable
+closeComment: false
diff --git a/.travis.yml b/.travis.yml
index fc65e27..0b2e4ca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -92,12 +92,12 @@ before_install:
git clone --depth=1 https://github.com/Linuxbrew/brew.git ~/.linuxbrew || true;
fi
# Update Homebrew
- # - brew update
+ - brew update
- brew tap homebrew/dupes
- brew tap homebrew/versions
# Ruby language support
# - gem install ruby-beautify --verbose
- - gem install rubocop
+ # - gem install rubocop
- gem install htmlbeautifier
- gem install puppet-lint
# Sass language support
@@ -185,4 +185,10 @@ before_install:
pip install --user beautysh;
else
pip install beautysh;
- fi
\ No newline at end of file
+ fi
+ # terraform
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+ brew install terraform;
+ else
+ docker pull hashicorp/terraform;
+ fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a7cc332..e628c8e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,25 @@
# Next
- Fixes [#1773](https://github.com/Glavin001/atom-beautify/issues/1773) and [#793](https://github.com/Glavin001/atom-beautify/issues/793). ruby-beautify with Rubocop now respects `Exclude` settings, and properly loads inherited config files (like `~/.rubocop.yml`)
-- See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2!
- ...
+# v0.30.9 (2017-11-22)
+- Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed.
+
+# v0.30.8 (2017-11-22)
+- Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed.
+
+# v0.30.7 (2017-11-21)
+- Refactor handleSaveEvent to use onWillSave async ([#1924](https://github.com/Glavin001/atom-beautify/pull/1924), [#1895](https://github.com/Glavin001/atom-beautify/issues/1895))
+
+# v0.30.6 (2017-10-30)
+- See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt.
+- See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2!
+- Fix for [#1888](https://github.com/Glavin001/atom-beautify/issues/1888). Allow 0 for minor and patch versions of Docker
+- Add Atom-Beautify package settings menu item to Packages menu [#1869](https://github.com/Glavin001/atom-beautify/issues/1869)
+- Add `.ttslua` file extension to Lua language
+- Fix [#1638]. Update TypeScript Formatter dependency
+- Fix [#1833] `os.tmpDir` deprecation warning
+
# v0.30.5 (2017-08-11)
- Fix for [#1721](https://github.com/Glavin001/atom-beautify/issues/1721). Changes required due to TextBuffer.save becoming async in Atom 1.19
- Fixes [#1638](https://github.com/Glavin001/atom-beautify/issues/1638). Update type-formatter and Fixes indent size not supported
diff --git a/README-template.md b/README-template.md
index 5573201..911743d 100644
--- a/README-template.md
+++ b/README-template.md
@@ -1,4 +1,5 @@
# :lipstick: [{{package.name}}](https://github.com/Glavin001/atom-beautify)
+[![apm](https://img.shields.io/apm/dm/atom-beautify.svg)](https://atom.io/packages/atom-beautify)
[![Greenkeeper badge](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg)](https://greenkeeper.io/)
[![GitHub issues](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/issues)
[![GitHub stars](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/stargazers)
@@ -45,7 +46,7 @@ Atom Package: https://atom.io/packages/atom-beautify
apm install atom-beautify
```
-Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
+Or Settings/Preferences ➔ Install ➔ Search for `atom-beautify`
### Important Notice: Analytics
@@ -203,6 +204,8 @@ See [`docs/troubleshooting.md`](docs/troubleshooting.md).
## Contributing
+See [`CONTRIBUTING.md`](CONTRIBUTING.md).
+
[See all contributors on GitHub](../../graphs/contributors).
Please update the [CHANGELOG.md](CHANGELOG.md),
diff --git a/README.md b/README.md
index c33233e..c47e015 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# :lipstick: [atom-beautify](https://github.com/Glavin001/atom-beautify)
+[![apm](https://img.shields.io/apm/dm/atom-beautify.svg)](https://atom.io/packages/atom-beautify)
[![Greenkeeper badge](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg)](https://greenkeeper.io/)
[![GitHub issues](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/issues)
[![GitHub stars](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/stargazers)
@@ -45,7 +46,7 @@ Atom Package: https://atom.io/packages/atom-beautify
apm install atom-beautify
```
-Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
+Or Settings/Preferences ➔ Install ➔ Search for `atom-beautify`
### Important Notice: Analytics
@@ -111,6 +112,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall
| SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) with `docker pull unibeautify/sass-convert`
:bookmark_tabs: Manually:
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax
|
| sqlformat | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/andialbrecht/sqlparse and follow the instructions. |
| stylish-haskell | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/jaspervdj/stylish-haskell and follow the instructions. |
+| terraformfmt | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [Terraform (`terraform`)](https://www.terraform.io) with `docker pull hashicorp/terraform`
:bookmark_tabs: Manually:
1. Install [Terraform (`terraform`)](https://www.terraform.io) by following https://www.terraform.io
|
| Tidy Markdown | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| TypeScript Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Uncrustify | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) with `docker pull unibeautify/uncrustify`
:bookmark_tabs: Manually:
1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) by following https://github.com/uncrustify/uncrustify
|
@@ -178,6 +180,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti
| SQL | `SQL (Rails)`, `SQL` |`.sql` | **[`sqlformat`](https://github.com/andialbrecht/sqlparse)** |
| SVG | `SVG` |`.svg` | **[`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)** |
| TSS | `TSS` |`.tss` | **[`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)** |
@@ -316,6 +319,8 @@ See [`docs/troubleshooting.md`](docs/troubleshooting.md).
## Contributing
+See [`CONTRIBUTING.md`](CONTRIBUTING.md).
+
[See all contributors on GitHub](../../graphs/contributors).
Please update the [CHANGELOG.md](CHANGELOG.md),
diff --git a/appveyor.yml b/appveyor.yml
index cbf5041..bf21dfb 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -98,6 +98,10 @@ install:
- cinst emacs -y
- where emacs
+ # terraform
+ - cinst terraform -y
+ - where terraform
+
# FIXME: Enable allowEmptyChecksums, until someone fixes the checksum issue of php
- choco feature enable -n allowEmptyChecksums
# PHP
diff --git a/docs/add-languages-and-beautifiers.md b/docs/add-languages-and-beautifiers.md
index b702f91..5d9e053 100644
--- a/docs/add-languages-and-beautifiers.md
+++ b/docs/add-languages-and-beautifiers.md
@@ -11,8 +11,6 @@ You can use [`codo`](https://github.com/coffeedoc/codo) to build your own docume
After you make a change to language or beautifier `options` you will need to update the `options.json` file that is created on install.
```bash
-# Update src/options.json file to have new/changed options
-npm run postinstall
# Update documentation to include information about those options
npm run docs
```
diff --git a/docs/options.md b/docs/options.md
index 19e54ff..7f3311d 100644
--- a/docs/options.md
+++ b/docs/options.md
@@ -368,6 +368,23 @@ Options for SassConvert executable.
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*SassConvert*" and change it to your desired configuration.
+##### [Terraform](#terraform)
+
+**Important**: This option is only configurable from within Atom Beautify's setting panel.
+
+**Type**: `object`
+
+**Description**:
+
+Options for Terraform 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 "*Terraform*" and change it to your desired configuration.
+
##### [Uncrustify](#uncrustify)
**Important**: This option is only configurable from within Atom Beautify's setting panel.
@@ -12171,6 +12188,75 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff)
}
```
+#### [Terraform](#terraform)
+
+**Supported Beautifiers**: [`terraformfmt`](#terraformfmt)
+
+| Option | terraformfmt |
+| --- | --- |
+| `disabled` | :white_check_mark: |
+| `default_beautifier` | :white_check_mark: |
+| `beautify_on_save` | :white_check_mark: |
+
+**Description**:
+
+Options for language Terraform
+
+##### [Disable Beautifying Language](#disable-beautifying-language)
+
+**Important**: This option is only configurable from within Atom Beautify's setting panel.
+
+**Type**: `boolean`
+
+**Description**:
+
+Disable Terraform 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**: `terraformfmt`
+
+**Type**: `string`
+
+**Enum**: `terraformfmt`
+
+**Description**:
+
+Default Beautifier to be used for Terraform
+
+**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 Terraform 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.
+
#### [TSS](#tss)
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index df99d73..b01f828 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -16,3 +16,9 @@ The debugging results will be copied to your clipboard.
3. Create a file in your new Gist called `debug.md`.
4. Paste your debugging results from Atom beautify into `debug.md` file in your Gist.
5. Add a link to your Gist in your new Issue.
+
+## Common Issues
+
+> I receive an error when I try to install or update Atom Beautify
+
+Run `apm clean` from your terminal, then retry
\ No newline at end of file
diff --git a/examples/simple-jsbeautifyrc/terraform/expected/test.tf b/examples/simple-jsbeautifyrc/terraform/expected/test.tf
new file mode 100644
index 0000000..5f855b3
--- /dev/null
+++ b/examples/simple-jsbeautifyrc/terraform/expected/test.tf
@@ -0,0 +1,18 @@
+resource "aws_db_instance" "wordpress" {
+ # worng spaces # to much spaces
+
+ allocated_storage = 10
+ storage_type = "gp2"
+ engine = "mariadb"
+ engine_version = "10.0.24"
+
+ instance_class = "db.t2.micro"
+ identifier = "db-${var.env}"
+ name = "wordpress"
+
+ username = "wordpress"
+ password = "${var.wordpress_db_pass}"
+ db_subnet_group_name = "${aws_db_subnet_group.default.name}"
+ vpc_security_group_ids = ["${aws_security_group.RuleWebServerIn.id}"]
+ apply_immediately = true
+}
diff --git a/examples/simple-jsbeautifyrc/terraform/original/test.tf b/examples/simple-jsbeautifyrc/terraform/original/test.tf
new file mode 100644
index 0000000..702bfe8
--- /dev/null
+++ b/examples/simple-jsbeautifyrc/terraform/original/test.tf
@@ -0,0 +1,21 @@
+resource "aws_db_instance" "wordpress" {
+ # worng spaces
+ # to much spaces
+
+ allocated_storage = 10
+ storage_type = "gp2"
+ engine = "mariadb"
+ engine_version = "10.0.24"
+
+instance_class = "db.t2.micro"
+ identifier = "db-${var.env}"
+ name = "wordpress"
+
+
+
+ username = "wordpress"
+ password = "${var.wordpress_db_pass}"
+ db_subnet_group_name = "${aws_db_subnet_group.default.name}"
+ vpc_security_group_ids = ["${aws_security_group.RuleWebServerIn.id}"]
+ apply_immediately = true
+}
diff --git a/menus/atom-beautify.cson b/menus/atom-beautify.cson
index fdfd781..a0d2d54 100644
--- a/menus/atom-beautify.cson
+++ b/menus/atom-beautify.cson
@@ -25,6 +25,10 @@
'label': 'Debug'
'command': 'atom-beautify:help-debug-editor'
}
+ {
+ 'label': 'Settings'
+ 'command': 'atom-beautify:open-settings'
+ }
]
]
}
diff --git a/package.json b/package.json
index 0b76590..8898cdd 100644
--- a/package.json
+++ b/package.json
@@ -1,12 +1,12 @@
{
"name": "atom-beautify",
"main": "./src/beautify",
- "version": "0.30.5",
+ "version": "0.30.9",
"private": true,
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom",
"repository": {
"type": "git",
- "url": "https://github.com/Glavin001/atom-beautify"
+ "url": "git@github.com:Glavin001/atom-beautify.git"
},
"bugs": {
"url": "https://github.com/Glavin001/atom-beautify/issues"
@@ -146,10 +146,14 @@
{
"name": "Kamontat Chantrachirathumrong",
"url": "https://github.com/kamontat"
+ },
+ {
+ "name": "Steven Zeck",
+ "url": "https://github.com/szeck87"
}
],
"engines": {
- "atom": ">=1.6.0 <2.0.0"
+ "atom": ">=1.21.0 <2.0.0"
},
"dependencies": {
"align-yaml": "^0.1.8",
@@ -204,6 +208,7 @@
"atom-workspace": [
"atom-beautify:help-debug-editor",
"atom-beautify:beautify-editor",
+ "atom-beautify:open-settings",
"atom-beautify:migrate-settings",
"core:save",
"core:save-as",
@@ -271,7 +276,8 @@
"atom-beautify:beautify-language-visualforce",
"atom-beautify:beautify-language-xml",
"atom-beautify:beautify-language-xtemplate",
- "atom-beautify:beautify-language-yaml"
+ "atom-beautify:beautify-language-yaml",
+ "atom-beautify:beautify-language-terraform"
],
".tree-view .file .name": [
"atom-beautify:beautify-file"
@@ -404,7 +410,9 @@
"nginx beautify",
"golang template",
"align-yaml",
- "goimports"
+ "goimports",
+ "terraform",
+ "terraformfmt"
],
"devDependencies": {
"coffeelint": "1.16.0"
diff --git a/src/beautifiers/executable.coffee b/src/beautifiers/executable.coffee
index ef57a35..d2f876b 100644
--- a/src/beautifiers/executable.coffee
+++ b/src/beautifiers/executable.coffee
@@ -379,7 +379,7 @@ class HybridExecutable extends Executable
homepage: "https://www.docker.com/"
installation: "https://www.docker.com/get-docker"
version: {
- parse: (text) -> text.match(/version [0]*([1-9]\d*).[0]*([1-9]\d*).[0]*([1-9]\d*)/).slice(1).join('.')
+ parse: (text) -> text.match(/version [0]*([1-9]\d*).[0]*([0-9]\d*).[0]*([0-9]\d*)/).slice(1).join('.')
}
})
return @docker
diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee
index b3e630c..cc3f237 100644
--- a/src/beautifiers/index.coffee
+++ b/src/beautifiers/index.coffee
@@ -80,6 +80,7 @@ module.exports = class Beautifiers extends EventEmitter
'marko-beautifier'
'formatR'
'beautysh'
+ 'terraformfmt'
]
###
diff --git a/src/beautifiers/terraformfmt.coffee b/src/beautifiers/terraformfmt.coffee
new file mode 100644
index 0000000..f799898
--- /dev/null
+++ b/src/beautifiers/terraformfmt.coffee
@@ -0,0 +1,38 @@
+###
+Requires terraform installed
+###
+
+"use strict"
+Beautifier = require('./beautifier')
+
+module.exports = class Terraformfmt extends Beautifier
+ name: "terraformfmt"
+ link: "https://www.terraform.io/docs/commands/fmt.html"
+
+ options: {
+ Terraform: false
+ }
+
+ executables: [
+ {
+ name: "Terraform"
+ cmd: "terraform"
+ homepage: "https://www.terraform.io"
+ installation: "https://www.terraform.io"
+ version: {
+ parse: (text) -> text.match(/Terraform v(\d+\.\d+\.\d+)/)[1]
+ }
+ docker: {
+ image: "hashicorp/terraform"
+ }
+ }
+ ]
+
+ beautify: (text, language, options) ->
+ @exe("terraform").run([
+ "fmt"
+ tempFile = @tempFile("input", text)
+ ])
+ .then(=>
+ @readFile(tempFile)
+ )
diff --git a/src/beautify.coffee b/src/beautify.coffee
index 55f568f..af517ec 100644
--- a/src/beautify.coffee
+++ b/src/beautify.coffee
@@ -96,9 +96,10 @@ beautify = ({ editor, onSave, language }) ->
if not text?
# Do nothing, is undefined
# console.log 'beautifyCompleted'
+ return resolve(text)
else if text instanceof Error
showError(text)
- return reject(text)
+ return resolve(text)
else if typeof text is "string"
if oldText isnt text
@@ -127,15 +128,18 @@ beautify = ({ editor, onSave, language }) ->
# otherwise setScrollTop is not working, probably because the cursor
# addition happens asynchronously
setTimeout ( ->
-
# console.log "setScrollTop"
setScrollTop editor, origScrollTop
return resolve(text)
), 0
+ else
+ return setTimeout(() ->
+ resolve(text)
+ , 0)
else
error = new Error("Unsupported beautification result '#{text}'.")
showError(error)
- return reject(error)
+ return resolve(text)
# else
# console.log "Already Beautiful!"
@@ -506,20 +510,17 @@ debug = () ->
handleSaveEvent = ->
atom.workspace.observeTextEditors (editor) ->
- pendingPaths = {}
beautifyOnSaveHandler = ({path: filePath}) ->
- logger.verbose('Should beautify on this save?')
- if pendingPaths[filePath]
- logger.verbose("Editor with file path #{filePath} already beautified!")
- return
- buffer = editor.getBuffer()
path ?= require('path')
- # Get Grammar
- grammar = editor.getGrammar().name
# Get file extension
fileExtension = path.extname(filePath)
# Remove prefix "." (period) in fileExtension
fileExtension = fileExtension.substr(1)
+ # Set path of buffer for unsaved files
+ if editor.getPath() is undefined
+ editor.getBuffer().setPath(filePath)
+ # Get Grammar from the editor
+ grammar = editor.getGrammar().name
# Get language
languages = beautifier.languages.getLanguages({grammar, extension: fileExtension})
if languages.length < 1
@@ -535,27 +536,18 @@ handleSaveEvent = ->
beautify({editor, onSave: true})
.then(() ->
logger.verbose('Done beautifying file', filePath)
- if editor.isAlive() is true
- logger.verbose('Saving TextEditor...')
- # Store the filePath to prevent infinite looping
- # When Whitespace package has option "Ensure Single Trailing Newline" enabled
- # It will add a newline and keep the file from converging on a beautified form
- # and saving without emitting onDidSave event, because there were no changes.
- pendingPaths[filePath] = true
- Promise.resolve(editor.save()).then(() ->
- delete pendingPaths[filePath]
- logger.verbose('Saved TextEditor.')
- )
)
.catch((error) ->
return showError(error)
)
- disposable = editor.onDidSave(({path : filePath}) ->
- # TODO: Implement debouncing
+ disposable = editor.getBuffer().onWillSave(({path: filePath}) ->
beautifyOnSaveHandler({path: filePath})
)
plugin.subscriptions.add disposable
+openSettings = ->
+ atom.workspace.open('atom://config/packages/atom-beautify')
+
getUnsupportedOptions = ->
settings = atom.config.get('atom-beautify')
schema = atom.config.getSchema('atom-beautify')
@@ -622,10 +614,11 @@ plugin.activate = ->
@subscriptions.add handleSaveEvent()
@subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:beautify-editor", beautify
@subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:help-debug-editor", debug
+ @subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:open-settings", openSettings
@subscriptions.add atom.commands.add ".tree-view .file .name", "atom-beautify:beautify-file", beautifyFile
@subscriptions.add atom.commands.add ".tree-view .directory .name", "atom-beautify:beautify-directory", beautifyDirectory
@subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:migrate-settings", plugin.migrateSettings
@addLanguageCommands()
plugin.deactivate = ->
- @subscriptions.dispose()
+ @subscriptions.dispose()
\ No newline at end of file
diff --git a/src/languages/index.coffee b/src/languages/index.coffee
index 9ea2e36..7cc1e5c 100644
--- a/src/languages/index.coffee
+++ b/src/languages/index.coffee
@@ -77,6 +77,7 @@ module.exports = class Languages
"xml"
"xtemplate"
"yaml"
+ "terraform"
]
###
diff --git a/src/languages/terraform.coffee b/src/languages/terraform.coffee
new file mode 100644
index 0000000..16ad848
--- /dev/null
+++ b/src/languages/terraform.coffee
@@ -0,0 +1,20 @@
+module.exports = {
+
+ name: "Terraform"
+ namespace: "terraform"
+ fallback: ['js']
+
+ ###
+ Supported Grammars
+ ###
+ grammars: [
+ "Terraform"
+ ]
+
+ ###
+ Supported extensions
+ ###
+ extensions: [
+ "tf"
+ ]
+}
diff --git a/src/options.json b/src/options.json
index 8767e0d..0eca25e 100644
--- a/src/options.json
+++ b/src/options.json
@@ -9128,6 +9128,47 @@
}
}
},
+ "terraform": {
+ "title": "Terraform",
+ "type": "object",
+ "description": "Options for language Terraform",
+ "collapsed": true,
+ "beautifiers": [
+ "terraformfmt"
+ ],
+ "grammars": [
+ "Terraform"
+ ],
+ "extensions": [
+ "tf"
+ ],
+ "properties": {
+ "disabled": {
+ "title": "Disable Beautifying Language",
+ "order": -3,
+ "type": "boolean",
+ "default": false,
+ "description": "Disable Terraform Beautification"
+ },
+ "default_beautifier": {
+ "title": "Default Beautifier",
+ "order": -2,
+ "type": "string",
+ "default": "terraformfmt",
+ "description": "Default Beautifier to be used for Terraform",
+ "enum": [
+ "terraformfmt"
+ ]
+ },
+ "beautify_on_save": {
+ "title": "Beautify On Save",
+ "order": -1,
+ "type": "boolean",
+ "default": false,
+ "description": "Automatically beautify Terraform files on save"
+ }
+ }
+ },
"executables": {
"title": "Executables",
"type": "object",
@@ -9374,6 +9415,22 @@
"description": "Absolute path to the \"beautysh\" executable's binary/script."
}
}
+ },
+ "terraform": {
+ "key": "terraform",
+ "title": "Terraform",
+ "type": "object",
+ "collapsed": true,
+ "description": "Options for Terraform executable.",
+ "properties": {
+ "path": {
+ "key": "path",
+ "title": "Binary/Script Path",
+ "type": "string",
+ "default": "",
+ "description": "Absolute path to the \"terraform\" executable's binary/script."
+ }
+ }
}
}
}