Skip to content

Conversation

@Lusqinha
Copy link

@Lusqinha Lusqinha commented Oct 17, 2025

We are planning to use the extract Ruby code with semicolons in Steep/RBS, more specifically in this PR: soutaro/steep#1836. It's because we need the Ruby code with semicolons to display the static typing errors correctly. I think this functionality could also be used in others projects like Sorbet and Packwerk.

Copy link
Owner

@marcoroth marcoroth left a comment

Choose a reason for hiding this comment

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

Hey @Lusqinha, thanks for opening this pull request!

I'm happy to expose this functionality, but I'm really curious what the use case for this pull request is, do you have a specific need for this? 😅

Regarding the design, I'm wondering if we instead should expose this with some options on the existing extract_ruby method. Something like:

Herb.extract_ruby(source, semicolons: true)

@felixefelip
Copy link

felixefelip commented Oct 19, 2025

@marcoroth thanks for the feedback!

We are planning to use this in Steep/RBS, more specifically in this PR: soutaro/steep#1836. It's because we need the Ruby code with semicolons to display the static typing errors correctly. I think this functionality could also be used in others projects like Sorbet and Packwerk.

Sorry for the lack of information in the description of this PR, we are going to update this soon.

About the design, I agree to use existing extract_ruby adding some options. We are going to do this.

@Lusqinha Lusqinha changed the title Parser: add method extract ruby with semicolons to herb module Parser: add public API method extract_ruby_with_semicolons_to_herb Oct 21, 2025

require_relative "../test_helper"

module Extractor

Choose a reason for hiding this comment

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

@felixefelip
Copy link

Hello @marcoroth,

Sorry for the long time to update this PR.

We made the changes to use the optional argument, I think could be better the semicolons argument be default false to not affect the current users of this method. Do you agree?

@Lusqinha Lusqinha marked this pull request as ready for review November 18, 2025 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants