Skip to content

Commit af50ee2

Browse files
committed
Eager load routes if necessary
1 parent 23edfb1 commit af50ee2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/ruby_lsp/ruby_lsp_rails/server.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def initialize
2020
end
2121

2222
def start
23+
# Load routes if they haven't been loaded yet (see https://github.com/rails/rails/pull/51614).
24+
routes_reloader = ::Rails.application.routes_reloader
25+
routes_reloader.execute_unless_loaded if routes_reloader&.respond_to?(:execute_unless_loaded)
26+
2327
initialize_result = { result: { message: "ok" } }.to_json
2428
$stdout.write("Content-Length: #{initialize_result.length}\r\n\r\n#{initialize_result}")
2529

0 commit comments

Comments
 (0)