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

EJS will not beautify #1288

Closed clayzermk1 closed 7 years ago

clayzermk1 commented 7 years ago

Description

Duplicate of #1278 but with a bit more info. In an EJS file, atom-beautify fails to beautify the editor with the following error:

Atom Beautify could not find a supported beautifier for this file

Atom Beautify could not determine a supported beautifier to handle this file with grammar "EJS" and extension "ejs". If you would like to request support for this file and its language, please create an issue for Atom Beautify at https://github.com/Glavin001/atom-beautify/issues

Input Before Beautification

This is what the code looked like before:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<%= foo %>
</body>
</html>

Expected Output

The beautified code should have looked like this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <%= foo %>
  </body>
</html>

Actual Output

The beautified code actually looked like this:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<%= foo %>
</body>
</html>

Steps to Reproduce

  1. Add code to Atom editor
  2. Run command Atom Beautify: Beautify Editor
  3. Observe error notification.
  4. This beautified code does not look right!

    Debug

Attempting to create a debug file as instructed by the contribution guidelines generates a critical error. (Sorry, I tried.)

Cannot read property 'name' of null

TypeError: Cannot read property 'name' of null
    at atom-workspace.debug (/Users/<redacted system username>/.atom/packages/atom-beautify/src/beautify.coffee:364:53)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at CommandPaletteView.module.exports.CommandPaletteView.confirmed (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/command-palette/lib/command-palette-view.js:183:32)
    at CommandPaletteView.module.exports.SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:338:21)
    at space-pen-div.atom.commands.add.core:confirm (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:109:19)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:114:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

Checklist

I have:

OS X 10.11.6 (15G1004) Atom 1.11.2 atom-beautify 0.29.13

Misc

Thank you for your time and atom-beautify!

kwalshAtMeditech commented 7 years ago

I'm getting the same error message reported here when attempting to beautify .ejs files.

I Tried uninstalling and reinstalling Atom Beautify to ensure it installed properly. I restarted Atom to ensure it is not a caching issue

I'm using Windows 7 Atom 1.11.2 and just installed atom-beautify 0.29.13

Glavin001 commented 7 years ago

Closed by https://github.com/Glavin001/atom-beautify/pull/1326

Glavin001 commented 7 years ago

Published to v0.29.15