Open archonic opened 1 year ago
I'm getting this error in VSCode:
erb-formatter not found by bundler. Add `gem 'erb-formatter'` to your Gemfile and run `bundle install`.
I have it listed in my Gemfile. I have it installed globally on my machine. I added the commandPath to settings.json like described in the comment above. I don't know why I'm getting this error message. It's annoying.
For now, I'm just disabling the extension to quiet it.
If anybody has a fix for this, please explain.
Is the gem check only looking in the Gemfile?
Sorry for the delay 🙏
It's not, the way it checks for presence in the Gemfile is by running bundle show erb-formatter
:
In your VS Code logs you should be able to see the command that gets actually executed and that should be really helpful in understanding what went wrong:
I'm getting the same error too. When I run "bundle show erb-formatter" I get
/Users/myname/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/erb-formatter-0.4.3
Same error :( Is there a fix for this? VS Code output shows this failed command:
Command failed: /Users/user/.gem/ruby/3.2.1/bin/erb-format --stdin-filename "/Users/user/project/app/views/home/index.html.erb" --print-width 80 /Users/user/.gem/ruby/3.2.1/gems/erb-formatter-0.4.3/lib/erb/formatter.rb:159:in 'tag_stack_pop': (RuntimeError)
Same error :( Is there a fix for this? VS Code output shows this failed command:
Command failed: /Users/user/.gem/ruby/3.2.1/bin/erb-format --stdin-filename "/Users/user/project/app/views/home/index.html.erb" --print-width 80 /Users/user/.gem/ruby/3.2.1/gems/erb-formatter-0.4.3/lib/erb/formatter.rb:159:in 'tag_stack_pop': (RuntimeError)
Oh I understand now: the formatter was just erroring because of incorrect tags. Is there a way to have VS Code highlight these issues in the editor?
+1 to this issue. great gem when it was working.
I have had to add something like:
"terminal.integrated.profiles.osx": {
"zsh": {
"path": "/bin/zsh",
"args": [
"-l",
"-i"
]
}
},
to my User settings to have same setup as in my normal terminal.
Not sure if the formatter uses terminal.integrated
, but maybe there is another profile?
Oh I understand now: the formatter was just erroring because of incorrect tags. Is there a way to have VS Code highlight these issues in the editor?
I would very much be in favor of highlighting stuff in the editor, I'll give it a crack but if anyone wants to jump in I'd be very happy to collaborate/merge 🙌
Not sure if the formatter uses
terminal.integrated
, but maybe there is another profile?
The extension is simply using execSync
it generates the updated code and uses the editor api to replace the contents, the idea is to make it work even for unsaved files.
For those encountering this error but not understanding the 'incorrect tags' comment. This error can come up when there's an exception by ERB formatter when trying to format - say a missing </div>
in a weird spot. The way to diagnose is VSCode Output and select 'erb formatter' in the dropdown since normal output won't show the error.
The readme says we should be able to use this extension with
gem install erb-formatter
. I've done that andwhich erb-format
works, but the extension seems unable to find it unless it's in the Gemfile. I've also tried adding this to my settings.json:Is the gem check only looking in the Gemfile?