Glavin001 / atom-beautify

:mega: Help Wanted - Looking for Maintainer: https://github.com/Glavin001/atom-beautify/issues/2572 | :lipstick: Universal beautification package for Atom editor (:warning: Currently migrating to https://github.com/Unibeautify/ and have very limited bandwidth for Atom-Beautify Issues. Thank you for your patience and understanding :heart: )
http://unibeautify.com/
MIT License
1.5k stars 454 forks source link

Hangs on EJS #1452

Closed jnewth closed 7 years ago

jnewth commented 7 years ago

Description

When I attempt to Beautify an EJS document, it goes to "Beautification in progress" and then just sits there, spinning the wheel. I've tried running it through the command palette (to debug it) but it never leaves the spinning wheel view. It runs on a small <100 line file indefinitely. No beautification appears to take place.

Steps to Reproduce

  1. Create ejs file and populate it with small ejs sample (I just grabbed the top few lines of mine):

<!DOCTYPE html>

<% include partials/head.ejs %> <%# carousel -- see flexslider docs%> <%# google analytics%>
  1. Run atom-beautify
  2. Observe hang in "beautification in progress". I can't get debug output!

Debug

Here is a link to the debug.md Gist:

Checklist

I have:

prettydiff commented 7 years ago

You did not include the required debug.md file, so I will guess this is a duplicate of https://github.com/Glavin001/atom-beautify/issues/1452

Please reopen this issue if I am in error.

prettydiff commented 7 years ago

Errrr, this is EJS and that other issue is JSX. This is not a duplicate, but please include the debug.md file before we can take action.

jnewth commented 7 years ago

I tried running the debug command (through the command palette) but not debug file was generated (or am unsure where such file would be generated). I am happy to repeat the process but also tried to include sufficient documentation for another person to reproduce the crash.

prettydiff commented 7 years ago

I believe the debug.md file is automagically generated to your clipboard so that you can just paste it into a gist.

Glavin001 commented 7 years ago

I tried running the debug command (through the command palette) but not debug file was generated (or am unsure where such file would be generated).

It should open a new Atom tab with the results.

I believe the debug.md file is automagically generated to your clipboard so that you can just paste it into a gist.

@prettydiff it used to be clipboard, then it was not working. Then it automated created a Gist, however some users complained. Now it creates a new tab in Atom with the results to copy and paste.

Glavin001 commented 7 years ago

@prettydiff the debug.md likely will not be generated since the issue is the beautification process never ends.

@jnewth what we need to determine is the beautifier, either JS Beautify or Pretty Diff, and also your selected configuration options. Then we can test this sample to reproduce the results. You can also try testing the online versions:

jnewth commented 7 years ago

Beautifier: JS Beautify. Online version works...ahem...beautifully.

Settings: See attached (and posted below). Is this sufficient?

Please tell me how I can best help.

