Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django template comments crash unibeautify #197

Open
Somberland opened this issue May 6, 2019 · 4 comments
Open

django template comments crash unibeautify #197

Somberland opened this issue May 6, 2019 · 4 comments
Labels
third-party bug Bugs which need to be fixed by third-party (e.g. external beautifier)

Comments

@Somberland
Copy link

Somberland commented May 6, 2019

using django-template comments in html-files for example:

{% comment %} <button type='button' class='btn btn-secondary'>Secondary</button> {% endcomment %}

will break unibeautify.

HTML:
  beautifiers:
    - Pretty Diff
    # - JS-Beautify
  align_assignments: true
  indent_comments: true
  indent_style: tab
  indent_size: 1
  max_preserve_newlines: 4
  quotes: single
  brace_style: collapse
  break_chained_methods: true
  end_with_comma: false
  multiline_ternary: always-multiline
  end_with_newline: true
  force_indentation: false
  preserve_newlines: true
  indent_inner_html: true
  indent_scripts: normal
  newline_before_tags: []

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at markuppretty__beautify_apply_attArray (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/lib/markuppretty.js:3349:47)
    at markuppretty__beautify_apply (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/lib/markuppretty.js:3367:34)
    at markuppretty__beautify (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/lib/markuppretty.js:3479:20)
    at Object.markuppretty_ [as markuppretty] (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/lib/markuppretty.js:3480:10)
    at core__markuppretty (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/prettydiff.js:77:30)
    at core_ (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/prettydiff.js:307:37)
    at prettydiff_ (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/prettydiff.js:334:16)
    at commonjs_prettydiff (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/prettydiff.js:369:20)
    at exports.beautifier.beautify.Promise (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/@unibeautify/beautifier-prettydiff/src/index.ts:120:22)
    at new Promise (<anonymous>)
    at Object.beautify (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/@unibeautify/beautifier-prettydiff/src/index.ts:49:12)
    at beautifyWithBeautifiers.beautifiers.reduce.promise.then.dependencyManager.load.then.then (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/unibeautify/src/beautifier.ts:410:18)

 WARN Error: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at markuppretty__beautify_apply_attArray (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/lib/markuppretty.js:3349)
    at markuppretty__beautify_apply (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/lib/markuppretty.js:3367)
    at markuppretty__beautify (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/lib/markuppretty.js:3479)
    at Object.markuppretty_ [as markuppretty] (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/lib/markuppretty.js:3480)
    at core__markuppretty (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/prettydiff.js:77)
    at core_ (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/prettydiff.js:307)
    at prettydiff_ (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/prettydiff.js:334)
    at commonjs_prettydiff (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/prettydiff2/prettydiff.js:369)
    at exports.beautifier.beautify.Promise (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/@unibeautify/beautifier-prettydiff/src/index.ts:120)
    at new Promise (<anonymous>)
    at Object.beautify (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/@unibeautify/beautifier-prettydiff/src/index.ts:49)
    at beautifyWithBeautifiers.beautifiers.reduce.promise.then.dependencyManager.load.then.then (/.vscode/extensions/glavin001.unibeautify-vscode-0.7.0/node_modules/unibeautify/src/beautifier.ts:410)
@stevenzeck
Copy link
Contributor

Hi @Somberland. This looks to be an issue with prettydiff, I'll need to investigate further. Also, you're .unibeautifyrc.yml file is incorrect, you want:

HTML: 
  align_assignments : true 
  beautifiers : ["JS-Beautify", "Pretty Diff"] 
  brace_style : "collapse" 
  break_chained_methods : true 
  end_with_comma : true 
  end_with_newline : true 
  force_indentation : false 
  indent_comments : true 
  indent_inner_html : true
  indent_scripts : "normal" 
  indent_size : 1 
  indent_style : "tab" 
  max_preserve_newlines : 4 
  multiline_ternary : "always-multiline" 
  newline_before_tags : [] 
  preserve_newlines : true 
  quotes : "single"

@Somberland
Copy link
Author

thanks for the reply :) looking forward for an solution.

created the config-file via https://assistant.unibeautify.com/#/setup , strange

@Glavin001
Copy link
Member

I'm able to reproduce with Unibeautify Playground:

image

This bug needs to be reported to https://github.com/prettydiff/prettydiff

@Glavin001 Glavin001 added the third-party bug Bugs which need to be fixed by third-party (e.g. external beautifier) label Apr 25, 2020
@yaegassy
Copy link

@Glavin001 @Somberland

Hi, I see that this issue is still unresolved, have you created an issue on prettydiff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
third-party bug Bugs which need to be fixed by third-party (e.g. external beautifier)
Projects
None yet
Development

No branches or pull requests

4 participants