From 5c88e0ace9ad1ef79bddff8716ab5cc37778c33f Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 11:08:00 -0500 Subject: [PATCH 01/15] Create coldfusion.coffee --- src/languages/coldfusion.coffee | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/languages/coldfusion.coffee diff --git a/src/languages/coldfusion.coffee b/src/languages/coldfusion.coffee new file mode 100644 index 0000000..f86e33e --- /dev/null +++ b/src/languages/coldfusion.coffee @@ -0,0 +1,25 @@ +module.exports = { + + name: "CFML" + description: "Coldfusion Markup; cfscript is also handled via the prettydiff javascript parser" + namespace: "cfml" + + ### + Supported Grammars + ### + grammars: [ + "html" + ] + + ### + Supported extensions + ### + extensions: [ + "cfm" + "cfml" + "cfc" + ] + + options: [] + +} From 7f500909409df25e482ae38054ee76033ef45b3a Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 11:09:03 -0500 Subject: [PATCH 02/15] Update index.coffee --- src/languages/index.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/languages/index.coffee b/src/languages/index.coffee index 895b5b2..f848429 100644 --- a/src/languages/index.coffee +++ b/src/languages/index.coffee @@ -16,6 +16,7 @@ module.exports = class Languages "c-sharp" "c" "coffeescript" + "coldfusion" "cpp" "css" "csv" From 8cabb4cc4206bebd6dc79f677ba265479219b1a2 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 11:13:43 -0500 Subject: [PATCH 03/15] add coldfusion support pretty diff uses "html" as the lang for coldfusion https://github.com/Glavin001/atom-beautify/issues/354#issuecomment-165012711 --- src/beautifiers/prettydiff.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index d116434..a4f6d79 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -35,6 +35,7 @@ module.exports = class PrettyDiff extends Beautifier ] # Apply language-specific options CSV: true + CFML: true ERB: true EJS: true HTML: true @@ -65,6 +66,8 @@ module.exports = class PrettyDiff extends Beautifier switch language when "CSV" lang = "csv" + when "CFML" + lang = "html" when "EJS", "Twig" lang = "ejs" when "ERB" From a7a7485699126a223feb33ed14d00c7dc42a146b Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 11:23:26 -0500 Subject: [PATCH 04/15] create test source file for coldfusion add a sort of ugly cfc for testing --- .../coldfusion/original/test.cfc | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 examples/nested-jsbeautifyrc/coldfusion/original/test.cfc diff --git a/examples/nested-jsbeautifyrc/coldfusion/original/test.cfc b/examples/nested-jsbeautifyrc/coldfusion/original/test.cfc new file mode 100644 index 0000000..6d2a49f --- /dev/null +++ b/examples/nested-jsbeautifyrc/coldfusion/original/test.cfc @@ -0,0 +1,64 @@ + + + + variables.instance = structNew(); + return this; + + + + + + + + + + + + + + + + + + + + + + + + + + + initFormattingRules(); + local.reader = createObject("component", "foo.com.ExcelReader").init(arguments.filepath, arguments.sheetNumber); + local.data = local.reader.read(arguments.ignoreColumnPoint, arguments.dataStartRow); + local.data = local.reader.fixDateAndNumericColumns(local.data, variables.instance.dateColumns, variables.instance.numberColumns); + return local.data; + + + + + + + + + + + + + + + + + + + + + + + + + + + From 311fcfd89f4ba63ade60a1b019328445a3d8ca10 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 11:24:35 -0500 Subject: [PATCH 05/15] add expected result of test for coldfusion --- .../coldfusion/expected/test.cfc | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc diff --git a/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc b/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc new file mode 100644 index 0000000..cc39c3c --- /dev/null +++ b/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc @@ -0,0 +1,96 @@ + + + + variables.instance = structNew(); + return this; + + + + + + + + + + + + + + + + + + + + + + + + + + + initFormattingRules(); + local.reader = createObject("component", "foo.com.ExcelReader").init(arguments.filepath, arguments.sheetNumber); + local.data = local + .reader + .read(arguments.ignoreColumnPoint, arguments.dataStartRow); + local.data = local + .reader + .fixDateAndNumericColumns(local.data, variables.instance.dateColumns, variables.instance.numberColumns); + return local.data; + + + + + + + + + + + + + + + + + + + + + + + + + + From 9c05ae458cf4e3185538f3e32b9ba4c7e6040a11 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 12:06:43 -0500 Subject: [PATCH 06/15] update to js-beautify 1.6.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fe09044..c2ca47c 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "extend": "^3.0.0", "gherkin": "2.12.2", "handlebars": "^4.0.2", - "js-beautify": "^1.5.7", + "js-beautify": "^1.6.1", "jscs": "^2.1.1", "lodash": "3.10.1", "loophole": "^1.0.0", From 52d19ba9cf03dfe8f702cf0a8d46c13beabb46cf Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 13:14:00 -0500 Subject: [PATCH 07/15] upgrade prettydiff; revert js-beautify accidentally updated jsbeautify before; needed to update prettydiff. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c2ca47c..89084e8 100644 --- a/package.json +++ b/package.json @@ -84,13 +84,13 @@ "extend": "^3.0.0", "gherkin": "2.12.2", "handlebars": "^4.0.2", - "js-beautify": "^1.6.1", + "js-beautify": "^1.5.7", "jscs": "^2.1.1", "lodash": "3.10.1", "loophole": "^1.0.0", "node-dir": "^0.1.8", "node-uuid": "^1.4.3", - "prettydiff": "^1.16.0", + "prettydiff": "^1.16.1", "season": "^5.3.0", "space-pen": "^5.1.1", "strip-json-comments": "^1.0.2", From 4e778df37b2500199642fe9bfeb79a3b0779e993 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 13:22:28 -0500 Subject: [PATCH 08/15] rename from cfml to Coldfusion --- src/beautifiers/prettydiff.coffee | 4 ++-- src/languages/coldfusion.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index a4f6d79..35bb12b 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -35,7 +35,7 @@ module.exports = class PrettyDiff extends Beautifier ] # Apply language-specific options CSV: true - CFML: true + Coldfusion: true ERB: true EJS: true HTML: true @@ -66,7 +66,7 @@ module.exports = class PrettyDiff extends Beautifier switch language when "CSV" lang = "csv" - when "CFML" + when "Coldfusion" lang = "html" when "EJS", "Twig" lang = "ejs" diff --git a/src/languages/coldfusion.coffee b/src/languages/coldfusion.coffee index f86e33e..b70082a 100644 --- a/src/languages/coldfusion.coffee +++ b/src/languages/coldfusion.coffee @@ -1,6 +1,6 @@ module.exports = { - name: "CFML" + name: "Coldfusion" description: "Coldfusion Markup; cfscript is also handled via the prettydiff javascript parser" namespace: "cfml" From 09190db78b8e68978dd773036425292f4b60ae50 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 13:30:07 -0500 Subject: [PATCH 09/15] added coldfusion documentation --- docs/options.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/docs/options.md b/docs/options.md index 308f987..c4f2679 100644 --- a/docs/options.md +++ b/docs/options.md @@ -2192,6 +2192,61 @@ Automatically beautify CoffeeScript files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Language Config - CoffeeScript - Beautify On Save*" and change it to your desired configuration. +#### [Language Config - Coldfusion - Disable Beautifying Language](#language-config---coldfusion---disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable Coldfusion 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 "*Language Config - Coldfusion - Disable Beautifying Language*" and change it to your desired configuration. + +#### [Language Config - Coldfusion - Default Beautifier](#language-config---coldfusion---default-beautifier) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Default**: `Pretty Diff` + +**Type**: `string` + +**Enum**: `Pretty Diff` + +**Description**: + +Default Beautifier to be used for Coldfusion + +**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 "*Language Config - Coldfusion - Default Beautifier*" and change it to your desired configuration. + +#### [Language Config - Coldfusion - Beautify On Save](#language-config---coldfusion---beautify-on-save) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Automatically beautify Coldfusion 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 "*Language Config - Coldfusion - Beautify On Save*" and change it to your desired configuration. + #### [Language Config - C++ - Disable Beautifying Language](#language-config---c---disable-beautifying-language) **Important**: This option is only configurable from within Atom Beautify's setting panel. From 55f845df5f4c4e6887ce95b2b7f29d6d7457ee26 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 13:56:45 -0500 Subject: [PATCH 10/15] add options like html to see if that fixes indentation differences --- src/languages/coldfusion.coffee | 71 ++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/src/languages/coldfusion.coffee b/src/languages/coldfusion.coffee index b70082a..726c850 100644 --- a/src/languages/coldfusion.coffee +++ b/src/languages/coldfusion.coffee @@ -1,3 +1,10 @@ +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 + module.exports = { name: "Coldfusion" @@ -20,6 +27,68 @@ module.exports = { "cfc" ] - options: [] + options: + indent_inner_html: + type: 'boolean' + default: false + description: "Indent and sections." + indent_size: + type: 'integer' + default: defaultIndentSize + minimum: 0 + description: "Indentation size/length" + indent_char: + type: 'string' + default: defaultIndentChar + minimum: 0 + description: "Indentation character" + brace_style: + type: 'string' + default: "collapse" + enum: ["collapse", "expand", "end-expand", "none"] + description: "[collapse|expand|end-expand|none]" + indent_scripts: + type: 'string' + default: "normal" + enum: ["keep", "separate", "normal"] + description: "[keep|separate|normal]" + wrap_line_length: + type: 'integer' + default: 250 + description: "Maximum characters per line (0 disables)" + wrap_attributes: + type: 'string' + default: "auto" + enum: ["auto", "force"] + description: "Wrap attributes to new lines [auto|force]" + wrap_attributes_indent_size: + type: 'integer' + default: defaultIndentSize + minimum: 0 + description: "Indent wrapped attributes to after N characters" + preserve_newlines: + type: 'boolean' + default: true + description: "Preserve line-breaks" + max_preserve_newlines: + type: 'integer' + default: 10 + description: "Number of line-breaks to be preserved in one chunk" + unformatted: + type: 'array' + default: ['a', 'sub', 'sup', 'b', 'i', 'u'] + items: + type: 'string' + description: "List of tags (defaults to inline) that should not be reformatted" + end_with_newline: + type: 'boolean' + default: false + description: "End output with newline" + extra_liners: + type: 'array' + default: ['head', 'body', '/html'] + items: + type: 'string' + description: "List of tags (defaults to [head,body,/html] that should have an extra newline before them." } From c24b4b5cbce7b5565b45561bf8fdfed25841f5d6 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 14:27:46 -0500 Subject: [PATCH 11/15] simply test file --- .../coldfusion/expected/test.cfc | 92 +------------------ .../coldfusion/original/test.cfc | 72 ++------------- 2 files changed, 10 insertions(+), 154 deletions(-) diff --git a/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc b/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc index cc39c3c..d4d1b32 100644 --- a/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc +++ b/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc @@ -1,96 +1,8 @@ - + variables.instance = structNew(); return this; - - - - - - - - - - - - - - - - - - - - - - - - - initFormattingRules(); - local.reader = createObject("component", "foo.com.ExcelReader").init(arguments.filepath, arguments.sheetNumber); - local.data = local - .reader - .read(arguments.ignoreColumnPoint, arguments.dataStartRow); - local.data = local - .reader - .fixDateAndNumericColumns(local.data, variables.instance.dateColumns, variables.instance.numberColumns); - return local.data; - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/examples/nested-jsbeautifyrc/coldfusion/original/test.cfc b/examples/nested-jsbeautifyrc/coldfusion/original/test.cfc index 6d2a49f..d1c1d45 100644 --- a/examples/nested-jsbeautifyrc/coldfusion/original/test.cfc +++ b/examples/nested-jsbeautifyrc/coldfusion/original/test.cfc @@ -1,64 +1,8 @@ - - - - variables.instance = structNew(); - return this; - - - - - - - - - - - - - - - - - - - - - - - - - - - initFormattingRules(); - local.reader = createObject("component", "foo.com.ExcelReader").init(arguments.filepath, arguments.sheetNumber); - local.data = local.reader.read(arguments.ignoreColumnPoint, arguments.dataStartRow); - local.data = local.reader.fixDateAndNumericColumns(local.data, variables.instance.dateColumns, variables.instance.numberColumns); - return local.data; - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +variables.instance = structNew(); +return this; + + + From c7a792e4f91937713509f8a337f7ebff82b8c298 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Fri, 18 Dec 2015 14:34:08 -0500 Subject: [PATCH 12/15] added block for cfml --- examples/nested-jsbeautifyrc/.jsbeautifyrc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/nested-jsbeautifyrc/.jsbeautifyrc b/examples/nested-jsbeautifyrc/.jsbeautifyrc index e2da501..6a96d94 100644 --- a/examples/nested-jsbeautifyrc/.jsbeautifyrc +++ b/examples/nested-jsbeautifyrc/.jsbeautifyrc @@ -14,6 +14,21 @@ - "i" - "u" wrap_line_length: 0 + cfml: + brace_style: "collapse" + indent_char: " " + indent_scripts: "normal" + indent_size: 2 + max_preserve_newlines: 1 + preserve_newlines: true + unformatted: + - "a" + - "sub" + - "sup" + - "b" + - "i" + - "u" + wrap_line_length: 0 css: indent_char: " " indent_size: 2 From 149ce5570a1fcfa04133c8203efe030e28a1db17 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Mon, 21 Dec 2015 08:03:40 -0500 Subject: [PATCH 13/15] change lyout of expected final coldfusion test file --- .../nested-jsbeautifyrc/coldfusion/expected/test.cfc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc b/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc index d4d1b32..0de65f7 100644 --- a/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc +++ b/examples/nested-jsbeautifyrc/coldfusion/expected/test.cfc @@ -1,8 +1,8 @@ - - - variables.instance = structNew(); - return this; - - + + + variables.instance = structNew(); + return this; + + \ No newline at end of file From fe8000d619aef3986ed17336491cf4cb49291042 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Mon, 21 Dec 2015 15:56:33 -0500 Subject: [PATCH 14/15] update to prettydiff 1.16.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 89084e8..80d21e3 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "loophole": "^1.0.0", "node-dir": "^0.1.8", "node-uuid": "^1.4.3", - "prettydiff": "^1.16.1", + "prettydiff": "^1.16.6", "season": "^5.3.0", "space-pen": "^5.1.1", "strip-json-comments": "^1.0.2", From 02bd277353947955570f2696d6c10f470df756f1 Mon Sep 17 00:00:00 2001 From: Bill Rawlinson Date: Tue, 22 Dec 2015 13:52:23 -0500 Subject: [PATCH 15/15] added coldfusion to description and keywords --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 80d21e3..7642b1f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "main": "./src/beautify", "version": "0.28.19", "private": true, - "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, and SQL in Atom", + "description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, and SQL in Atom", "repository": { "type": "git", "url": "https://github.com/Glavin001/atom-beautify" @@ -147,6 +147,7 @@ "objective-c", "c-sharp", "c#", + "coldfusion", "uncrustify", "java", "pawn",