←back to thread

177 points bartekpacia | 1 comments | | HN request time: 0s | source
Show context
phendrenad2 ◴[] No.45103164[source]
It's been a long time since I last used RubyMine, but I always felt that it was the weakest of the JetBrains tools. And not because JetBrains didn't try hard enough, but because Ruby just doesn't offer a lot of opportunities for an IDE to take advantage of.

I ended up cancelling my subscription over some trivial thing (I think it was the fact that I couldn't quite get the IDE to preserve the indentation of a file. It was an all-or-nothing global setting, but I work on codebases that might have a 4-space indent HTML file and a 2-space indent HTML File in the same directory, and the IDE was ignoring the current style of the file and using whatever indent level I had configured).

replies(4): >>45103607 #>>45103627 #>>45103891 #>>45104910 #
ryandv ◴[] No.45104910[source]
In general it's impossible to "find usages" or "go to definition" when the language not only fails to equip IDEs and tooling with the static typing information that would grant definitive answers to such questions; but even goes further and allows methods to be redefined or even synthesized and defined, for the first time, at runtime, with no corresponding source location or file. Method lookup and dispatch are fully Turing complete (you can `#send` anything, including fully dynamic method names, and respond to any message with arbitrary logic in `#method_missing`), and you can even redraw the method lookup chain and inheritance hierarchies at runtime (includes, mixins, module prepend, eigenclasses et al).

This is not a failing of JetBrains tooling but rather a pervasive language smell and consequence of Ruby philosophy.

replies(3): >>45105119 #>>45105413 #>>45105632 #
1. pmontra ◴[] No.45105632[source]
Of course it takes some heuristic to jump to the definition of these common Rails idioms

  belongs_to :customer # class Customer
  after_save :do_something # method
  validate :custom_validation # method
or a Ruby send(:method, arg)

But an IDE specialized in Ruby can do it. No idea if RubyMine does it.

Bonus for handling

  send("method_#{var}".to_sym, arg)
In general it can only present a menu of choices: all the methods with a name starting with "method_"