User Interface Specification:
"Smart Brackets"

Author: Gabriel Tichy
$Revision: 1.2 $
Table of Contents:


Introduction

The user often writes a code that has opening and closing brackets, and this is very often source of compilation errors. If the IDE would insert a closing bracket each time opening bracket is typed, the likelihood of error is smaller, and the user also has a better visualization of the structure.

Detailed Specification

Smart Pairs

When the user types a character which needs a closing pair, the IDE will automatically put this closing pair right after current insertion point. However, if the user continues typing and put also the closing pair (that is already typed), IDE should detect that and lets put only the one instance.
This should work vice versa too, i.e. when user is deleting opening pair, the closing pair should be deleted automatically as well (only when no other characters are present between these two).

Characters for which the automatic completion of closing pairs is supported:

Square Brackets: [ ]
Parenthesis: ( )
Single Quotes: ' '
Double Quotes: " "

Smart Brace

In case of braces, user have to press Enter right after the opening brace. Then, a new line is insterted along with the line containing the closing brace.

Before Enter

After Enter

  • identation for the new line works as usually
  • closing brace is added on the next line, indented as the original statement
  • if (already placed) closing brace is recognized, only new line is added

Undo

Undo is working exactly in the opposite direction for all of these.

Options

Option to turn on/off inserting of closing braces and other characters is placed under Editor Settings in Expert properties:
  • Name: Pair Character Completion
  • Values: boolean (checkbox component)

 

Project Features

About this Project

ui was started in November 2009, is owned by Jiří Kovalský, and has 43 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close