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

Don't mount rack app at application level #238

Closed
wants to merge 1 commit into from
Closed

Conversation

gmcgibbon
Copy link
Member

@gmcgibbon gmcgibbon commented Jan 31, 2024

Don't mount rack app at application level

This causes Rails middleware like ActiveRecord::Migration::CheckPending to get in the way of LSP requests. If we could surface migration issues somewhere else using the LSP, that would be nice.

Currently, if you generate a migration on a project using the LSP, you get this error on hovering over a model:

Started GET "/ruby_lsp_rails/models/Article" for ::1 at 2024-01-31 11:25:32 -0600
  ActiveRecord::SchemaMigration Load (0.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC

ActiveRecord::PendingMigrationError (

Migrations are pending. To resolve this issue, run:

        bin/rails db:migrate

You have 1 pending migration:

db/migrate/20240131171953_add_a_to_b.rb


):

activerecord (7.1.3) lib/active_record/migration.rb:755:in `check_pending_migrations'
activerecord (7.1.3) lib/active_record/migration.rb:644:in `block (2 levels) in call'
activesupport (7.1.3) lib/active_support/file_update_checker.rb:85:in `execute'
activesupport (7.1.3) lib/active_support/file_update_checker.rb:95:in `execute_if_updated'
...

@gmcgibbon gmcgibbon marked this pull request as ready for review January 31, 2024 19:54
@gmcgibbon gmcgibbon requested a review from a team as a code owner January 31, 2024 19:54
This causes Rails middleware like ActiveRecord::Migration::CheckPending
to get in the way of LSP requests. We should surface migration errors
in the LSP instead of having features just stop working.
@st0012 st0012 added the bugfix This PR fixes an existing bug label Feb 6, 2024
@andyw8
Copy link
Contributor

andyw8 commented Feb 12, 2024

👋 We're planning to move away from the Rack approach, so this probably won't be necessary: #230

@gmcgibbon
Copy link
Member Author

That looks like a much better approach. If we don't need to have the Rails server running, that's far more convenient. Closing for now.

@gmcgibbon gmcgibbon closed this Feb 12, 2024
@gmcgibbon gmcgibbon deleted the insert_middleware branch February 12, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants