Skip to content

Commit

Permalink
Upgrade Prism to 1.1.0 (#2654)
Browse files Browse the repository at this point in the history
* Upgrade Prism to 1.1.0

* Use partial script for parsing ERB Documents
  • Loading branch information
vinistock authored Oct 2, 2024
1 parent af0b46d commit c64fc41
Show file tree
Hide file tree
Showing 5 changed files with 3,104 additions and 3,024 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PATH
specs:
ruby-lsp (0.19.0)
language_server-protocol (~> 3.17.0)
prism (~> 1.0)
prism (>= 1.1, < 2.0)
rbs (>= 3, < 4)
sorbet-runtime (>= 0.5.10782)

Expand Down Expand Up @@ -39,7 +39,7 @@ GEM
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
prism (1.0.0)
prism (1.1.0)
psych (5.1.2)
stringio
racc (1.8.1)
Expand Down
5 changes: 3 additions & 2 deletions lib/ruby_lsp/erb_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ def parse!
scanner = ERBScanner.new(@source)
scanner.scan
@host_language_source = scanner.host_language
# assigning empty scopes to turn Prism into eval mode
@parse_result = Prism.parse(scanner.ruby, scopes: [[]])
# Use partial script to avoid syntax errors in ERB files where keywords may be used without the full context in
# which they will be evaluated
@parse_result = Prism.parse(scanner.ruby, partial_script: true)
true
end

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", "~> 1.0")
s.add_dependency("prism", ">= 1.1", "< 2.0")
s.add_dependency("rbs", ">= 3", "< 4")
s.add_dependency("sorbet-runtime", ">= 0.5.10782")

Expand Down
Loading

0 comments on commit c64fc41

Please sign in to comment.