postmodern / chruby

Changes the current Ruby
MIT License
2.87k stars 190 forks source link

Integrate with vscode #481

Open harrygr opened 2 years ago

harrygr commented 2 years ago

I'm having some trouble with a VSCode extension that executes a ruby command: htmlbeautifier (via the vscode-erb-beautify extension).

I have no trouble executing the htmlbeautifier command from my shell (having chruby'd to the correct version), including the vscode terminal, but vscode errors with couldn't run htmlbeautifier 'spawn htmlbeautifier ENOENT', presumably because it's still using the system ruby.

Any ideas on how to get this working?

I have both the chruby.sh and auto.sh sourced in my .zshrc.

Originally posted by @harrygr in https://github.com/postmodern/chruby/discussions/480

postmodern commented 2 years ago

This is likely due to VSCode not executing commands in a shell, but executing them as separate processes (JetBrains RubyMine used to do this). VSCode would need to change how they execute commands wrt the project. Or you could try installing the Ruby VSCode extension by Peng Lv which claims to support auto-detecting the project's ruby version and integrates with RVM, rbenv, chruby, and asdf.

mculp commented 1 year ago

I don't have an issue with chruby in vscode. I don't even have the Ruby VSCode extension set up. I just have my vscode terminal load as it would in iterm.