RubyMine #820 Feedback - Syntax Highlighting and Inspections
Dear RubyMine Developers.
I've been using RubyMine #820 for a week now (moved from Netbeans) and I am just starting to get used to the new keybings.I continue to be impressed with the product .
I do, however, have a suggestion regarding Ruby syntaxt highlighting and the Ruby "Unresolved Ruby Reference" inspection. I've attached a screenshot to illustrate my suggestion; the top half of the screenshot shows a Netbeans capture whilst the bottom halt of the screen shot shows the RubyMine equivalent.
Appologies in advance if I have misunderstood the "Unresolved Ruby Reference" inspection.
1. Is there anyway to configure the "Unresolved Ruby Reference" inspection to ignore all instance variables/methods? Notice in the RubyMine that topic.user, topic.locked and so on are marked as unresolved. Ideally, I would want this inspection to only highlight local unresolved variables or have an option that limit inspections to a method's scope only. I appreciate that due to Ruby's dynamic nature, it might not be possible to infer the type of a variable in the give example. Would be better to not highlight variables/methods in this situation? Otherwise, is there an alternative method by which only local unresolved variables are highlighted?
2. Note the return topic, post line in both the screenshots. both topic and post should be highlighted by the "Unresolved Reference" inpsection as the return references these two variables outside the Transaction block and as such they will both be undefined in that scope.
3. Unused variable highlight. Is there a way to highlight unused variables inside a method (for either a method parameter or local method? I note that there is a "Unsued symbol" but I don't think that's what I'm looking for.
Thanks for your time and a great product!
Attachment(s):
var_comp.jpg
Please sign in to leave a comment.
Hello Nazar,
Is there any chance to have a look at full method code? In screenshot attached I can see only the beggining. About rescticting scope of unresolved ruby reference: it's a point to discuss. Maybe we'll add this in future (maybe 1.5 version).
These 2 local variables can really be undefined in some cases. It's another inspection: Scope inspection. Maybe we should assume that every block call is guranteed to be executed.
We already have an issue: http://www.jetbrains.net/jira/browse/RUBY-1841
Feel free to vote and track progress of it.
Regards,
Oleg
Hello Oleg.
Thank you for taking the time to reply to my post.
Above is a class method for model Topic (app/models/topic.rb). I've bolded the instance variables that RubyMine highlights with the "Unresolved Ruby Reference" inspection. Pointing the mouse over poster_id (for instance) shows a hint with: Cannot find 'poster_id = ' more....
Topic defines posts as:
Forum model defines :topics as:
topic.locked and topic.sticky are both mapped to database fields as is post.poster_id.
HTH.
Perfect! The Ruby Scope inspection does indeed pick this up. My color settings were not setup to highlight this (I need to give my eyes a break )
Voted.
Again, thanks for your reply and help.
Cheers.
Hi again Oleg.
Just a quick followup to say the the "Unresolved Ruby Reference" is behaving strangley in my routes.rb file. Please see attachement.
Attachment(s):
routes.jpeg
Hi Nazar,
You can disable "Warn about implicit text matched resolve results" option in settings of Unresolved reference inspection. In this case if method call wasn't found by type inference algorithm but method with the same name exists in context (required scripts, Ruby SDK, attached gems), the call wont be highlighted with warning. Obviously the option will decrease smartness of RubyMine's Unresolved ref inspection but also decrease amount of false positives.