Module: Ruber::AutoEnd

Defined in:
plugins/auto_end/auto_end.rb

Overview

Note:

This plugin does nothing unless the text is inserted in the document while one of the views associated with it has focus

Plugin which automatically inserts an end keyword after the user presses Enter after a line starting a construct which requires it.

The algorithm used to find out whether an end should be inserted after the current line is very simple: the line is checked against several possible regexps. The end is inserted if any of the regexps matches.

The above algorithm has the limitation of not being able to tell whether the line is inside a multiline string or a block comment, and can thus lead to spurious @end@s being added.

Another problem with the way the plugin works now is that it has no way to know whether a given keyword already has its closing end. To try to lessen this issue, before inserting an end, this plugin checks the indentation of the following line, comparing it to the indentation of the line where Enter has been pressed. If the former is greater than the latter, it assumes that the user is editing an already-existing construct and doesn’t insert the end.

Defined Under Namespace

Classes: Extension