Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

allow to use the extension in folders that contain spaces #716

Closed
wants to merge 1 commit into from
Closed

allow to use the extension in folders that contain spaces #716

wants to merge 1 commit into from

Conversation

tonklon
Copy link

@tonklon tonklon commented Jul 23, 2023

Motivation

The extension does not work for projects in folders, were there is a space somewhere in the path. I often use that and I don't want to rename all my project folders.

Implementation

Just adding spaces around the environment Variable named BUNDLE_GEMFILE is enough.

BUNDLE_GEMFILE="/path with spaces/project/Gemfile" bundle exec ruby-lsp works just fine, while
BUNDLE_GEMFILE=/path with spaces/project/Gemfile bundle exec ruby-lsp won't work

Automated Tests

No, I have not included test for this. I was just about writing the tests and working on for Shopify/ruby-lsp#781 when I recognized the extension itself was broken, too.

I might perhaps come back after the ruby-lsp itself works with spaces and add some. Meanwhile I guess the change is quite simple, and since I need to do it, to be able to work on the other issue, I could as well publish the code and add a PR, if somebody else has this.

Manual Tests

Add a space to the folder your test project resides in, and try to start ruby-lsp. It will fail. After this change ruby-lsp can start.

@Morriar
Copy link
Contributor

Morriar commented Jul 24, 2023

Should we move this as draft since it won't work until the changes on the LSP server are merged?

@tonklon
Copy link
Author

tonklon commented Jul 26, 2023

I don't see any advantage holding this back.

This code behaves wrong when run in a path with spaces and this PR tries to fix this. If the fix makes sense and improves the output of this project, it should be merged IMHO. There is no interdependency with the fixes in the server.

@vinistock
Copy link
Member

FYI, we'll need to move the BUNDLE_GEMFILE part since not every OS handles env variable the same way #712.

One question: do the spaces need to be escaped inside of the string or is wrapping it around quotes enough? That is, do we need /something\ other/ instead of /something other?

@tonklon
Copy link
Author

tonklon commented Aug 3, 2023

In my tests wrapping in Quotes is enough, extra escaping was not required. That is on macOS with zsh. The behavior could be OS or shell dependent.

@tonklon
Copy link
Author

tonklon commented Aug 4, 2023

This PR is obsolete with #712. The solution to move the BUNDLER_GEMFILE into the environment works as well.

@tonklon tonklon closed this Aug 4, 2023
@tonklon tonklon deleted the feature/fix-spaces-in-path branch August 7, 2023 11:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants