Skip to content

Add a way to mark a method as deprecated in inline RBS #2702

@connorshea

Description

@connorshea

For editor support in the Ruby LSP, it'd be great if this were standardized by rbs. See also Shopify/ruby-lsp#1773

I see that there are deprecation signatures in RBS syntax that are generally standardized:

%a{deprecated} attr_reader extra_annotations: Array[AST::Annotation]

But is there a way to do this in an inline RBS signature? Should there be? Should we consider a @deprecated tag at the start of a comment line to be the standard way to do this, to match YARD/JSDoc and all the gems that already use this syntax?

class Foo
  # @deprecated Use #new_thing instead.
  #: -> String
  def old_thing
    return 'bad'
  end

  #: -> String
  def new_thing
    return 'better'
  end
end

I see that there is one example of an inline comment for a deprecated method, in the tests, but I don't think it technically means anything here.

# @deprecated Use NEW_API instead
OLD_API_URL = "http://old.example.com"

I am very much looking forward to Inline RBS! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions