-
Notifications
You must be signed in to change notification settings - Fork 28
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
Option to disable ruby-lsp-rails
server-dependent addon features [low-prio]
#382
Comments
Hi @Splines, thanks for the report. I assume you are able to run things through Docker with something like:
So, if there was a way to customize the Rails runner command path, maybe that would help in solving this? |
Yes, we can indeed run any rails commands (e.g. For RSpec tests, we use the Ruby Test Explorer extension and specify in its settings that it should execute a custom python script when running the tests to make sure they are executed inside a new docker test container. While the execution of the tests itself is quite fast, the startup of the container takes quite a few seconds (haven't measured, but my guess is around 15 to 20s on my i7 4 core, 16 GB RAM machine and that feels like an eternity). That's just why I fear that even with a customized Rails runner command path for the Ruby LSP extension, we'd rather not use a "dockerized" command as I don't want to wait 15s every time I change something in a Ruby file in VSCode in order to be able to use the features of Ruby LSP. Hence, I think I'd prefer an option to only use static language features of the language server and deactivate the "dynamic" ones that rely on executing actual Ruby commands against the project. Not using Docker at all is not an option for us as it's just too much of a hassle to set up every component of our whole infrastructure individually (e.g. database, mail server and so forth...). |
Just to clarify, for If you want to try that approach, you could try temporarily modify this line:
We previously did offer a way to disable the server addon features via an initializer but we deprecated it when we changed the server approach in #256. We can considered making that option available again if necessary. |
Thanks for your support, the following modification of this line works for us: stdin, stdout, stderr, wait_thread = Bundler.with_original_env do
Dir.chdir("./docker/development/") do
Open3.popen3("docker", "compose", "run", "--rm", "-T",
'--entrypoint=""', "-v", "#{__dir__}/server.rb:/root/tmp/ruby-lsp-server.rb",
"mampf", "rails", "runner", "/root/tmp/ruby-lsp-server.rb", 'start')
end
end The container is called
Yes, that'd be awesome. Note that we'd have to change directory inside such a command (as done via |
Note that the feature |
Unfortunately, it fails due to the condition I have to be honest and say that the features I deem relevant for a nice development experience already come shipped with Ruby LSP, even without
I feel like that'd be the preferred way for us based on my first little experiments here. If you could make this option available again somehow, it'd be much appreciated. For now, we will continue to ignore the |
(I'll move this to the ruby-lsp-rails repo since that's where the change would be needed) |
@Splines we discussed this within the team recently. Have you looked into using the Docker extension with VS Code? We suspect that may be the 'proper' solution for the issue here. |
Just throwing in my 2 cents here, since I would like to see some way to disable In my case we use PostgreSQL in development, since we depend on some of its more specific features. Every time we need to completely reset the database (via I would rather forego the features |
Hey andyw8, thanks for pointing out the Docker extension in VSCode. Just to let you know: we ended up ignoring the info message ( Of course, it'd be nice to have an option to disable these features if not wanted, but as it's just an info message, it's not a big deal for us if there isn't one. But you may want to take notice of Dreikantbrot's concern. |
I have checked that this feature is not already implemented
Use case
We employ a Docker setup for our e-learning plattform MaMpf. We make use of the awesome Ruby LSP VSCode extension.
In our logs (Output pane of VSCode), we find that
Server dependent features will not be available
. This is reasonable due to these lines in theruby-lsp-rails
addon since a connection to our database cannot be established as the database is running inside a Docker container, while the Ruby LSP extension only accesses our local files (in a WSL environment).Description
As we don't need the server-dependent features of Ruby LSP (*), we propose introducing an option to disable automatic bundling/activation of the
ruby-lsp-rails
addon/gem such that Ruby LSP does not try to communicate/instantiate our Rails app and instead only relies on static analysis of the code at hand.(*) Of course, these additional features would be nice to have, but the static analysis is sufficient for us. Or rather, spawning a new Docker container every time one saves a Ruby file would be way too slow. And the setup would evolve quite some effort to get the Ruby LSP commands routed to the Docker container correctly, that we don't see the benefits for right now. And note that development inside a docker container as described in your VSCode extension Readme (section title "Developing on containers") is not an option for us.
Implementation
Include a check in
setup_bundler.rb
and make it available as flag in the VSCode settings.Priority
For us, this issue is of low priority, as it's just a warning/error we don't want to see in the logs, but apart from that, everything works fine for us.
The text was updated successfully, but these errors were encountered: