Skip to content
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

Switch to rails runner approach instead of Rack app #256

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

andyw8
Copy link
Contributor

@andyw8 andyw8 commented Feb 13, 2024

This PR switches Ruby LSP to the new pipe approach rather than a mounted Rack server. (the runner was added already in #250).

This has several advantages, such as not needing the Rails server to be running. Previous discussion can be found in the prototype PR.

If an app was configured with config.ruby_lsp_rails.server, this setting is no longer used and should be removed.

Note that there is currently no automatic reloading, so a change such as a database migration will not be visible until Ruby LSP is restarted.

@andyw8 andyw8 force-pushed the andyw8/implement-lsp-runner branch from e8b0135 to 35ff940 Compare February 13, 2024 17:54
ruby-lsp-rails.gemspec Outdated Show resolved Hide resolved
@andyw8 andyw8 force-pushed the andyw8/implement-lsp-runner branch 3 times, most recently from 41c27dc to c38937f Compare February 14, 2024 16:00
README.md Show resolved Hide resolved
lib/ruby_lsp_rails/railtie.rb Outdated Show resolved Hide resolved
@andyw8 andyw8 force-pushed the andyw8/implement-lsp-runner branch 3 times, most recently from cf92da8 to 5515f70 Compare February 14, 2024 16:28
@andyw8 andyw8 changed the title WIP: Use Runner Use Runner Feb 14, 2024
@andyw8 andyw8 marked this pull request as ready for review February 14, 2024 16:53
@andyw8 andyw8 requested a review from a team as a code owner February 14, 2024 16:53
@andyw8 andyw8 requested review from Morriar and vinistock February 14, 2024 16:53
@andyw8 andyw8 force-pushed the andyw8/implement-lsp-runner branch from 5515f70 to 01047e0 Compare February 14, 2024 16:56
@andyw8 andyw8 requested a review from st0012 February 14, 2024 16:57
@andyw8 andyw8 added action-item breaking-change Non-backward compatible change and removed action-item labels Feb 14, 2024
@andyw8 andyw8 changed the title Use Runner Switch to rails runner approach instead of Rack app Feb 14, 2024
test/ruby_lsp_rails/hover_test.rb Outdated Show resolved Hide resolved
st0012
st0012 previously requested changes Feb 14, 2024
module RubyLsp
module Rails
class Railtie < ::Rails::Railtie
config.ruby_lsp_rails = ActiveSupport::OrderedOptions.new
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's maybe keep the railtie so we can print deprecation warning for apps assigning config.ruby_lsp_rails.server?

I think upgrading ruby-lsp-rails and having the app blown up is not a good impression we want users to have.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that originally, but after discussing with @vinistock, probably very few apps are likely to be using this.

For Core, we can remove the setting when updating the gem.

We're also tagging this PR as a 'breaking change' for awareness.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're also tagging this PR as a 'breaking change' for awareness.

Yes, this and the version change will technically justify it, but they won't show up in the users' bump PR I think.

Given that:

  1. This addon was massively promoted by Chris Oliver recently
  2. Most Rails apps are private and won't show up in the GH search result

I don't want to underestimate the negative effect this may cause to our users, especially when it's actually not too costly to avoid.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I highly doubt a lot of people are turning off the server, but if you feel strongly about this we can add a deprecation warning and then remove it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (and verified against Code DB).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

I want to be super careful about this because I did already find 2 (though inactive) repos having this set just doing a quick search.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose people may also have disabled this because they didn't like the extra noise in their logs.

@andyw8 andyw8 force-pushed the andyw8/implement-lsp-runner branch from 01047e0 to 77ae6c8 Compare February 14, 2024 18:15
@@ -1,11 +1,7 @@
# typed: strict
# frozen_string_literal: true

require "sorbet-runtime"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sorbet-runtime is already required by ruby-lsp)

initializer "ruby_lsp_rails.setup" do |_app|
config.after_initialize do |app|
config.ruby_lsp_rails.server
raise "not needed!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a deprecation warning from Active Support instead. Otherwise, this will still break people's servers.

We can mention in the warning that the configuration can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, was just was just testing with this, it's now a deprecation.

@andyw8 andyw8 force-pushed the andyw8/implement-lsp-runner branch 3 times, most recently from f16624a to 231cc6f Compare February 14, 2024 20:37
@andyw8 andyw8 force-pushed the andyw8/implement-lsp-runner branch from 231cc6f to 2f3457d Compare February 14, 2024 20:43
@andyw8 andyw8 force-pushed the andyw8/implement-lsp-runner branch from 2f3457d to 758ca85 Compare February 14, 2024 20:46
@andyw8 andyw8 merged commit c57ca34 into main Feb 14, 2024
54 checks passed
@andyw8 andyw8 deleted the andyw8/implement-lsp-runner branch February 14, 2024 21:29
This was referenced Feb 14, 2024
@Earlopain Earlopain mentioned this pull request Feb 16, 2024
@andyw8 andyw8 mentioned this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Non-backward compatible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants