Friday, August 17, 2012

GSoC: Improving KDevelop Ruby Support Part 2

Hi all!

In my last post I talked about some of the features I've been working on this GSoC period. Well, now it's time for code completion. Here it goes:
The first thing that KDevelop is showing us is the completion of some ruby builtins like require and require_relative. But I personally find more interesting the following:
It offers code completion for required files when possible. This is also true for the require_relative, as shown here:
Note that in the completion of required files, the final ".rb" is omitted in the end result. This is certainly cool, but let us continue with the code. Now I want to write an "if" statement. After writing "if", KDevelop offers me the completion for this keyword. If I hit enter, this is what happens:
KDevelop puts the "end" keyword for me and it's also reminding me that I should write a condition expression by selecting the "condition" word. Ok, now I want to use the SecureRandom module (which is reachable thanks to the first require) :
As you can see, KDevelop knows which class/modules/methods are reachable in the current context. In this case, the only module that KDevelop knows that starts with "Secure" is "SecureRandom". And finally, let's show code completion for method calls:
KDevelop detected that the class "User" has a method named "create!" and it's giving me some info about this method (parameters, returning type, ...).

And that is all for today.
Bye!

9 comments:

  1. I need it. I NEED IT NOW.

    Are you also going to work on debug tools ?

    ReplyDelete
    Replies
    1. My top priority right now is stability, so most of my efforts will focus on this aspect. This means that in a short term, I don't plan to work on debugging tools, even though it's a really interesting idea :) Thanks for the comment!

      Delete
  2. I read in the README that the parser will only work with Ruby < 1.9, is this still the case? If yes, any plans on supporting 1.9+?

    ReplyDelete
    Replies
    1. The parser supports ruby 1.9.x . What the README file says is that if you want to test the parser, you have to use ruby 1.8. This is because the gem we're using to test the parser hasn't been ported yet to ruby 1.9.

      Delete
  3. Hello, did you and if yes when you plan publish this project?

    ReplyDelete
    Replies
    1. What do you mean by "publish". If you mean like releasing a stable version, then no, there's no plan to release a stable version yet. I'll think more about this as soon as possible though :)

      Delete
  4. Hi,

    I assume this is the code? https://projects.kde.org/projects/playground/devtools/plugins/kdev-ruby/repository

    Can you explain I can use this code to get a kdev-plugin? I didn't find any documentation on this. Thanks!

    ReplyDelete
    Replies
    1. Hm.. I tried to compile it at least but the configuration aborts with:
      CMake Error at file_templates/CMakeLists.txt:5 (kdevplatform_add_file_templates):
      Unknown CMake command "kdevplatform_add_file_templates".

      Do you know what to do?
      I use kde 4.9.3

      Delete
    2. You can find all the documentation of kdev-ruby here: http://techbase.kde.org/Projects/KDevelop4/Ruby . Your error is because you're not using kdevplatform master. You'll have to compile kdevplaform from master and then you'll be able to compile the kdev-ruby plugin.

      Delete