"ejs": { "title": "EJS", "type": "object", "description": "Options for language EJS", "collapsed": true, "beautifiers": [ "JS Beautify", "Pretty Diff" ], "grammars": [ "EJS", "JavaScript Template", "HTML (Angular)" ], "extensions": [ "ejs" ], "properties": { "indent_size": { "type": "integer", "default": 4, "minimum": 0, "description": "Indentation size/length (Supported by JS Beautify, Pretty Diff)", "title": "Indent size", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "indent_size", "language": { "name": "HTML", "namespace": "html" } }, "indent_char": { "type": "string", "default": " ", "description": "Indentation character (Supported by JS Beautify, Pretty Diff)", "title": "Indent char", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "indent_char", "language": { "name": "HTML", "namespace": "html" } }, "indent_level": { "type": "integer", "default": 0, "description": "Initial indentation level (Supported by JS Beautify)", "title": "Indent level", "beautifiers": [ "JS Beautify" ], "key": "indent_level", "language": { "name": "JavaScript", "namespace": "js" } }, "indent_with_tabs": { "type": "boolean", "default": false, "description": "Indentation uses tabs, overrides Indent Size and Indent Char (Supported by JS Beautify, Pretty Diff)", "title": "Indent with tabs", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "indent_with_tabs", "language": { "name": "JavaScript", "namespace": "js" } }, "preserve_newlines": { "type": "boolean", "default": true, "description": "Preserve line-breaks (Supported by JS Beautify, Pretty Diff)", "title": "Preserve newlines", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "preserve_newlines", "language": { "name": "HTML", "namespace": "html" } }, "max_preserve_newlines": { "type": "integer", "default": 10, "description": "Number of line-breaks to be preserved in one chunk (Supported by JS Beautify)", "title": "Max preserve newlines", "beautifiers": [ "JS Beautify" ], "key": "max_preserve_newlines", "language": { "name": "HTML", "namespace": "html" } }, "space_in_paren": { "type": "boolean", "default": false, "description": "Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff)", "title": "Space in paren", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "space_in_paren", "language": { "name": "JavaScript", "namespace": "js" } }, "jslint_happy": { "type": "boolean", "default": false, "description": "Enable jslint-stricter mode (Supported by JS Beautify)", "title": "Jslint happy", "beautifiers": [ "JS Beautify" ], "key": "jslint_happy", "language": { "name": "JavaScript", "namespace": "js" } }, "space_after_anon_function": { "type": "boolean", "default": false, "description": "Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff)", "title": "Space after anon function", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "space_after_anon_function", "language": { "name": "JavaScript", "namespace": "js" } }, "brace_style": { "type": "string", "default": "collapse", "enum": [ "collapse", "expand", "end-expand", "none", "none" ], "description": "[collapse|expand|end-expand|none] (Supported by JS Beautify)", "title": "Brace style", "beautifiers": [ "JS Beautify" ], "key": "brace_style", "language": { "name": "HTML", "namespace": "html" } }, "break_chained_methods": { "type": "boolean", "default": false, "description": "Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff)", "title": "Break chained methods", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "break_chained_methods", "language": { "name": "JavaScript", "namespace": "js" } }, "keep_array_indentation": { "type": "boolean", "default": false, "description": "Preserve array indentation (Supported by JS Beautify)", "title": "Keep array indentation", "beautifiers": [ "JS Beautify" ], "key": "keep_array_indentation", "language": { "name": "JavaScript", "namespace": "js" } }, "keep_function_indentation": { "type": "boolean", "default": false, "description": " (Supported by JS Beautify)", "title": "Keep function indentation", "beautifiers": [ "JS Beautify" ], "key": "keep_function_indentation", "language": { "name": "JavaScript", "namespace": "js" } }, "space_before_conditional": { "type": "boolean", "default": true, "description": " (Supported by JS Beautify)", "title": "Space before conditional", "beautifiers": [ "JS Beautify" ], "key": "space_before_conditional", "language": { "name": "JavaScript", "namespace": "js" } }, "eval_code": { "type": "boolean", "default": false, "description": " (Supported by JS Beautify)", "title": "Eval code", "beautifiers": [ "JS Beautify" ], "key": "eval_code", "language": { "name": "JavaScript", "namespace": "js" } }, "unescape_strings": { "type": "boolean", "default": false, "description": "Decode printable characters encoded in xNN notation (Supported by JS Beautify)", "title": "Unescape strings", "beautifiers": [ "JS Beautify" ], "key": "unescape_strings", "language": { "name": "JavaScript", "namespace": "js" } }, "wrap_line_length": { "type": "integer", "default": 250, "description": "Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff)", "title": "Wrap line length", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "wrap_line_length", "language": { "name": "HTML", "namespace": "html" } }, "end_with_newline": { "type": "boolean", "default": false, "description": "End output with newline (Supported by JS Beautify)", "title": "End with newline", "beautifiers": [ "JS Beautify" ], "key": "end_with_newline", "language": { "name": "HTML", "namespace": "html" } }, "end_with_comma": { "type": "boolean", "default": false, "description": "If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff)", "title": "End with comma", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "end_with_comma", "language": { "name": "JavaScript", "namespace": "js" } }, "indent_inner_html": { "type": "boolean", "default": false, "description": "Indent and sections. (Supported by JS Beautify)", "title": "Indent inner html", "beautifiers": [ "JS Beautify" ], "key": "indent_inner_html", "language": { "name": "HTML", "namespace": "html" } }, "indent_scripts": { "type": "string", "default": "normal", "enum": [ "keep", "separate", "normal" ], "description": "[keep|separate|normal] (Supported by JS Beautify)", "title": "Indent scripts", "beautifiers": [ "JS Beautify" ], "key": "indent_scripts", "language": { "name": "HTML", "namespace": "html" } }, "wrap_attributes": { "type": "string", "default": "auto", "enum": [ "auto", "force" ], "description": "Wrap attributes to new lines [auto|force] (Supported by JS Beautify)", "title": "Wrap attributes", "beautifiers": [ "JS Beautify" ], "key": "wrap_attributes", "language": { "name": "HTML", "namespace": "html" } }, "wrap_attributes_indent_size": { "type": "integer", "default": 4, "minimum": 0, "description": "Indent wrapped attributes to after N characters (Supported by JS Beautify)", "title": "Wrap attributes indent size", "beautifiers": [ "JS Beautify" ], "key": "wrap_attributes_indent_size", "language": { "name": "HTML", "namespace": "html" } }, "unformatted": { "type": "array", "default": [ "a", "abbr", "area", "audio", "b", "bdi", "bdo", "br", "button", "canvas", "cite", "code", "data", "datalist", "del", "dfn", "em", "embed", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "map", "mark", "math", "meter", "noscript", "object", "output", "progress", "q", "ruby", "s", "samp", "select", "small", "span", "strong", "sub", "sup", "svg", "template", "textarea", "time", "u", "var", "video", "wbr", "text", "acronym", "address", "big", "dt", "ins", "small", "strike", "tt", "pre", "h1", "h2", "h3", "h4", "h5", "h6" ], "items": { "type": "string" }, "description": "List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify)", "title": "Unformatted", "beautifiers": [ "JS Beautify" ], "key": "unformatted", "language": { "name": "HTML", "namespace": "html" } }, "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. (Supported by JS Beautify)", "title": "Extra liners", "beautifiers": [ "JS Beautify" ], "key": "extra_liners", "language": { "name": "HTML", "namespace": "html" } }, "disabled": { "title": "Disable Beautifying Language", "order": -3, "type": "boolean", "default": false, "description": "Disable EJS Beautification" }, "default_beautifier": { "title": "Default Beautifier", "order": -2, "type": "string", "default": "JS Beautify", "description": "Default Beautifier to be used for EJS", "enum": [ "JS Beautify", "Pretty Diff" ] }, "beautify_on_save": { "title": "Beautify On Save", "order": -1, "type": "boolean", "default": false, "description": "Automatically beautify EJS files on save" } } },

