Skip to content
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

Add the .rbi file extension as a Ruby file type #75155

Merged
merged 1 commit into from
Jul 18, 2019

Conversation

connorshea
Copy link
Contributor

.rbi files are "Ruby Interface" (type definition) files and they're used by Stripe's Sorbet type checker. They're use Ruby's existing syntax, so they don't need anything special to highlight them. Per the docs:

The syntax of RBI files is the same as normal Ruby files, except that method definitions do not need implementations.

This means that instead of having a method with any actual code in it, like this:

def hello
  return 'hello'
end

You write it like so:

sig { returns(String) }
def hello; end

You can read more about RBI Files in the Sorbet documentation.

.rbi files are planned to be added in the core language with Ruby 3 (Christmas 2020), as announced at RubyKaigi.

There is some risk that the .rbi format adopted by Ruby core will differ from the 'primary' Ruby syntax, but if that happens we can always just revert this change.

The existing Ruby highlighting mostly works fine with the syntax proposed in the RubyKaigi talk:

Screen Shot 2019-06-09 at 10 27 39 AM

@rebornix rebornix added this to the On Deck milestone Jun 10, 2019
Copy link
Member

@rebornix rebornix left a comment

Choose a reason for hiding this comment

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

LGTM.

.rbi files are type definition files that are currently used by some
community type checkers, most notably Stripe's Sorbet,
and will be part of the main language in Ruby 3.
@connorshea
Copy link
Contributor Author

@rebornix I've rebased to fix the conflict. 👍

@rebornix rebornix merged commit 17934dd into microsoft:master Jul 18, 2019
@rebornix
Copy link
Member

Thanks! Ruby Interface is cool.

@rebornix rebornix modified the milestones: On Deck, July 2019 Jul 18, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants