Skip to content

Commit

Permalink
Upgrade Prism requirement to v1 (#2508)
Browse files Browse the repository at this point in the history
* Bump Tapioca and Prism requirement

* Re-generate gem RBIs

* Fix differences after Prism upgrade

* Update troubleshooting section about Prism versions
  • Loading branch information
vinistock authored Aug 29, 2024
1 parent 7d0344a commit 4637354
Show file tree
Hide file tree
Showing 54 changed files with 12,206 additions and 14,255 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ group :development do
platforms :ruby do # C Ruby (MRI), Rubinius or TruffleRuby, but NOT Windows
# sorbet-static is not available on Windows. We also skip Tapioca since it depends on sorbet-static-and-runtime
gem "sorbet-static-and-runtime"
gem "tapioca", "~> 0.13", require: false
gem "tapioca", "~> 0.16", require: false
end
end
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PATH
specs:
ruby-lsp (0.17.17)
language_server-protocol (~> 3.17.0)
prism (>= 0.29.0, < 0.31)
prism (~> 1.0)
rbs (>= 3, < 4)
sorbet-runtime (>= 0.5.10782)

Expand All @@ -25,7 +25,7 @@ GEM
irb (~> 1.10)
reline (>= 0.3.8)
docile (1.4.0)
erubi (1.12.0)
erubi (1.13.0)
io-console (0.7.2)
irb (1.12.0)
rdoc
Expand All @@ -47,14 +47,14 @@ GEM
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
prism (0.30.0)
prism (1.0.0)
psych (5.1.2)
stringio
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rbi (0.1.13)
prism (>= 0.18.0, < 1.0.0)
rbi (0.2.0)
prism (~> 1.0)
sorbet-runtime (>= 0.5.9204)
rbs (3.5.3)
logger
Expand Down Expand Up @@ -103,30 +103,30 @@ GEM
sorbet-static-and-runtime (0.5.11551)
sorbet (= 0.5.11551)
sorbet-runtime (= 0.5.11551)
spoom (1.3.0)
spoom (1.4.2)
erubi (>= 1.10.0)
prism (>= 0.19.0)
prism (>= 0.28.0)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
stringio (3.1.0)
strscan (3.1.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tapioca (0.13.3)
tapioca (0.16.2)
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
rbi (>= 0.1.4, < 0.2)
rbi (~> 0.2)
sorbet-static-and-runtime (>= 0.5.11087)
spoom (>= 1.2.0)
thor (>= 1.2.0)
yard-sorbet
thor (1.3.1)
thor (1.3.2)
unicode-display_width (2.5.0)
yard (0.9.36)
yard-sorbet (0.8.1)
sorbet-runtime (>= 0.5)
yard (>= 0.9)
yard-sorbet (0.9.0)
sorbet-runtime
yard

PLATFORMS
arm64-darwin
Expand Down Expand Up @@ -154,7 +154,7 @@ DEPENDENCIES
simplecov
sorbet-static-and-runtime
syntax_tree (>= 6.1.1, < 7)
tapioca (~> 0.13)
tapioca (~> 0.16)

BUNDLED WITH
2.5.10
30 changes: 6 additions & 24 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,13 @@ You can also attempt an update from the command line with `BUNDLE_GEMFILE=.ruby-
> [!NOTE]
> If you're using any addon gem, such as `ruby-lsp-rspec`, then `ruby-lsp` will also be present in your `Gemfile.lock` and it's possible that an outdated addon could prevent `ruby-lsp` from updating.
A common problem is that the `ruby-lsp` gem cannot be updated due to another dependency's constraints:
Another possible scenario where the `ruby-lsp` gem cannot be updated is when one of its runtime dependencies are
constrained by another gem in the application. For example, Ruby LSP has a dependency on
[RBS](https://github.com/ruby/rbs) v3. If another gem constrains the version of RBS to an older release, it will not be
possible to use newer versions of Ruby LSP.

**Prism constraints**

Since v0.12.0, Ruby LSP has had a dependency on the [Prism](https://rubygems.org/gems/prism) parser.
Prior to that, the Prism parser was named [YARP](https://rubygems.org/gems/yarp). The fact that the gem was renamed leads to some awkward dependency resolutions issues.
Since Prism is a pre-1.0 release, there may be breaking changes introduced in minor versions.
For that reason, we constrain the version of Prism up to that which is known to be compatible.

With the custom bundle approach described earlier, Bundler resolves a version of Ruby LSP which is compatible the dependencies already in your `Gemfile.lock.`

When a new version of Prism is released, it will take a little time for us as Ruby LSP maintainers to verify the compatibility, and make any necessary updates.

During that time, it's possible for the Prism version in your `Gemfile.lock` to be increased due to being a dependency of another gem in your bundle.

If Prism is locked to a newer version not yet supported by the Ruby LSP, then the only outcome that satisfies Bundler's checks is to install the very old versions that depend on the old name YARP.

Once Prism v1.0 is released, we will relax the version constraint to alleviate this problem.

**Other constraints**

Ruby LSP has a dependency on [RBS](https://github.com/ruby/rbs) v3.
If another gem constrains the version of RBS to an older release, it will not be possible to use newer versions of Ruby LSP.

There is also dependency on `sorbet-runtime` which is used by a number of other gems.
The 3 runtime dependencies of the Ruby LSP are `rbs`, `prism` and `sorbet-runtime`. If any of them are being constrained
by the application, the Ruby LSP may fail to update.

Running `BUNDLE_GEMFILE=.ruby-lsp/Gemfile bundle outdated` may help with understanding what is being constrained.

Expand Down
2 changes: 1 addition & 1 deletion lib/ruby_lsp/listeners/folding_ranges.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def add_statements_range(node)
body = statements.body
return if body.empty?

add_lines_range(node.location.start_line, T.must(body.last).location.end_line)
add_lines_range(node.location.start_line, body.last.location.end_line)
end

sig { params(node: Prism::Node).void }
Expand Down
2 changes: 1 addition & 1 deletion ruby-lsp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]

s.add_dependency("language_server-protocol", "~> 3.17.0")
s.add_dependency("prism", ">= 0.29.0", "< 0.31")
s.add_dependency("prism", "~> 1.0")
s.add_dependency("rbs", ">= 3", "< 4")
s.add_dependency("sorbet-runtime", ">= 0.5.10782")

Expand Down
1 change: 1 addition & 0 deletions sorbet/rbi/gems/ansi@1.5.0.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/ast@2.4.2.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/builder@3.3.0.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/docile@1.4.0.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/io-console@0.7.2.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/json@2.7.2.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/logger@1.6.0.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/minitest-reporters@1.7.1.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/minitest@5.25.1.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/mocha@2.3.0.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/netrc@0.11.0.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/parallel@1.26.3.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/parser@3.3.4.2.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sorbet/rbi/gems/prettier_print@1.2.1.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4637354

Please sign in to comment.