Skip to content

Ecosystem question: YARD? #8

@jaredcwhite

Description

@jaredcwhite

I've spent a bit of time with this and I'm quite pleased with the concept and the workflow even in this early stage. Kudos!

I think there's a fantastic opportunity here to zoom out to the ecosystem level and really fine-tune the DX around authoring code, documentation, type hints, and checking all as a single unit of effort—as is possible in many other language ecosystems.

To that end, what might the relationship be between these inline RBS comments and YARDoc? Consider the following:

# Convert a Markdown string into HTML output.
#
# @param input [String] the Markdown to convert
# @return [String]
def markdownify(input)
  # ...
end

With RBS inline, I could instead write this:

# Convert a Markdown string into HTML output.
#
# @rbs input: String - the Markdown to convert
# @rbs returns String
def markdownify(input)
  # ...
end

But now I'm not going to get documentation for my code. Would I have to duplicate?

# Convert a Markdown string into HTML output.
#
# @rbs input: String
# @param input [String] the Markdown to convert
# @rbs returns String
# @return [String]
def markdownify(input)
  # ...
end

Hmm. 😐

A few possible directions to go:

  • Add @rbs tag support to YARD. I honestly have no idea how easy that might be though.
  • Support some common YARD tags in addition to @rbs. This starts wading into https://github.com/AaronC81/sord territory though, not sure if that would ever be in scope.
  • Add or document modular plugin feature so a third-party could offer support for YARD tags.

For additional context, I've been using YARD + Solargraph + VSCode for my Ruby dev environment for several years now, and the experience is pretty good overall (even though I'm not using it for type checking, just autocomplete/tips/jump/etc.). I'd love to see a day I can use YARD + Steep with inline RBS and really get a best-of-all-worlds experience. 🤩

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions