Skip to content

Commit 731d2d6

Browse files
committed
Apply lower bound ruby-lsp version constraint in composed bundle
When the composed .ruby-lsp/Gemfile is generated for users who don't have ruby-lsp in their own Gemfile, apply a >= 0.18.0 lower bound. Without this constraint, Bundler could resolve to very old versions that cause errors. Reasons for choosing 0.18.0: - Fixes resolution to versions like 0.11.2 which cause NameError: uninitialized constant RubyLsp::RuboCop::Cop - First version with stable Prism 1.0 dependency (~> 1.0) — earlier versions used narrow pre-1.0 pins that caused dependency resolution issues - Includes rbs >= 3 dependency (added in v0.17.3) needed for core class indexing - Not overly restrictive — v0.18.0 is from September 2024, leaving ~18 months of versions available
1 parent 487c2bf commit 731d2d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/ruby_lsp/setup_bundler.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def stdout
3434
# Gems that should be kept up to date in the composed bundle. When updating, any of these gems that are not
3535
# already in the user's Gemfile will be updated together.
3636
GEMS_TO_UPDATE = ["ruby-lsp", "debug", "prism", "rbs"].freeze #: Array[String]
37+
RUBY_LSP_MIN_VERSION = ">= 0.18.0" #: String
3738

3839
#: (String project_path, **untyped options) -> void
3940
def initialize(project_path, **options)
@@ -169,7 +170,7 @@ def write_custom_gemfile
169170
end
170171

171172
unless @dependencies["ruby-lsp"]
172-
ruby_lsp_entry = +'gem "ruby-lsp", require: false, group: :development'
173+
ruby_lsp_entry = +"gem \"ruby-lsp\", \"#{RUBY_LSP_MIN_VERSION}\", require: false, group: :development"
173174
ruby_lsp_entry << ", github: \"Shopify/ruby-lsp\", branch: \"#{@branch}\"" if @branch
174175
parts << ruby_lsp_entry
175176
end

0 commit comments

Comments
 (0)