On Mon, Jan 9, 2017 at 9:49 AM, Glavin Wiechert notifications@github.com wrote:

@prettydiff https://github.com/prettydiff the debug.md likely will not be generated since the issue is the beautification process never ends.

@jnewth https://github.com/jnewth what we need to determine is the beautifier, either JS Beautify or Pretty Diff, and also your selected configuration options. Then we can test this sample to reproduce the results. You can also try testing the online versions:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Glavin001/atom-beautify/issues/1452#issuecomment-271353939, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT3raqZiKVT2N81f69oSTWc1Pev3zPPks5rQnNBgaJpZM4LefsE .

"ejs": { "title": "EJS", "type": "object", "description": "Options for language EJS", "collapsed": true, "beautifiers": [ "JS Beautify", "Pretty Diff" ], "grammars": [ "EJS", "JavaScript Template", "HTML (Angular)" ], "extensions": [ "ejs" ], "properties": { "indent_size": { "type": "integer", "default": 4, "minimum": 0, "description": "Indentation size/length (Supported by JS Beautify, Pretty Diff)", "title": "Indent size", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "indent_size", "language": { "name": "HTML", "namespace": "html" } }, "indent_char": { "type": "string", "default": " ", "description": "Indentation character (Supported by JS Beautify, Pretty Diff)", "title": "Indent char", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "indent_char", "language": { "name": "HTML", "namespace": "html" } }, "indent_level": { "type": "integer", "default": 0, "description": "Initial indentation level (Supported by JS Beautify)", "title": "Indent level", "beautifiers": [ "JS Beautify" ], "key": "indent_level", "language": { "name": "JavaScript", "namespace": "js" } }, "indent_with_tabs": { "type": "boolean", "default": false, "description": "Indentation uses tabs, overrides Indent Size and Indent Char (Supported by JS Beautify, Pretty Diff)", "title": "Indent with tabs", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "indent_with_tabs", "language": { "name": "JavaScript", "namespace": "js" } }, "preserve_newlines": { "type": "boolean", "default": true, "description": "Preserve line-breaks (Supported by JS Beautify, Pretty Diff)", "title": "Preserve newlines", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "preserve_newlines", "language": { "name": "HTML", "namespace": "html" } }, "max_preserve_newlines": { "type": "integer", "default": 10, "description": "Number of line-breaks to be preserved in one chunk (Supported by JS Beautify)", "title": "Max preserve newlines", "beautifiers": [ "JS Beautify" ], "key": "max_preserve_newlines", "language": { "name": "HTML", "namespace": "html" } }, "space_in_paren": { "type": "boolean", "default": false, "description": "Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify, Pretty Diff)", "title": "Space in paren", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "space_in_paren", "language": { "name": "JavaScript", "namespace": "js" } }, "jslint_happy": { "type": "boolean", "default": false, "description": "Enable jslint-stricter mode (Supported by JS Beautify)", "title": "Jslint happy", "beautifiers": [ "JS Beautify" ], "key": "jslint_happy", "language": { "name": "JavaScript", "namespace": "js" } }, "space_after_anon_function": { "type": "boolean", "default": false, "description": "Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify, Pretty Diff)", "title": "Space after anon function", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "space_after_anon_function", "language": { "name": "JavaScript", "namespace": "js" } }, "brace_style": { "type": "string", "default": "collapse", "enum": [ "collapse", "expand", "end-expand", "none", "none" ], "description": "[collapse|expand|end-expand|none] (Supported by JS Beautify)", "title": "Brace style", "beautifiers": [ "JS Beautify" ], "key": "brace_style", "language": { "name": "HTML", "namespace": "html" } }, "break_chained_methods": { "type": "boolean", "default": false, "description": "Break chained method calls across subsequent lines (Supported by JS Beautify, Pretty Diff)", "title": "Break chained methods", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "break_chained_methods", "language": { "name": "JavaScript", "namespace": "js" } }, "keep_array_indentation": { "type": "boolean", "default": false, "description": "Preserve array indentation (Supported by JS Beautify)", "title": "Keep array indentation", "beautifiers": [ "JS Beautify" ], "key": "keep_array_indentation", "language": { "name": "JavaScript", "namespace": "js" } }, "keep_function_indentation": { "type": "boolean", "default": false, "description": " (Supported by JS Beautify)", "title": "Keep function indentation", "beautifiers": [ "JS Beautify" ], "key": "keep_function_indentation", "language": { "name": "JavaScript", "namespace": "js" } }, "space_before_conditional": { "type": "boolean", "default": true, "description": " (Supported by JS Beautify)", "title": "Space before conditional", "beautifiers": [ "JS Beautify" ], "key": "space_before_conditional", "language": { "name": "JavaScript", "namespace": "js" } }, "eval_code": { "type": "boolean", "default": false, "description": " (Supported by JS Beautify)", "title": "Eval code", "beautifiers": [ "JS Beautify" ], "key": "eval_code", "language": { "name": "JavaScript", "namespace": "js" } }, "unescape_strings": { "type": "boolean", "default": false, "description": "Decode printable characters encoded in xNN notation (Supported by JS Beautify)", "title": "Unescape strings", "beautifiers": [ "JS Beautify" ], "key": "unescape_strings", "language": { "name": "JavaScript", "namespace": "js" } }, "wrap_line_length": { "type": "integer", "default": 250, "description": "Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff)", "title": "Wrap line length", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "wrap_line_length", "language": { "name": "HTML", "namespace": "html" } }, "end_with_newline": { "type": "boolean", "default": false, "description": "End output with newline (Supported by JS Beautify)", "title": "End with newline", "beautifiers": [ "JS Beautify" ], "key": "end_with_newline", "language": { "name": "HTML", "namespace": "html" } }, "end_with_comma": { "type": "boolean", "default": false, "description": "If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff)", "title": "End with comma", "beautifiers": [ "JS Beautify", "Pretty Diff" ], "key": "end_with_comma", "language": { "name": "JavaScript", "namespace": "js" } }, "indent_inner_html": { "type": "boolean", "default": false, "description": "Indent and sections. (Supported by JS Beautify)", "title": "Indent inner html", "beautifiers": [ "JS Beautify" ], "key": "indent_inner_html", "language": { "name": "HTML", "namespace": "html" } }, "indent_scripts": { "type": "string", "default": "normal", "enum": [ "keep", "separate", "normal" ], "description": "[keep|separate|normal] (Supported by JS Beautify)", "title": "Indent scripts", "beautifiers": [ "JS Beautify" ], "key": "indent_scripts", "language": { "name": "HTML", "namespace": "html" } }, "wrap_attributes": { "type": "string", "default": "auto", "enum": [ "auto", "force" ], "description": "Wrap attributes to new lines [auto|force] (Supported by JS Beautify)", "title": "Wrap attributes", "beautifiers": [ "JS Beautify" ], "key": "wrap_attributes", "language": { "name": "HTML", "namespace": "html" } }, "wrap_attributes_indent_size": { "type": "integer", "default": 4, "minimum": 0, "description": "Indent wrapped attributes to after N characters (Supported by JS Beautify)", "title": "Wrap attributes indent size", "beautifiers": [ "JS Beautify" ], "key": "wrap_attributes_indent_size", "language": { "name": "HTML", "namespace": "html" } }, "unformatted": { "type": "array", "default": [ "a", "abbr", "area", "audio", "b", "bdi", "bdo", "br", "button", "canvas", "cite", "code", "data", "datalist", "del", "dfn", "em", "embed", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "map", "mark", "math", "meter", "noscript", "object", "output", "progress", "q", "ruby", "s", "samp", "select", "small", "span", "strong", "sub", "sup", "svg", "template", "textarea", "time", "u", "var", "video", "wbr", "text", "acronym", "address", "big", "dt", "ins", "small", "strike", "tt", "pre", "h1", "h2", "h3", "h4", "h5", "h6" ], "items": { "type": "string" }, "description": "List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify)", "title": "Unformatted", "beautifiers": [ "JS Beautify" ], "key": "unformatted", "language": { "name": "HTML", "namespace": "html" } }, "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. (Supported by JS Beautify)", "title": "Extra liners", "beautifiers": [ "JS Beautify" ], "key": "extra_liners", "language": { "name": "HTML", "namespace": "html" } }, "disabled": { "title": "Disable Beautifying Language", "order": -3, "type": "boolean", "default": false, "description": "Disable EJS Beautification" }, "default_beautifier": { "title": "Default Beautifier", "order": -2, "type": "string", "default": "JS Beautify", "description": "Default Beautifier to be used for EJS", "enum": [ "JS Beautify", "Pretty Diff" ] }, "beautify_on_save": { "title": "Beautify On Save", "order": -1, "type": "boolean", "default": false, "description": "Automatically beautify EJS files on save" } } },

RenaldasK commented 7 years ago

Any outcome yet? I have the same issue and it is very annoying. I don't want to install other beautifiers as I don't want to loose all the settings I have setup.

Glavin001 commented 7 years ago

Duplicate of #1458.

Published fix of #1458 to v0.29.17! Thank you for your patience!