Skip to content

Ruby LSP fails to activate through VSCode with error: Unable to read input file: Is a directory #1471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
benedictleejh opened this issue Mar 7, 2024 · 8 comments
Labels
bug Something isn't working Stale

Comments

@benedictleejh
Copy link

Description

Reproduction steps

When trying to start Ruby LSP through VSCode, it fails with the error message below:

Failed to activate custom environment: Command failed: /bin/bash -i -c 'eval "$(mise env -s bash)" && ruby -rjson -e "STDERR.printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump({ env: ENV.to_h, ruby_version: RUBY_VERSION, yjit: defined?(RubyVM::YJIT) }))"' error: Unable to read input file: Is a directory

The command runs on the command line perfectly fine, and a manually installed ruby-lsp gem starts up just fine as well. I've scanned through the activation code, and I cannot see where it's trying to read a file to attempt to deconflict it.

@benedictleejh benedictleejh added the bug Something isn't working label Mar 7, 2024
@andyw8
Copy link
Contributor

andyw8 commented Mar 7, 2024

Hi @benedictleejh, what shell are you using?

I see you stated bash.

@andyw8
Copy link
Contributor

andyw8 commented Mar 7, 2024

Do you have fish installed too? From Googling, I seem some indication it's the source of that particular message.

@benedictleejh
Copy link
Author

I do have fish installed, and my .bashrc execs fish.

@HosokawaR
Copy link

HosokawaR commented Mar 11, 2024

me too.

my .bashrc calls fish

$ tail -n 3  ~/.bashrc
if [ -z $NO_FISH ]; then
  exec fish
fi

so, the command seem to fail due to Fish hello message.

$ /bin/bash -i -c 'ruby -rjson -e "STDERR.printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump({ env: ENV.to_h, ruby_version: RUBY_VERSION, yjit: defined?(RubyVM::YJIT) }))"'
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

Without Fish shell or run command without -i (bin/bash -c), the command successes and Ruby LSP is activated.

$ /bin/bash -c 'ruby -rjson -e "STDERR.printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump({ env: ENV.to_h, ruby_version: RUBY_VERSION, yjit: defined?(RubyVM::YJIT) }))"'
RUBY_ENV_ACTIVATE{"env":{"SHELL":"/bin/bash","COLORTERM":"truecolor","TERM_PROGRAM_VERSION":"1.87.1","JAVA_HOME":"/usr/lib/jvm/java-11-openjdk-amd64","RBENV_SHELL":"bash", ……

@vinistock
Copy link
Member

Yeah, we're currently working on decoupling Ruby environment activation from the shell, exactly because we have no control over what users do in their configurations. If something waits for input, highjacks the stderr pipe or does other things of that nature, then invoking the Ruby activation script with the shell will likely fail.

We have been exploring a new activation mechanism, which decouples the extension from the shell. You can already use this new mechanism by installing the prerelease version of the extension, which will probably fix activation for you.

And we're getting changes ready to release this in stable #1502 and #1438.

@HosokawaR
Copy link

You can already use this new mechanism by installing the prerelease version of the extension, which will probably fix activation for you.

The prerelease version worked fine in my environments !
I'm looking forward to the general release.

Thank you!

Copy link
Contributor

This issue is being marked as stale because there was no activity in the last 2 months

@github-actions github-actions bot added the Stale label May 18, 2024
@vinistock
Copy link
Member

Mise support with no shell coupling has been released in stable versions for a while, so I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

4 participants