Skip to content

feat: support the it block parameter - #2238

Merged
soutaro merged 1 commit into
soutaro:masterfrom
tk0miya:claude/wonderful-cerf-oau75l
Aug 5, 2026
Merged

feat: support the it block parameter#2238
soutaro merged 1 commit into
soutaro:masterfrom
tk0miya:claude/wonderful-cerf-oau75l

Conversation

@tk0miya

@tk0miya tk0miya commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Recognize Ruby 3.4's it (e.g. [1].map { it + 1 }) by handling the new :itblock node alongside :numblock across type checking, source mapping, diagnostics, hover, and signature help.

This requires bumping Prism::Translation::Parser33 to Parser34.

Closes #1450

Comment thread lib/steep/source.rb

def self.new_parser
Prism::Translation::Parser33.new(Builder.new).tap do |parser|
Prism::Translation::Parser34.new(Builder.new).tap do |parser|

@tk0miya tk0miya Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: I bumped the Prism parser from Parser33 to Parser34 to support the it parameter.
But this introduces incompatible behavior.

def it
  1
end
[1, 2, 3].map { it }

With Parser33, the it inside the block is recognized as a method call to #it. With Parser34, the same it is recognized as the block's implicit parameter.

I'm afraid that this brings a breaking change. Would it be better to add a configuration for the Ruby syntax version?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a problem.
Ruby 3.3 was released 2023. Two years old. And it's already in security maintenance stage. We may want to use even newer version --Parser40.

@tk0miya
tk0miya force-pushed the claude/wonderful-cerf-oau75l branch from b172612 to db29dfe Compare June 13, 2026 17:19
Recognize Ruby 3.4's `it` (e.g. `[1].map { it + 1 }`) by handling
the new :itblock node alongside :numblock across type checking,
source mapping, diagnostics, hover, and signature help.

This requires bumping Prism::Translation::Parser33 to Parser34.

Closes soutaro#1450
@tk0miya

tk0miya commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@soutaro Is there any chance to merge this? This is a blocker to migrating my code to the new syntax.

@soutaro soutaro added this to the Steep 2.1 milestone Aug 5, 2026
@soutaro
soutaro merged commit 751d9b1 into soutaro:master Aug 5, 2026
20 of 21 checks passed
@tk0miya
tk0miya deleted the claude/wonderful-cerf-oau75l branch August 5, 2026 09:11
@tk0miya

tk0miya commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I can't wait for the next release :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support it (read: It is time to switch to Prism.)

2 participants