aliariff / vscode-erb-beautify Goto Github PK
View Code? Open in Web Editor NEWFormat/Beautify ERB files
Home Page: https://marketplace.visualstudio.com/items?itemName=aliariff.vscode-erb-beautify
License: MIT License
Format/Beautify ERB files
Home Page: https://marketplace.visualstudio.com/items?itemName=aliariff.vscode-erb-beautify
License: MIT License
Hi, this is a great plugin - I have one small issue - if the tag is self closing (<img ... / >) is screws up the formatting (It's fine if I do this <img ...>)
I tried to try to format a file that has UTF8 characters, such as Japanese letters, but it gets like this sometimes ���
if I run htmlbeautifier directly (without vscode-erb-beautify) it seems fine.
Can this be fixed by setting?
Hello,
I install ERB Formatter/Beautify plugin in VS Code and format the attachment file, but it stuck forever with heavy CPU and over heat.
Please use the attached file for a test.
Hi - when I edit the settings.json in VSC with the following:
"[erb]": {
"editor.defaultFormatter": "aliariff.vscode-erb-beautify",
"editor.formatOnSave": true
},
"files.associations": {
"*.html.erb": "erb"
}
and subsequently try to save/format the document, I get the following error(s):
"Couldn't run htmlbeautifier 'spawn htmlbeautifier ENOENT'" &
"Error occurred while formatting: spawn htmlbeautifier ENOENT"
Any ideas on what causes this?
BR Nicklas
And about the .js.erb files?
I guess this extension is specific to html.erb.
Someone has some suggestion for .js.erb?
example:
<h1>工作项列表</h1>
<button class="btn btn-primary" type="button">Primary</button>
<table>
<thead>
<tr>
<th scope="col">Table header 1</th>
<th scope="col">Table header 2</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Table footer 1</td>
<td>Table footer 2</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Table data 1</td>
<td>Table data 2</td>
</tr>
</tbody>
</table>
Hello, basically the error is the title of the issue. When I use the default VS Code command to format the file absolutely nothing happens. If I press CTRL + S it formats the code fine. Is there any way to fix this so that it works with both possible ways?
Thanks!
Hi, I could not find any information regarding this. Is it somehow possible? Thanks
In current version I've got a problem with copy/pasting into an erb-file:
A new-line is added after the first pasted line and the rest of the pasted lines aren't intended at all.
main
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here are some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
VSCE_PAT
environment variable).Unfortunately this error doesn't have any additional information. Feel free to kindly ask the author of the semantic-release-vsce
plugin to add more helpful information.
Good luck with your project ✨
Your semantic-release bot 📦🚀
When editing a .html.erb file, pressing keys Ctrl + / adds #
which is not helpful. It should add <!-- -->
instead which is appropriate because we are writing in HTML.
When running format document get this message.
couldn't find htmlbeautifier for formatting (ENOENT)
htmlbeautifier show.html.erb works from command line
Hello and thanks for this plugin!
Do you have any plans to support custom execution arguments?
E.g. a settings option to edit the htmlbeautifier command line options, say, htmlbeautifier -b 4
Ty!
<% @links.each do |link| %>
<option <%= link[:selected] ? 'selected' : '' %>>
<%= link[:name] %>
</option>
<% end %>
This code does not get formatted correctly.
main
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here are some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
Error: Command failed with exit code 1: vsce verify-pat
::error::Can not read the publisher's name. Either supply it as an argument or run vsce from the extension folder. Additional information:%0A%0AError: @types/vscode ^1.86.0 greater than engines.vscode ^1.74.0. Consider upgrade engines.vscode or use an older @types/vscode version
Unfortunately this error doesn't have any additional information. Feel free to kindly ask the author of the semantic-release-vsce
plugin to add more helpful information.
Good luck with your project ✨
Your semantic-release bot 📦🚀
linking to a google drive gif is a bad idea
I've recorded a gif, placed it in the root directory and updated the README.
I'd be happy to open a PR
Hi,
When I try to format a file that has UTF8 characters as á I get this error.
failed with exit code: 1. '/home/bruno/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/htmlbeautifier-1.4.2/bin/htmlbeautifier:12:in `rescue in beautify': Error parsing standard input: invalid byte sequence in US-ASCII on line 1 (RuntimeError) from /home/bruno/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/htmlbeautifier-1.4.2/bin/htmlbeautifier:9:in `beautify' from /home/bruno/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/htmlbeautifier-1.4.2/bin/htmlbeautifier:111:in `<top (required)>' from /home/bruno/.rbenv/versions/3.1.2/bin/htmlbeautifier:25:in `load' from /home/bruno/.rbenv/versions/3.1.2/bin/htmlbeautifier:25:in `<main>' /home/bruno/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/htmlbeautifier-1.4.2/lib/htmlbeautifier/parser.rb:37:in `rescue in dispatch': invalid byte sequence in US-ASCII on line 1 (RuntimeError) from /home/bruno/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/htmlbeautifier-1.4.2/lib/htmlbeautifier/parser.rb:31:in `dispatch' from /home/bruno/.rbenv/versio...
This is because LC_ALL=en_US.UTF-8 is set in the htmlbeautifier command.
If I run htmlbeautifier with htmlbeautifier file.html.erb file.html.erb
it works fine, but if I run it with LC_ALL=en_US.UTF-8 htmlbeautifier file.html.erb file.html.erb
it fails with the same error and an additional warning.
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Thanks
I have installed this, and installed htmlbeautifier. I get no warnings but nothing happens when I click 'Format Document'.
How to debug this?
Could not find htmlbeautifier even if its installed.
which htmlbeautifier
/Users/devuser/.rvm/gems/ruby-2.6.3/bin/htmlbeautifier
It would be great if there was support for formating a selection of code as opposed to formating the whole document. Would be a useful addition if there is scope to add your extension - or have I missed something in my configuration?
Hi,
How to set up the extension inside of WSL2?
In C:\Users\Me\AppData\Roaming\Code\User\settings.json
, I added
"vscode-erb-beautify.bundlerPath": "/home/me/.rbenv/shims/bundler",
"vscode-erb-beautify.executePath": "/home/me/.rbenv/shims/htmlbeautifier"
but it triggers
couldn't run /home/me/.rbenv/shims/htmlbeautifier.bat 'spawn /home/me/.rbenv/shims/htmlbeautifier.bat ENOENT'
<%= link_to post, class: "post-container" do %>
<div>
...
</div>
<% end %>
This plugin does not indent the div inside the do block. Can this be fixed?
When i hit ctrl+s This pops up and never goes away, the file never saves till i click Cancel. This is a new issue that started today but i could not think of any updates that I have done.
I went back and tried to uninstall/reinstall htmlbeautifier, you extention, apt update/apt upgrade reboot ... All same result.
What and where do i find the log files you may need
I found the issue with the files that contain non-ASCII characters.
When I try to format them, nothing happens.
After investigated, I found a way to fix it. You need "LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8" before run htmlbeautifier.
const beautify = cp.spawn(``LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 htmlbeautifier${ext}``, [ ...options, document.uri.fsPath ], { shell: true });
It took me a while to figure out why it wasn't working on my .html.erb
files, and I discovered I just had to add this to my settings.json
:
"files.associations": {
"*.erb": "erb"
}
Otherwise it was counting them not as erb
files, but html.erb
files - it would be helpful to note this in the installation/config requirements.
It would be great if there were an option to retain line breaks that the developer places in the file intentionally to make readability of the partial easier. For instance:
<% page_title! "Project: #{project.name}" %>
<main>
<header>
...
which currently gets turned into
<% page_title! "Project: #{project.name}" %>
<main>
<header>
...
I would like to have one line of separation when needed in my erb files. I am able to do it with "vscode-erb-beautify.keepBlankLines": 1 setting.
However, I do not want to add a blank line at the end of my file when I formatted the file. Regardless of keepBlankLines setting (it does not matter whether it is 0 (default) or 1), I end up finding my file has 1 blank line at the end of it.
I tried to disable this behavior with "files.insertFinalNewline": true, but it does not work. I think the plugin overrides it. Because I managed to work it only when the plugin is disabled.
I am looking forward to a solution for this behavior, thanks!
I'm using VSCODE Version: 1.85.2 (Universal) on Mac with latest plugin version.
I don't know how to debug my problem because there are no faulty logs in vscode console, but after saving some erb files I can see that the whole content disappear and I can only get an empty file, and then file is saved empty losing the erb totally.
How can I debug this issue and solve ?
Thanks
Max
I noticed that this extension only supports versions greater than 1.86.0
.
"vscode": "^1.86.0"
Is there a reason for this? It would be great to support slightly older versions, even just 1.80.0
Hi,
When I run the command Format Document
while I am in a .html.erb
file, nothing happens, there is just a file that is created. For example, if I run the command in a file called _small_panels.html.erb
, a file will be created called _small_panels.html.erb.tmp
and that's it.
my settings.json
{
"workbench.colorTheme": "Gruvbox Dark Medium",
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 15,
"emmet.includeLanguages": { "erb": "html" },
"files.associations": {
"*.erb": "erb"
}
}
Thank !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.