-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support configuring custom rspec command in VS Code #57
base: main
Are you sure you want to change the base?
Conversation
I was just thinking of contributing this same feature. Thanks! Hope this get merges soon 🙏 |
@st0012 Any thoughts on this feature or implementation? Thanks! |
I just hit another use case where the combination of the two settings I added here are not quite sufficient to get things working (Docker + a monorepo-style setup). When I get time I'll push a change making the settings interface slightly more flexible than what I've added here. |
Hi sorry for the delay. I understand the need of custom RSpec commands, but what's the problem From my experience, if the test files need to be run with a relative path, it usually indicates that the project should properly utilize VS Code's multi-root workspaces feature. |
This commit adds an option (consumed from VS Code settings) that allows a debug mode to troubleshoot configuration issues. Further, this commit clarifies the preferred approach for using this addon with Dev Containers. Projects that use Docker or other container technologies for development should use a the VS Code Dev Containers extension to run Ruby LSP _within_ the dev Container. This prevents situations where the spec paths provided to rspec are host machine paths rather than container paths.
👋 Hey! No problem for the delay, thanks for taking a look.
With that setup, the spec file path was an absolute path pointing to the file on the host machine, not the path within the container. One way to fix that was to add support for a relative path so the spec path was correct, even if it was generated on the host machine but used in a container. I've thought more about that and don't think it's the right solution. Instead, using a Dev Container and running Ruby LSP extension in that container yields the correct spec paths without the need for an additional setting. I've updated this pull request to add a bit of documentation to those who might be wondering how do do this in #27 . I've additionally added a |
ruby-lsp already does a good job of inferring the base
rspec
command to run based on the presence of a Gemfile or binstup.This pull request allows further customization of the rspec command using the
addonSettings
VS Code configuration exposed by ruby-lspCheck out the modifications to
README.md
for descriptions of the two newly-added configuration options (rspecCommand
anduseRelativePaths
).These two new options can be used in conjunction to solve issues like those described in #27 (using ruby-lsp-rspec with docker):
.vscode/settings.json