1

In PHP we can describe any variable and get proper auto-complete in an IDE like PHPStorm.

/** @var MyClass $my */
$my = $this->getMy();

Is there some way to make it in RubyMine by using RDoc?

Kirby
  • 2,847
  • 2
  • 32
  • 42
  • 2
    Ruby is such a dynamic language that from the perpsective of auto-complete it's like wrestling a greasy pig. There are Ruby documentation standards like YARD, RDoc, and so on, but these don't generally inform the auto-completer. Doing this in C is trivial, in C++ and Java fairly straight-forward, but any Smalltalk-derived language like Ruby is guess-work at best. Many methods don't even exist until the code is executed, so unless the editor is that smart, it'll be incomplete at best. Rubymine is one of the better editors for that, but there are others you could try. – tadman Jul 27 '18 at 21:17
  • Unsure about Rdoc, RubyMine will pick-up directives like `@!attribute` and `@!method` in YARD, which are used for defining dynamically defined things. Basically allows for creating documentation without method stubs. – ForeverZer0 Jul 27 '18 at 22:40
  • Yeah, I understand about dynamic. But I prefer to declare "empty" variables. It helps for refactoring code, clicking onto methods, etc. – Kirby Jul 27 '18 at 22:41

1 Answers1

0

Finally found among my old code... :)

# @type [Some::MyClass] my
my = getMy
Kirby
  • 2,847
  • 2
  • 32
  • 42