Skip to content

Commit 4637354

Browse files
authored
Upgrade Prism requirement to v1 (#2508)
* Bump Tapioca and Prism requirement * Re-generate gem RBIs * Fix differences after Prism upgrade * Update troubleshooting section about Prism versions
1 parent 7d0344a commit 4637354

54 files changed

Lines changed: 12206 additions & 14255 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ group :development do
2626
platforms :ruby do # C Ruby (MRI), Rubinius or TruffleRuby, but NOT Windows
2727
# sorbet-static is not available on Windows. We also skip Tapioca since it depends on sorbet-static-and-runtime
2828
gem "sorbet-static-and-runtime"
29-
gem "tapioca", "~> 0.13", require: false
29+
gem "tapioca", "~> 0.16", require: false
3030
end
3131
end

Gemfile.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PATH
1111
specs:
1212
ruby-lsp (0.17.17)
1313
language_server-protocol (~> 3.17.0)
14-
prism (>= 0.29.0, < 0.31)
14+
prism (~> 1.0)
1515
rbs (>= 3, < 4)
1616
sorbet-runtime (>= 0.5.10782)
1717

@@ -25,7 +25,7 @@ GEM
2525
irb (~> 1.10)
2626
reline (>= 0.3.8)
2727
docile (1.4.0)
28-
erubi (1.12.0)
28+
erubi (1.13.0)
2929
io-console (0.7.2)
3030
irb (1.12.0)
3131
rdoc
@@ -47,14 +47,14 @@ GEM
4747
ast (~> 2.4.1)
4848
racc
4949
prettier_print (1.2.1)
50-
prism (0.30.0)
50+
prism (1.0.0)
5151
psych (5.1.2)
5252
stringio
5353
racc (1.8.1)
5454
rainbow (3.1.1)
5555
rake (13.2.1)
56-
rbi (0.1.13)
57-
prism (>= 0.18.0, < 1.0.0)
56+
rbi (0.2.0)
57+
prism (~> 1.0)
5858
sorbet-runtime (>= 0.5.9204)
5959
rbs (3.5.3)
6060
logger
@@ -103,30 +103,30 @@ GEM
103103
sorbet-static-and-runtime (0.5.11551)
104104
sorbet (= 0.5.11551)
105105
sorbet-runtime (= 0.5.11551)
106-
spoom (1.3.0)
106+
spoom (1.4.2)
107107
erubi (>= 1.10.0)
108-
prism (>= 0.19.0)
108+
prism (>= 0.28.0)
109109
sorbet-static-and-runtime (>= 0.5.10187)
110110
thor (>= 0.19.2)
111111
stringio (3.1.0)
112112
strscan (3.1.0)
113113
syntax_tree (6.2.0)
114114
prettier_print (>= 1.2.0)
115-
tapioca (0.13.3)
115+
tapioca (0.16.2)
116116
bundler (>= 2.2.25)
117117
netrc (>= 0.11.0)
118118
parallel (>= 1.21.0)
119-
rbi (>= 0.1.4, < 0.2)
119+
rbi (~> 0.2)
120120
sorbet-static-and-runtime (>= 0.5.11087)
121121
spoom (>= 1.2.0)
122122
thor (>= 1.2.0)
123123
yard-sorbet
124-
thor (1.3.1)
124+
thor (1.3.2)
125125
unicode-display_width (2.5.0)
126126
yard (0.9.36)
127-
yard-sorbet (0.8.1)
128-
sorbet-runtime (>= 0.5)
129-
yard (>= 0.9)
127+
yard-sorbet (0.9.0)
128+
sorbet-runtime
129+
yard
130130

131131
PLATFORMS
132132
arm64-darwin
@@ -154,7 +154,7 @@ DEPENDENCIES
154154
simplecov
155155
sorbet-static-and-runtime
156156
syntax_tree (>= 6.1.1, < 7)
157-
tapioca (~> 0.13)
157+
tapioca (~> 0.16)
158158

159159
BUNDLED WITH
160160
2.5.10

TROUBLESHOOTING.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,13 @@ You can also attempt an update from the command line with `BUNDLE_GEMFILE=.ruby-
5050
> [!NOTE]
5151
> 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.
5252
53-
A common problem is that the `ruby-lsp` gem cannot be updated due to another dependency's constraints:
53+
Another possible scenario where the `ruby-lsp` gem cannot be updated is when one of its runtime dependencies are
54+
constrained by another gem in the application. For example, Ruby LSP has a dependency on
55+
[RBS](https://github.com/ruby/rbs) v3. If another gem constrains the version of RBS to an older release, it will not be
56+
possible to use newer versions of Ruby LSP.
5457

55-
**Prism constraints**
56-
57-
Since v0.12.0, Ruby LSP has had a dependency on the [Prism](https://rubygems.org/gems/prism) parser.
58-
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.
59-
Since Prism is a pre-1.0 release, there may be breaking changes introduced in minor versions.
60-
For that reason, we constrain the version of Prism up to that which is known to be compatible.
61-
62-
With the custom bundle approach described earlier, Bundler resolves a version of Ruby LSP which is compatible the dependencies already in your `Gemfile.lock.`
63-
64-
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.
65-
66-
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.
67-
68-
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.
69-
70-
Once Prism v1.0 is released, we will relax the version constraint to alleviate this problem.
71-
72-
**Other constraints**
73-
74-
Ruby LSP has a dependency on [RBS](https://github.com/ruby/rbs) v3.
75-
If another gem constrains the version of RBS to an older release, it will not be possible to use newer versions of Ruby LSP.
76-
77-
There is also dependency on `sorbet-runtime` which is used by a number of other gems.
58+
The 3 runtime dependencies of the Ruby LSP are `rbs`, `prism` and `sorbet-runtime`. If any of them are being constrained
59+
by the application, the Ruby LSP may fail to update.
7860

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

lib/ruby_lsp/listeners/folding_ranges.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def add_statements_range(node)
242242
body = statements.body
243243
return if body.empty?
244244

245-
add_lines_range(node.location.start_line, T.must(body.last).location.end_line)
245+
add_lines_range(node.location.start_line, body.last.location.end_line)
246246
end
247247

248248
sig { params(node: Prism::Node).void }

ruby-lsp.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
1919
s.require_paths = ["lib"]
2020

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

sorbet/rbi/gems/ansi@1.5.0.rbi

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sorbet/rbi/gems/ast@2.4.2.rbi

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sorbet/rbi/gems/builder@3.3.0.rbi

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sorbet/rbi/gems/docile@1.4.0.rbi

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)