Merge branch 'master' into bug/nullgrammar
This commit is contained in:
commit
345c472008
|
@ -36,6 +36,7 @@ before_install:
|
|||
# - gem install ruby-beautify --verbose
|
||||
- gem install rubocop
|
||||
- gem install htmlbeautifier
|
||||
- gem install puppet-lint
|
||||
# Python language support
|
||||
- brew install python
|
||||
- pip install --upgrade autopep8
|
||||
|
|
|
@ -85,6 +85,9 @@ install:
|
|||
# HTMLBeautifier
|
||||
- gem install htmlbeautifier
|
||||
- where htmlbeautifier
|
||||
# Puppet-Lint
|
||||
- gem install puppet-lint
|
||||
- where puppet-lint
|
||||
|
||||
# emacs
|
||||
- cinst emacs -y
|
||||
|
|
221
docs/options.md
221
docs/options.md
|
@ -83,6 +83,18 @@ Supported options for each language.
|
|||
|
||||
---
|
||||
|
||||
#### [Arduino - Config Path](#arduino---config-path)
|
||||
|
||||
**Key**: `arduino_configPath`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`Uncrustify`](#uncrustify)
|
||||
|
||||
**Description**:
|
||||
|
||||
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
|
||||
|
||||
#### [C# - Config Path](#c---config-path)
|
||||
|
||||
**Key**: `cs_configPath`
|
||||
|
@ -261,6 +273,34 @@ If lists of assignments or properties should be vertically aligned for faster an
|
|||
|
||||
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
|
||||
|
||||
#### [gherkin - Indent size](#gherkin---indent-size)
|
||||
|
||||
**Key**: `gherkin_indent_size`
|
||||
|
||||
**Default**: `4`
|
||||
|
||||
**Type**: `integer`
|
||||
|
||||
**Supported Beautifiers**: [`Gherkin formatter`](#gherkin-formatter)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation size/length (Supported by Gherkin formatter)
|
||||
|
||||
#### [gherkin - Indent char](#gherkin---indent-char)
|
||||
|
||||
**Key**: `gherkin_indent_char`
|
||||
|
||||
**Default**: ` `
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`Gherkin formatter`](#gherkin-formatter)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation character (Supported by Gherkin formatter)
|
||||
|
||||
#### [Fortran - Emacs path](#fortran---emacs-path)
|
||||
|
||||
**Key**: `fortran_emacs_path`
|
||||
|
@ -911,6 +951,40 @@ Change case of identifiers (Supported by sqlformat)
|
|||
|
||||
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
|
||||
|
||||
#### [Language Config - Arduino - Disable Beautifying Language](#language-config---arduino---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_arduino_disabled`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable Arduino Beautification
|
||||
|
||||
#### [Language Config - Arduino - Default Beautifier](#language-config---arduino---default-beautifier)
|
||||
|
||||
**Key**: `language_arduino_default_beautifier`
|
||||
|
||||
**Default**: `Uncrustify`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `Uncrustify`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for Arduino
|
||||
|
||||
#### [Language Config - Arduino - Beautify On Save](#language-config---arduino---beautify-on-save)
|
||||
|
||||
**Key**: `language_arduino_beautify_on_save`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Automatically beautify Arduino files on save
|
||||
|
||||
#### [Language Config - C# - Disable Beautifying Language](#language-config---c---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_cs_disabled`
|
||||
|
@ -1217,6 +1291,40 @@ Default Beautifier to be used for ERB
|
|||
|
||||
Automatically beautify ERB files on save
|
||||
|
||||
#### [Language Config - gherkin - Disable Beautifying Language](#language-config---gherkin---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_gherkin_disabled`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable gherkin Beautification
|
||||
|
||||
#### [Language Config - gherkin - Default Beautifier](#language-config---gherkin---default-beautifier)
|
||||
|
||||
**Key**: `language_gherkin_default_beautifier`
|
||||
|
||||
**Default**: `Gherkin formatter`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `Gherkin formatter`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for gherkin
|
||||
|
||||
#### [Language Config - gherkin - Beautify On Save](#language-config---gherkin---beautify-on-save)
|
||||
|
||||
**Key**: `language_gherkin_beautify_on_save`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Automatically beautify gherkin files on save
|
||||
|
||||
#### [Language Config - Go - Disable Beautifying Language](#language-config---go---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_go_disabled`
|
||||
|
@ -1405,7 +1513,7 @@ Disable JavaScript Beautification
|
|||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `JS Beautify` `Pretty Diff`
|
||||
**Enum**: `JS Beautify` `JSCS Fixer` `Pretty Diff`
|
||||
|
||||
**Description**:
|
||||
|
||||
|
@ -1761,6 +1869,40 @@ Default Beautifier to be used for PHP
|
|||
|
||||
Automatically beautify PHP files on save
|
||||
|
||||
#### [Language Config - Puppet - Disable Beautifying Language](#language-config---puppet---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_puppet_disabled`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable Puppet Beautification
|
||||
|
||||
#### [Language Config - Puppet - Default Beautifier](#language-config---puppet---default-beautifier)
|
||||
|
||||
**Key**: `language_puppet_default_beautifier`
|
||||
|
||||
**Default**: `puppet-lint`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `puppet-lint`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for Puppet
|
||||
|
||||
#### [Language Config - Puppet - Beautify On Save](#language-config---puppet---beautify-on-save)
|
||||
|
||||
**Key**: `language_puppet_beautify_on_save`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Automatically beautify Puppet files on save
|
||||
|
||||
#### [Language Config - Python - Disable Beautifying Language](#language-config---python---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_python_disabled`
|
||||
|
@ -1999,6 +2141,40 @@ Default Beautifier to be used for SQL
|
|||
|
||||
Automatically beautify SQL files on save
|
||||
|
||||
#### [Language Config - SVG - Disable Beautifying Language](#language-config---svg---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_svg_disabled`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable SVG Beautification
|
||||
|
||||
#### [Language Config - SVG - Default Beautifier](#language-config---svg---default-beautifier)
|
||||
|
||||
**Key**: `language_svg_default_beautifier`
|
||||
|
||||
**Default**: `Pretty Diff`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `Pretty Diff`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for SVG
|
||||
|
||||
#### [Language Config - SVG - Beautify On Save](#language-config---svg---beautify-on-save)
|
||||
|
||||
**Key**: `language_svg_beautify_on_save`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Automatically beautify SVG files on save
|
||||
|
||||
#### [Language Config - Swig - Disable Beautifying Language](#language-config---swig---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_swig_disabled`
|
||||
|
@ -2246,6 +2422,18 @@ Supported options for each beautifier.
|
|||
|
||||
### Uncrustify
|
||||
|
||||
#### [Arduino - Config Path](#arduino---config-path)
|
||||
|
||||
**Key**: `arduino_configPath`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`Uncrustify`](#uncrustify)
|
||||
|
||||
**Description**:
|
||||
|
||||
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
|
||||
|
||||
#### [C# - Config Path](#c---config-path)
|
||||
|
||||
**Key**: `cs_configPath`
|
||||
|
@ -3065,6 +3253,37 @@ Add a space before an anonymous function's parens, ie. function () (Support
|
|||
Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pretty Diff)
|
||||
|
||||
|
||||
### Gherkin formatter
|
||||
|
||||
#### [gherkin - Indent size](#gherkin---indent-size)
|
||||
|
||||
**Key**: `gherkin_indent_size`
|
||||
|
||||
**Default**: `4`
|
||||
|
||||
**Type**: `integer`
|
||||
|
||||
**Supported Beautifiers**: [`Gherkin formatter`](#gherkin-formatter)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation size/length (Supported by Gherkin formatter)
|
||||
|
||||
#### [gherkin - Indent char](#gherkin---indent-char)
|
||||
|
||||
**Key**: `gherkin_indent_char`
|
||||
|
||||
**Default**: ` `
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`Gherkin formatter`](#gherkin-formatter)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation character (Supported by Gherkin formatter)
|
||||
|
||||
|
||||
### Fortran Beautifier
|
||||
|
||||
#### [Fortran - Emacs path](#fortran---emacs-path)
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
Feature: Description
|
||||
|
||||
Scenario Outline: This one will have examples
|
||||
Given the <given>
|
||||
Then the <then>
|
||||
|
||||
Examples:
|
||||
| what | then |
|
||||
| first value | first then |
|
||||
| second what value | second then value |
|
|
@ -0,0 +1,23 @@
|
|||
Feature: The description of the feature that
|
||||
might need to be wrapped
|
||||
onto multiple lines
|
||||
|
||||
Scenario: The description of the scenario that
|
||||
might need to be wrapped
|
||||
onto multiple lines
|
||||
Given I am in some state
|
||||
When I take some action
|
||||
# And I can add a comment
|
||||
Then I should see some outcome
|
||||
|
||||
# A comment gets moved above the tag
|
||||
@tag1
|
||||
Scenario: This scenario has a tag
|
||||
Then I should see some outcome
|
||||
|
||||
@tag1 @tag2
|
||||
Scenario: This scenario has two tags
|
||||
Then I should see some outcome
|
||||
|
||||
Scenario: This scenario does not have any tags
|
||||
Then I should see some outcome
|
|
@ -0,0 +1,9 @@
|
|||
Feature: Description
|
||||
|
||||
Scenario Outline: This one will have examples
|
||||
Given the <given>
|
||||
Then the <then>
|
||||
Examples:
|
||||
| what | then |
|
||||
| first value | first then|
|
||||
| second what|second then|
|
|
@ -0,0 +1,23 @@
|
|||
Feature: The description of the feature that
|
||||
might need to be wrapped
|
||||
onto multiple lines
|
||||
|
||||
Scenario: The description of the scenario that
|
||||
might need to be wrapped
|
||||
onto multiple lines
|
||||
Given I am in some state
|
||||
When I take some action
|
||||
# And I can add a comment
|
||||
Then I should see some outcome
|
||||
|
||||
@tag1
|
||||
# A comment gets moved above the tag
|
||||
Scenario: This scenario has a tag
|
||||
Then I should see some outcome
|
||||
|
||||
@tag1 @tag2
|
||||
Scenario: This scenario has two tags
|
||||
Then I should see some outcome
|
||||
|
||||
Scenario: This scenario does not have any tags
|
||||
Then I should see some outcome
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
|
||||
<title>Shopping List for
|
||||
<%= @date.strftime('%A, %d %B %Y') %></title>
|
||||
</head>
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
# Define quantum::generic_service
|
||||
#
|
||||
# This class implements basic ceilomer services.
|
||||
# It is derived from https://github.com/stackforge/puppet-quantum/blob/master/manifests/generic_service.pp
|
||||
#
|
||||
define quantum::generic_service (
|
||||
|
||||
$package_name = '',
|
||||
$package_ensure = 'present',
|
||||
|
||||
$service_name = '',
|
||||
$service_ensure = 'running',
|
||||
$service_enable = true,
|
||||
|
||||
$config_file_path = undef,
|
||||
$config_file_notify = 'default',
|
||||
$config_file_require = 'default',
|
||||
$config_file_replace = undef,
|
||||
$config_file_source = undef,
|
||||
$config_file_template = undef,
|
||||
$config_file_content = undef,
|
||||
$config_file_options_hash = { },
|
||||
|
||||
$config_dir_path = '/etc/quantum',
|
||||
) {
|
||||
|
||||
$distro_prefix = $::osfamily ? {
|
||||
RedHat => 'openstack-',
|
||||
Debian => '',
|
||||
}
|
||||
|
||||
$manage_package_name = pickx($package_name, "${distro_prefix}${name}")
|
||||
$manage_service_name = pickx($service_name, "${distro_prefix}${name}")
|
||||
$manage_config_file_path = pickx($config_file_path, "${config_dir_path}/${name}.conf")
|
||||
$manage_config_file_content = default_content($config_file_content, $config_file_template)
|
||||
$manage_config_file_notify = $config_file_notify ? {
|
||||
'default' => "Service[${name}]",
|
||||
'' => undef,
|
||||
default => $config_file_notify,
|
||||
}
|
||||
$manage_config_file_require = $config_file_require ? {
|
||||
'default' => "Package[${name}]",
|
||||
default => $config_file_require,
|
||||
}
|
||||
|
||||
if $package_ensure == 'absent' {
|
||||
$manage_service_enable = undef
|
||||
$manage_service_ensure = stopped
|
||||
$config_file_ensure = absent
|
||||
} else {
|
||||
$manage_service_enable = $service_enable ? {
|
||||
'' => undef,
|
||||
'undef' => undef,
|
||||
default => $service_enable,
|
||||
}
|
||||
$manage_service_ensure = $service_ensure ? {
|
||||
'' => undef,
|
||||
'undef' => undef,
|
||||
default => $service_ensure,
|
||||
}
|
||||
$config_file_ensure = present
|
||||
}
|
||||
|
||||
if ($manage_package_name) {
|
||||
package { $name:
|
||||
ensure => $package_ensure,
|
||||
name => $manage_package_name,
|
||||
}
|
||||
}
|
||||
|
||||
if ($manage_service_name) {
|
||||
service { $name:
|
||||
ensure => $manage_service_ensure,
|
||||
name => $manage_service_name,
|
||||
enable => $manage_service_enable,
|
||||
require => Package[$manage_package_name],
|
||||
}
|
||||
}
|
||||
|
||||
if $config_file_source
|
||||
or $manage_config_file_content {
|
||||
file { "${name}.conf":
|
||||
ensure => $config_file_ensure,
|
||||
path => $manage_config_file_path,
|
||||
mode => $config_file_mode,
|
||||
owner => $config_file_owner,
|
||||
group => $config_file_group,
|
||||
source => $config_file_source,
|
||||
content => $manage_config_file_content,
|
||||
notify => $manage_config_file_notify,
|
||||
require => $manage_config_file_require,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
# Define quantum::generic_service
|
||||
#
|
||||
# This class implements basic ceilomer services.
|
||||
# It is derived from https://github.com/stackforge/puppet-quantum/blob/master/manifests/generic_service.pp
|
||||
#
|
||||
define quantum::generic_service (
|
||||
|
||||
$package_name = '',
|
||||
$package_ensure = 'present',
|
||||
|
||||
$service_name = '',
|
||||
$service_ensure = 'running',
|
||||
$service_enable = true,
|
||||
|
||||
$config_file_path = undef,
|
||||
$config_file_notify = 'default',
|
||||
$config_file_require = 'default',
|
||||
$config_file_replace = undef,
|
||||
$config_file_source = undef,
|
||||
$config_file_template = undef,
|
||||
$config_file_content = undef,
|
||||
$config_file_options_hash = { },
|
||||
|
||||
$config_dir_path = '/etc/quantum',
|
||||
) {
|
||||
|
||||
$distro_prefix = $::osfamily ? {
|
||||
RedHat => 'openstack-',
|
||||
Debian => '',
|
||||
}
|
||||
|
||||
$manage_package_name = pickx($package_name, "${distro_prefix}${name}")
|
||||
$manage_service_name = pickx($service_name, "${distro_prefix}${name}")
|
||||
$manage_config_file_path = pickx($config_file_path, "${config_dir_path}/${name}.conf")
|
||||
$manage_config_file_content = default_content($config_file_content, $config_file_template)
|
||||
$manage_config_file_notify = $config_file_notify ? {
|
||||
'default' => "Service[${name}]",
|
||||
'' => undef,
|
||||
default => $config_file_notify,
|
||||
}
|
||||
$manage_config_file_require = $config_file_require ? {
|
||||
'default' => "Package[${name}]",
|
||||
default => $config_file_require,
|
||||
}
|
||||
|
||||
if $package_ensure == 'absent' {
|
||||
$manage_service_enable = undef
|
||||
$manage_service_ensure = stopped
|
||||
$config_file_ensure = absent
|
||||
} else {
|
||||
$manage_service_enable = $service_enable ? {
|
||||
'' => undef,
|
||||
'undef' => undef,
|
||||
default => $service_enable,
|
||||
}
|
||||
$manage_service_ensure = $service_ensure ? {
|
||||
'' => undef,
|
||||
'undef' => undef,
|
||||
default => $service_ensure,
|
||||
}
|
||||
$config_file_ensure = present
|
||||
}
|
||||
|
||||
if ($manage_package_name) {
|
||||
package { $name:
|
||||
ensure => $package_ensure,
|
||||
name => $manage_package_name,
|
||||
}
|
||||
}
|
||||
|
||||
if ($manage_service_name) {
|
||||
service { $name:
|
||||
ensure => $manage_service_ensure,
|
||||
name => $manage_service_name,
|
||||
enable => $manage_service_enable,
|
||||
require => Package[$manage_package_name],
|
||||
}
|
||||
}
|
||||
|
||||
if $config_file_source
|
||||
or $manage_config_file_content {
|
||||
file { "${name}.conf":
|
||||
ensure => $config_file_ensure,
|
||||
path => $manage_config_file_path,
|
||||
mode => $config_file_mode,
|
||||
owner => $config_file_owner,
|
||||
group => $config_file_group,
|
||||
source => $config_file_source,
|
||||
content => $manage_config_file_content,
|
||||
notify => $manage_config_file_notify,
|
||||
require => $manage_config_file_require,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
var Mist = React.createClass({
|
||||
renderList: function() {
|
||||
return this.props.items.map(function(item) {
|
||||
return <ListItem item={return <tag>{item}</tag>} key={item.id}/>;
|
||||
return <ListItem item={return <tag>{item}</tag>} key={item.id}/>;
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
<apex:page standardController="Contact">
|
||||
|
||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
||||
|
||||
</apex:page>
|
|
@ -1,15 +1,15 @@
|
|||
<apex:page standardController="Contact">
|
||||
|
||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
||||
|
||||
<apex:form >
|
||||
<apex:pageBlock title="Contact">
|
||||
<apex:pageBlockSection title="Editing">
|
||||
<apex:inputfield value="{!contact.firstname}"/>
|
||||
<apex:inputfield value="{!contact.lastname}"/>
|
||||
<apex:inputfield value="{!contact.salutation}"/>
|
||||
<apex:inputfield value="{!contact.birthdate}"/>
|
||||
<apex:commandButton action="{!save}" value="Save"/>
|
||||
<apex:inputfield value="{!contact.firstname}"/>
|
||||
<apex:inputfield value="{!contact.lastname}"/>
|
||||
<apex:inputfield value="{!contact.salutation}"/>
|
||||
<apex:inputfield value="{!contact.birthdate}"/>
|
||||
<apex:commandButton action="{!save}" value="Save"/>
|
||||
</apex:pageBlockSection>
|
||||
</apex:pageBlock>
|
||||
</apex:form>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<apex:page standardController="Contact">
|
||||
|
||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
||||
|
||||
<apex:pageBlock title="Contact">
|
||||
<apex:pageBlockSection title="Details">
|
||||
<apex:outputfield value="{!contact.firstname}"/>
|
||||
<apex:outputfield value="{!contact.lastname}"/>
|
||||
<apex:outputfield value="{!contact.salutation}"/>
|
||||
<apex:outputfield value="{!contact.birthdate}"/>
|
||||
<apex:outputfield value="{!contact.firstname}"/>
|
||||
<apex:outputfield value="{!contact.lastname}"/>
|
||||
<apex:outputfield value="{!contact.salutation}"/>
|
||||
<apex:outputfield value="{!contact.birthdate}"/>
|
||||
</apex:pageBlockSection>
|
||||
</apex:pageBlock>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "atom-beautify",
|
||||
"main": "./src/beautify",
|
||||
"version": "0.28.8",
|
||||
"version": "0.28.9",
|
||||
"private": true,
|
||||
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, and SQL in Atom",
|
||||
"repository": {
|
||||
|
@ -71,6 +71,7 @@
|
|||
"event-kit": "^1.2.0",
|
||||
"expand-home-dir": "0.0.2",
|
||||
"extend": "^2.0.1",
|
||||
"gherkin": "2.12.2",
|
||||
"handlebars": "^3.0.3",
|
||||
"js-beautify": "^1.5.7",
|
||||
"jscs": "^1.13.1",
|
||||
|
@ -78,7 +79,7 @@
|
|||
"loophole": "^1.0.0",
|
||||
"node-dir": "^0.1.8",
|
||||
"node-uuid": "^1.4.3",
|
||||
"prettydiff": "^1.12.8",
|
||||
"prettydiff": "^1.12.17",
|
||||
"space-pen": "^5.1.1",
|
||||
"strip-json-comments": "^1.0.2",
|
||||
"temp": "^0.8.3",
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
###
|
||||
###
|
||||
|
||||
"use strict"
|
||||
Beautifier = require('./beautifier')
|
||||
Lexer = require('gherkin').Lexer('en')
|
||||
logger = require('../logger')(__filename)
|
||||
|
||||
module.exports = class Gherkin extends Beautifier
|
||||
name: "Gherkin formatter"
|
||||
|
||||
options: {
|
||||
gherkin: true
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
return new @Promise((resolve, reject) ->
|
||||
recorder = {
|
||||
lines: []
|
||||
tags: []
|
||||
comments: []
|
||||
|
||||
last_obj: null
|
||||
|
||||
indent_to: (indent_level = 0) ->
|
||||
return options.indent_char.repeat(options.indent_size * indent_level)
|
||||
|
||||
write_blank: () ->
|
||||
@lines.push('')
|
||||
|
||||
write_indented: (content, indent = 0) ->
|
||||
for line in content.trim().split("\n")
|
||||
@lines.push("#{@indent_to(indent)}#{line.trim()}")
|
||||
|
||||
write_comments: (indent = 0) ->
|
||||
for comment in @comments.splice(0, @comments.length)
|
||||
@write_indented(comment, indent)
|
||||
|
||||
write_tags: (indent = 0) ->
|
||||
if @tags.length > 0
|
||||
@write_indented(@tags.splice(0, @tags.length).join(' '), indent)
|
||||
|
||||
comment: (value, line) ->
|
||||
logger.verbose({token: 'comment', value: value.trim(), line: line})
|
||||
@comments.push(value)
|
||||
|
||||
tag: (value, line) ->
|
||||
logger.verbose({token: 'tag', value: value, line: line})
|
||||
@tags.push(value)
|
||||
|
||||
feature: (keyword, name, description, line) ->
|
||||
logger.verbose({token: 'feature', keyword: keyword, name: name, description: description, line: line})
|
||||
|
||||
@write_comments(0)
|
||||
@write_tags(0)
|
||||
@write_indented("#{keyword}: #{name}", '')
|
||||
@write_indented(description, 1) if description
|
||||
|
||||
background: (keyword, name, description, line) ->
|
||||
logger.verbose({token: 'background', keyword: keyword, name: name, description: description, line: line})
|
||||
|
||||
@write_blank()
|
||||
@write_comments(1)
|
||||
@write_indented("#{keyword}: #{name}", 1)
|
||||
@write_indented(description, 2) if description
|
||||
|
||||
scenario: (keyword, name, description, line) ->
|
||||
logger.verbose({token: 'scenario', keyword: keyword, name: name, description: description, line: line})
|
||||
|
||||
@write_blank()
|
||||
@write_comments(1)
|
||||
@write_tags(1)
|
||||
@write_indented("#{keyword}: #{name}", 1)
|
||||
@write_indented(description, 2) if description
|
||||
|
||||
scenario_outline: (keyword, name, description, line) ->
|
||||
logger.verbose({token: 'outline', keyword: keyword, name: name, description: description, line: line})
|
||||
|
||||
@write_blank()
|
||||
@write_comments(1)
|
||||
@write_tags(1)
|
||||
@write_indented("#{keyword}: #{name}", 1)
|
||||
@write_indented(description, 2) if description
|
||||
|
||||
examples: (keyword, name, description, line) ->
|
||||
logger.verbose({token: 'examples', keyword: keyword, name: name, description: description, line: line})
|
||||
|
||||
@write_blank()
|
||||
@write_comments(2)
|
||||
@write_tags(2)
|
||||
@write_indented("#{keyword}: #{name}", 2)
|
||||
@write_indented(description, 3) if description
|
||||
|
||||
step: (keyword, name, line) ->
|
||||
logger.verbose({token: 'step', keyword: keyword, name: name, line: line})
|
||||
|
||||
@write_comments(2)
|
||||
@write_indented("#{keyword}#{name}", 2)
|
||||
|
||||
doc_string: (content_type, string, line) ->
|
||||
logger.verbose({token: 'doc_string', content_type: content_type, string: string, line: line})
|
||||
three_quotes = '"""'
|
||||
|
||||
@write_comments(2)
|
||||
@write_indented("#{three_quotes}#{content_type}\n#{string}\n#{three_quotes}", 3)
|
||||
|
||||
row: (cells, line) ->
|
||||
logger.verbose({token: 'row', cells: cells, line: line})
|
||||
|
||||
# TODO: need to collect rows so that we can align the vertical pipes to the widest columns
|
||||
# See Gherkin::Formatter::PrettyFormatter#table(rows)
|
||||
@write_comments(3)
|
||||
@write_indented("| #{cells.join(' | ')} |", 3)
|
||||
|
||||
eof: () ->
|
||||
logger.verbose({token: 'eof'})
|
||||
# If there were any comments left, treat them as step comments.
|
||||
@write_comments(2)
|
||||
}
|
||||
|
||||
lexer = new Lexer(recorder)
|
||||
lexer.scan(text)
|
||||
|
||||
loggerLevel = atom?.config.get('atom-beautify._loggerLevel')
|
||||
if loggerLevel is 'verbose'
|
||||
for line in recorder.lines
|
||||
logger.verbose("> #{line}")
|
||||
|
||||
resolve recorder.lines.join("\n")
|
||||
)
|
|
@ -39,6 +39,7 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
'coffee-fmt'
|
||||
'htmlbeautifier'
|
||||
'csscomb'
|
||||
'gherkin'
|
||||
'gofmt'
|
||||
'fortran-beautifier'
|
||||
'js-beautify'
|
||||
|
@ -46,6 +47,7 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
'perltidy'
|
||||
'php-cs-fixer'
|
||||
'prettydiff'
|
||||
'puppet-fix'
|
||||
'rubocop'
|
||||
'ruby-beautify'
|
||||
'rustfmt'
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = class PerlTidy extends Beautifier
|
|||
'--standard-output'
|
||||
'--standard-error-output'
|
||||
'--quiet'
|
||||
"--profile=#{options.perltidy_profile}" if options.perltidy_profile?
|
||||
"--profile=#{options.perltidy_profile}" if options.perltidy_profile?.length
|
||||
@tempFile("input", text)
|
||||
], help: {
|
||||
link: "http://perltidy.sourceforge.net/"
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
###
|
||||
Requires [puppet-link](http://puppet-lint.com/)
|
||||
###
|
||||
"use strict"
|
||||
Beautifier = require('./beautifier')
|
||||
|
||||
module.exports = class PuppetFix extends Beautifier
|
||||
# this is what displays as your Default Beautifier in Language Config
|
||||
name: "puppet-lint"
|
||||
|
||||
options: {
|
||||
Puppet: true
|
||||
}
|
||||
|
||||
cli: (options) ->
|
||||
if not options.puppet_path?
|
||||
return new Error("'puppet-lint' path is not set!" +
|
||||
" Please set this in the Atom Beautify package settings.")
|
||||
else
|
||||
return options.puppet_path
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
@run("puppet-lint", [
|
||||
'--fix'
|
||||
tempFile = @tempFile("input", text)
|
||||
], {
|
||||
ignoreReturnCode: true
|
||||
help: {
|
||||
link: "http://puppet-lint.com/"
|
||||
}
|
||||
})
|
||||
.then(=>
|
||||
@readFile(tempFile)
|
||||
)
|
|
@ -1,6 +1,7 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
scope = ['source.css']
|
||||
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
||||
module.exports = {
|
||||
|
||||
name: "gherkin"
|
||||
namespace: "gherkin"
|
||||
|
||||
grammars: [
|
||||
"Gherkin"
|
||||
]
|
||||
|
||||
extensions: [
|
||||
"feature"
|
||||
]
|
||||
|
||||
options:
|
||||
indent_size:
|
||||
type: 'integer'
|
||||
default: defaultIndentSize
|
||||
minimum: 0
|
||||
description: "Indentation size/length"
|
||||
indent_char:
|
||||
type: 'string'
|
||||
default: defaultIndentChar
|
||||
minimum: 0
|
||||
description: "Indentation character"
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
scope = ['text.html']
|
||||
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -22,6 +22,7 @@ module.exports = class Languages
|
|||
"d"
|
||||
"ejs"
|
||||
"erb"
|
||||
"gherkin"
|
||||
"go"
|
||||
"fortran"
|
||||
"handlebars"
|
||||
|
@ -38,6 +39,7 @@ module.exports = class Languages
|
|||
"pawn"
|
||||
"perl"
|
||||
"php"
|
||||
"puppet"
|
||||
"python"
|
||||
"ruby"
|
||||
"rust"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
scope = ['source.js']
|
||||
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
@ -27,7 +28,7 @@ module.exports = {
|
|||
defaultBeautifier: "JS Beautify"
|
||||
|
||||
###
|
||||
|
||||
|
||||
###
|
||||
options:
|
||||
# JavaScript
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
|
||||
name: "Puppet"
|
||||
namespace: "puppet"
|
||||
|
||||
###
|
||||
Supported Grammars
|
||||
###
|
||||
grammars: [
|
||||
"Puppet"
|
||||
]
|
||||
|
||||
###
|
||||
Supported extensions
|
||||
###
|
||||
extensions: [
|
||||
"pp"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
scope = ['source.python']
|
||||
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
scope = ['source.ruby']
|
||||
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
scope = ['source.sql']
|
||||
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
Loading…
Reference in New Issue