Skip to content

Support rbs 2.x under ruby 3.1 #1173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 5, 2022
Merged

Conversation

dleavitt
Copy link
Contributor

@dleavitt dleavitt commented Mar 16, 2022

Adds support for:

  • Bounded type parameters
  • Some ast changes made as part of rbs 2

Didn't add support for inline visibility modifiers b/c ruby/rbs#923
Would be easy to monkeypatch though.

const path = paramPath as Plugin.Path<
RequiredKeys<RBS.Param, "upper_bound">
>;
const upperBound = path.call(printType, "upper_bound");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like there's a typescript error here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a workaround

fixes a type error; guessing there's a better way to accomplish this
@kddnewton
Copy link
Member

Wow, nice work on this. I'm going to merge it. I'm going to take away the 3.1 from the test suite that you added though until this plugin officially supports 3.1.

@kddnewton kddnewton merged commit c9cd5f0 into prettier:main Apr 5, 2022
@kddnewton
Copy link
Member

@dleavitt if you're feeling like another contribution, I've translated all of the RBS code over to Ruby for use in https://github.com/ruby-syntax-tree/syntax_tree-rbs. We could definitely use the support for inline visibility modifiers!

This gem is going to be the new backend for prettier, so all of the future logic is going to be over there.

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