-
Notifications
You must be signed in to change notification settings - Fork 180
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
Ruby LSP attempts to index ~/Library when being run with BBEdit #2365
Comments
Hi @etherbob If you run |
Also, I wonder if this relates to https://www.barebones.com/support/bbedit/AppSandboxing.html |
The only paths we try to index automatically are gem installation paths and the files inside the workspace. If you run this gem env path Do any of the entries include anything under We rely on Bundler for figuring out all of the paths we're going to index, so it might be worth checking Bundler configuration too. |
I can run I wonder if there's something in the config BBEdit is passing in:
|
@vinistock interestingly
that's from in a BBEdit shell worksheet which I think would be the same env as bbedit tries to shell out to ruby-lsp |
I wonder if BBEdit is running it with a current working directory of ~ and assuming the workspace setting will override it. Is there a flag I can pass to ruby-lsp to not auto-index the current working dir? |
Not really, these are the indexing configurations we expose. My suspicion is that this is related to some intersection of BBEdit and ASDF. Something might be overriding the |
I was able to get solargraph (BBEdit's default configured ruby language server) working, but I don't know if it has the same GEM_HOME/GEM_PATH behavior, or what it does when it hits a permission error. I'm going to see if I can wrap the ruby-lsp binary in a shell script so I can echo those environment values. My zsh scripting skills are... minimal though, so we'll see how this goes. |
@vinistock you called it inside BBEdit's shell worksheet running gem env
I'll figure out how to override it in .zshenv to something sane. Thanks for helping me run this to ground. |
I'll close this for now since the problem seems to be not due to Ruby LSP, but feel free to update the issue with your findings. |
it's being set by /etc/profile
which puts system ruby ahead of the one set by asdf in zshenv BBEdit runs a non-interactive login shell so zshrc (which must come after /etc/profile) gets run and puts the asdf supplied ruby back in front. |
@andyw8 I did a little more experimenting and even with the right env it still tries to index my home dir when started up from a non-interactive login shell (what BBEdit uses to run the language servers) I made a test script (lang-serv.sh)
pwd prints no output but the first time it gets an index command from BBEdit it attempts to index my home dir same thing happens if I add --doctor to my script. if I add a line that cd's to my main project directory everything works fine and dandy. |
Ok looking at https://github.com/Shopify/ruby-lsp/blob/main/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#L27 it looks like ruby-lsp always attempts to index the Dir.pwd in addition to whatever workspace configs are passed in, but maybe I'm misreading this? |
@etherbob did you find a solution? I think your observation is correct. It also doesn't look like BBEdit provides the usual env vars when you normally run a script with the file path, etc. |
@ascarter what errors are you seeing with BBEdit? The one originally reported in this issue has been fixed already, so maybe it's something else. |
I see it scanning the working directory which unfortunately in BBEdit looks like the home directory not the project directory in question. I tried using a script to be the lsp call that changes the directory and that does seem to work (although BBEdit doesn't seem to show documentation for the matches). This is the error I get using rbenv to set my global ruby to 3.4.1 with ruby-lsp gem installed. It looks like it is scanning subdirectories of my home directory and for whatever reason it has permission error. Maybe the one thing that should change in ruby-lsp is to use the rootUri sent in the request?
|
Great - thanks @vinistock! |
### Motivation Fixes #2365 We regressed on the fix to use the workspace URI given by the editor as the entry point for indexing. The changes to receive indexing configurations from the editor started returning early if no configurations are passed, but we still need to apply the workspace URI even if the user didn't specify any other configs. ### Implementation Started applying the workspace URI to the indexing config every time. ### Automated Tests Added a test that reproduces the bug.
Description
Reproduction steps
~/.asdf/shims/ruby-lsp
with and without the defaultstdio
argument.bbedit .
works well for this from a terminal window)<username>, <sub-folder>
etc to be conscientious about it being a work project.)My apologies if non-vs-code use isn't fully supported yet. The BBEdit devs have been fairly responsive to my requests for help troubleshooting on their end and made some changes to try to keep the ruby-lsp server focused on the current workspace, but are really unsure as to why this is happening. I started a conversation in the Ruby DX slack with some good suggested troubleshooting ideas, but it got lost to history before I had time to revisit this issue.
The text was updated successfully, but these errors were encountered: