Some code insight bugs in latest EAP

Just wanted to report these in case they arent already in:

Incorrect warnings about not found references:
- 5.to_i - 2  ... "-" cannot be found fot Integer (this one is funny )
- RAILS_DEFAULT_LOGGER
- read_attribute / write_attribute_with_dirty
- (5-3).times  (times cannot be resolved)
- constants and globals defined in initializers cannot be resolved
- when defaulting an instance variable, eg: @var ||= 'hello'  .. (@var not found)

Incorrect unreachable code warning after case statement when all paths return.
example:
case 'hello'
when 'not_me'
     return
end
return true (<-- warning here)

All for now.
Love your new product!

3 comments
Comment actions Permalink

Hello Stefan,

Thanks a lot for your feedback!

- when defaulting an instance variable, eg: @var ||= 'hello'  .. (@var not found)


This will be fixed in coming EAP.

- 5.to_i - 2  ... "-" cannot be found fot Integer (this one is funny :D)

- (5-3).times  (times cannot be resolved)

I`ve created an issue on this: http://www.jetbrains.net/jira/browse/RUBY-2407.
Feel free to comment, vote or track progress.

Incorrect unreachable code warning after case statement when all paths return.

example:
case 'hello'
when 'not_me'
     return
end
return true (<-- warning here)

Issue: http://www.jetbrains.net/jira/browse/RUBY-2408

- constants and globals defined in initializers cannot be resolved

Could you please describe this case more precisely?

Regards,
Oleg

0
Comment actions Permalink

Could you please describe this case more precisely?


Yup. If you have constants and globals defined in a file that is placed in the initializers directory, they should be made available everywhere in your app. Same goes for constants in environment files.

A question out of curiosity: Is the goal of rubymine's code completion feature to provide REAL intellisense like for example SapphireSteels Ruby-In-Steel and CodeGears 3rdRail? For example, if you define a method there using "define_method 'mymethod'", it will autocomplete the "mymethod" function name. I don't know how they are doing it, but I believe they have not only an internal AST, they also execute it and take the results to provide code completion. However, they are extremely expensive. I'm really interested if rubymine's code completion will be as powerfull and accurate one day.

0
Comment actions Permalink

Hello Stefan,

A question out of curiosity: Is the goal of rubymine's code completion feature to provide REAL intellisense like for example SapphireSteels Ruby-In-Steel and CodeGears 3rdRail? For example, if you define a method there using "define_method 'mymethod'", it will autocomplete the "mymethod" function name. I don't know how they are doing it, but I believe they have not only an internal AST, they also execute it and take the results to provide code completion. However, they are extremely expensive. I'm really interested if rubymine's code completion will be as powerfull and accurate one day.

Shurely it is. As you mentioned we also use not only AST (PSI in IntelliJ IDEA terms) but some technic to provide Itellisense for Ruby and Rails projects - some kind of on the fly execution.
We are working hard on improvement understanding of Rails dynamic logic.

Thanks,
Oleg

0

Please sign in to leave a comment.