rubyminerubymine-7

Does Rubymine have the feature code snippet and all auto-complete


I'm used to the sublime text 3 editor.

It has many handy features.

take the code snippets for example,

Once you type begin then press TAB

It will generate the corresponding code block

begin

rescue Exception => e

end

And the plugin All Autocomplete

It can show the auto-complete hint for all opened files.

For example, if you have a variable name called taiwan_is_awesome

then you can get the autocomplete in other files.

Does Rubymine has the above features ?

If yes, what's the corresponding keymap ?

It's important for me to use those features.

THanks


Solution

  • Once you type begin then press TAB

    It's called "Live Templates".

    "Live templates (or code snippets) allow you to insert frequently-used constructions into your code. These can be conditions, blocks, loops, and so on."

    You can manage bundled and create new ones at Settings/Preferences | Editor | Live Templates.

    Here is a good "how to use" tutorial with screenshots: https://confluence.jetbrains.com/display/PhpStorm/Live+Templates+%28Snippets%29+in+PhpStorm -- it's for PhpStorm but exactly the same functionality is available in RubyMine.


    UPDATE: 2022-11-15
    The above tutorial link now automatically redirects to the corresponding Help page for PhpStorm.

    Here is the same official Help page but for RubyMine that shows how to use and create them: https://www.jetbrains.com/help/ruby/using-live-templates.html