victorporof / Sublime-HTMLPrettify

HTML, CSS, JavaScript, JSON, React/JSX and Vue code formatter for Sublime Text 2 and 3 via node.js
https://github.com/victorporof/Sublime-HTMLPrettify
1.92k stars 261 forks source link

.js Unsupported file type #478

Closed imageslr closed 7 years ago

imageslr commented 7 years ago

I have been using HTML-CSS-JS Prettify for a long time, but today suddenly it cannot prettifies js code in file with .js extension. It works well in other files such as .vue.

Here are all my configurations:

victorporof commented 7 years ago

Will look into it.

victorporof commented 7 years ago

Can you post the output in sublime’s console?

imageslr commented 7 years ago

Sorry I didn't get notification. Here is the output in console:

[HTMLPrettify] Using editor text temp file: True
[HTMLPrettify] Global file rules: {"html": {"allowed_file_syntaxes": ["html", "xml"], "disallowed_file_patterns": [], "allowed_file_extensions": ["vue"]}}
[HTMLPrettify] Respecting .editorconfig files: True
[HTMLPrettify] Editor file syntax: Packages/JavaScript/JavaScript.sublime-syntax
[HTMLPrettify] Editor indent size: ?
[HTMLPrettify] Editor indent with tabs: ?
[HTMLPrettify] Editor text file path: /Users/zhukaihao/Library/Application Support/Sublime Text 3/Packages/HTML-CSS-JS Prettify/62459ff7-31cc-4c23-ba0d-6e3bc6674da1
[HTMLPrettify] Editor text file contents: null
[HTMLPrettify] Original file path: /Users/zhukaihao/Desktop/软件杯/提交作品/source-code/desktop-wiki-app/src/api/fetch.js
[HTMLPrettify] Config extra lookup paths: /Users/zhukaihao/Library/Application Support/Sublime Text 3/Packages/User,/Users/zhukaihao/Library/Application Support/Sublime Text 3/Packages/HTML-CSS-JS Prettify
[HTMLPrettify] Computed extra lookup paths for .jsbeautifyrc: ["/Users/zhukaihao/Desktop/软件杯/提交作品/source-code/desktop-wiki-app/src/api","/Users/zhukaihao/Desktop/软件杯/提交作品/source-code/desktop-wiki-app/src","/Users/zhukaihao/Desktop/软件杯/提交作品/source-code/desktop-wiki-app","/Users/zhukaihao/Desktop/软件杯/提交作品/source-code","/Users/zhukaihao/Desktop/软件杯/提交作品","/Users/zhukaihao/Desktop/软件杯","/Users/zhukaihao/Desktop","/Users/zhukaihao","/Users","/Users/zhukaihao","/Users/zhukaihao/Library/Application Support/Sublime Text 3/Packages/User","/Users/zhukaihao/Library/Application Support/Sublime Text 3/Packages/HTML-CSS-JS Prettify"]
[HTMLPrettify] Attempting to parse file: /Users/zhukaihao/Library/Application Support/Sublime Text 3/Packages/HTML-CSS-JS Prettify/.jsbeautifyrc.defaults.json
[HTMLPrettify] Attempting to parse file: /Users/zhukaihao/Library/Application Support/Sublime Text 3/Packages/User/.jsbeautifyrc
[HTMLPrettify] Attempting to parse file: /Users/zhukaihao/Desktop/软件杯/提交作品/source-code/desktop-wiki-app/.editorconfig
[HTMLPrettify] Computed prettify options: {"html":{"end_with_newline":true,"eol":"\n","indent_level":0,"indent_char":" ","indent_size":"2","indent_with_tabs":false,"max_preserve_newlines":0,"preserve_newlines":true,"wrap_line_length":0,"indent_handlebars":false,"indent_inner_html":false,"indent_scripts":"keep","unformatted":["a","span","img","code","pre","sub","sup","em","strong","b","i","u","strike","big","small","pre","h1","h2","h3","h4","h5","h6"],"css":{"newline_between_rules":true,"selector_separator":" ","selector_separator_newline":true},"js":{"brace_style":"collapse-preserve-inline","break_chained_methods":false,"comma_first":false,"e4x":false,"jslint_happy":false,"keep_array_indentation":false,"keep_function_indentation":false,"operator_position":"before-newline","space_after_anon_function":false,"space_before_conditional":true,"space_in_empty_paren":false,"space_in_paren":false,"unescape_strings":false},"charset":"utf-8","end_of_line":"lf","trim_trailing_whitespace":true},"css":{"end_with_newline":true,"eol":"\n","indent_level":0,"indent_char":" ","indent_size":"2","indent_with_tabs":false,"max_preserve_newlines":0,"preserve_newlines":true,"wrap_line_length":0,"newline_between_rules":true,"selector_separator":" ","selector_separator_newline":true,"charset":"utf-8","end_of_line":"lf","trim_trailing_whitespace":true},"js":{"end_with_newline":true,"eol":"\n","indent_level":0,"indent_char":" ","indent_size":"2","indent_with_tabs":false,"max_preserve_newlines":0,"preserve_newlines":true,"wrap_line_length":0,"brace_style":"collapse-preserve-inline","break_chained_methods":false,"comma_first":false,"e4x":false,"jslint_happy":false,"keep_array_indentation":false,"keep_function_indentation":false,"operator_position":"before-newline","space_after_anon_function":false,"space_before_conditional":true,"space_in_empty_paren":false,"space_in_paren":false,"unescape_strings":false,"charset":"utf-8","end_of_line":"lf","trim_trailing_whitespace":true},"json":{"end_with_newline":true,"eol":"\n","indent_level":0,"indent_char":" ","indent_size":"2","indent_with_tabs":false,"max_preserve_newlines":0,"preserve_newlines":true,"wrap_line_length":0,"brace_style":"expand","keep_array_indentation":false,"unescape_strings":false,"charset":"utf-8","end_of_line":"lf","trim_trailing_whitespace":true}}
[HTMLPrettify] Unsupported file type

Thank you so much.

victorporof commented 7 years ago

From the above output, “Global file rules” clearly misses everythibg except html, so you’ve removed the other dictionary entries (such as “js”) in one of your config files.

Can you confirm?

imageslr commented 7 years ago

Yes, thanks. I will try to find a solution.


I found it was because I modified Plugin Options - User. I thought the options in the file will be merged into Plugin Options - Default. But it seems like Plugin Options - User and Plugin Options - Default is unrelated?