Skip to content

Add support for new Sorbet configs (Cache, Prism, and RBS)#888

Draft
amomchilov wants to merge 3 commits intomainfrom
Alex/sorbet-config-enhancements
Draft

Add support for new Sorbet configs (Cache, Prism, and RBS)#888
amomchilov wants to merge 3 commits intomainfrom
Alex/sorbet-config-enhancements

Conversation

@amomchilov
Copy link
Copy Markdown
Contributor

No description provided.

opts << "--no-stdlib" if @no_stdlib
opts << "--cache-dir='#{@cache_dir}'" if @cache_dir
opts << "--parser=#{@parser}" if @parser
opts.join(" ")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use_rbs is missing from options_string. Both cache_dir and parser are included, but use_rbs is not, so a parse → options_string round-trip silently drops the RBS config.

Should we add something like:

Suggested change
opts.join(" ")
opts << "--parser=#{@parser}" if @parser
opts << "--enable-experimental-rbs-comments" if @use_rbs

(or whichever RBS flag makes the most sense as canonical)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We may need to map Sorbet version <:> feature like we do in Tapioca

config.parser = parse_option(line).to_sym
next
when /^--enable-experimental-rbs-(comments|signatures|assertions)(=|$)/
config.use_rbs = parse_bool_option(line)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm wondering about the three separate RBS flags (comments, signatures, assertions) collapsing into a single use_rbs boolean. If a config has:

--enable-experimental-rbs-comments
--enable-experimental-rbs-signatures=false

The last one wins and use_rbs becomes false. Is that intentional? If we only need a single boolean for Spoom's purposes, maybe worth a comment explaining the simplification.

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.

Yeah I was trying to keep it simple, since the whole point of the deprecation was to not have to worry about the distinction (like signatures=true and assetions=false).

I think I'll change this to use the ORing of values, and raise if there's a mix of trues/falses

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.

2 participants