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

commented Jun 9, 2019

.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

@diguifi

diguifi approved these changes Jul 4, 2019

@rebornix
Copy link
Member

left a comment

LGTM.

Add the .rbi file extension as a Ruby file type.
.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 connorshea force-pushed the connorshea:ruby-rbi-files branch from 1dfc9f2 to c898cc3 Jul 17, 2019

@connorshea

This comment has been minimized.

Copy link
Contributor Author

commented Jul 17, 2019

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

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

5 checks passed

VS Code Build #20190717.50 succeeded
Details
VS Code (Linux) Linux succeeded
Details
VS Code (Windows) Windows succeeded
Details
VS Code (macOS) macOS succeeded
Details
license/cla All CLA requirements met.
@rebornix

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

Thanks! Ruby Interface is cool.

@rebornix rebornix modified the milestones: On Deck, July 2019 Jul 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.