AutoNewline 

HOME INDEX SEARCH GO  

 <<O>>  Difference Topic AutoNewline (r1.2 - 15 Jun 2003 - AlexL)
Added:
>
>

NOTE: You must have Editor->Smark Keys->Enter->Smart Indent turned on for AutoNewline to work.


 <<O>>  Difference Topic AutoNewline (r1.1 - 14 Jun 2003 - AlexL)
Added:
>
>

%META:TOPICINFO{author="AlexL" date="1055550780" format="1.0" version="1.1"}%

AutoNewline

Purpose

AutoNewline insert newlines and indent caret when open brace, close brace, semi-colon are pressed. Also, changes TAB to reindent.

Description

Special Note: This is experimental code. I have been using it for the past few days, but there are likely many bugs in the behavior, esp. in other people's environment. Has only been tested on Aurora 818 and 823.

AutoNewline enables electric behavior of the open brace, close brace, semi-colon characters. When these are pressed, the current line is reindented (if necessary) and then a newline is inserted and the caret is positioned on the next line at the indent level.

Exceptions: AutoNewline mode is only operational when editing a java file (PsiJavaFile?).

Exception: If you press open brace, close brace, semi-colon in a string literal, then they will just emit the character.

Cleanups: There are certain cases where the newline should not be emitted, e.g.

if (expression) {
    statement;
}
else (expression) {
}
In this case, a newline should not have been inserted between } and else. These cases are handled by cleanups. Here are the currently supported cleanups:

* brace-else-brace -- Cleanup } else { constructs by placing the entire construct on a single line. Clean-up occurs when the open brace after the else is typed.

* brace-elseif-brace -- Similar to the brace-else-brace clean-up, but this cleans up } else if (...) { constructs.

* brace-catch-brace -- Analogous to brace-elseif-brace, but cleans up } catch (...) { in C++ and Java mode. * defun-close-semi -- Clean up the terminating semi-colon on top-level function or class definitions when they follow a close brace. Clean up occurs when the semi-colon is typed.

Please refer to the CCMode AutoNewline minor mode documentation for more background on this feature. http://cc-mode.sourceforge.net/cc-mode.html#Auto-newline%20Insertion

How to deploy.

Relevant posts/requests:

Feature Request #12358- SmartKey? semicolon ; http://www.intellij.net/forums/thread.jsp?forum=15&thread=30002

Feature Request #12357- SmartKey? Brace opening { and closing brace } http://www.intellij.net/forums/thread.jsp?forum=15&thread=30000

Key Mapping.

AutoNewline plugin modifies the behavior of the open brace (shift [), close brace (shift ]), semi-colon (;), and TAB keys.

You will find the keymappings under Other->AutoNewline You can selectively disable each feature. For the TAB key, it is bound to AutoNewline.IndentLinesAndCaret by default. If you don't want the caret to be repositioned, you can bind it to AutoNewline.IndentLines.

History.

0.3 - Jun 13, 2003

Initial Version.

-- AlexL - Jun 13, 2003 %META:FORM{name="IntelliJPluginWebForm"}% %META:FIELD{name="IntelliJPluginName" title="IntelliJPluginName" value="AutoNewline"}% %META:FIELD{name="IntelliJPluginVersion" title="IntelliJPluginVersion" value=""}% %META:FIELD{name="IntelliJPluginVendor" title="IntelliJPluginVendor" value=""}% %META:FIELD{name="IntelliJPluginBinary" title="IntelliJPluginBinary" value=""}% %META:FIELD{name="IntelliJPluginSource" title="IntelliJPluginSource" value=""}% %META:FIELD{name="IntelliJPluginClassification" title="IntelliJPluginClassification" value="CodeHelper"}% %META:FIELD{name="TopicClassification" title="TopicClassification" value="IntelliJPluginPackage"}% %META:FIELD{name="TopicShortDescription" title="TopicShortDescription" value="AutoNewline insert newlines and indent caret when open brace, close brace, semi-colon are pressed. TAB reindents line.%_N_%"}% %META:FIELD{name="TestedOnOS" title="TestedOnOS" value="AnyOS"}% %META:FIELD{name="ShouldRunOnOS" title="ShouldRunOnOS" value="AnyOS"}% %META:FILEATTACHMENT{name="AutoNewline-0.3.jar" attr="" comment="" date="1055550422" path="C:\usr\software\IDEA823\plugins\AutoNewline-0.3.jar" size="23555" user="AlexL" version="1.1"}%


View | Diffs | r1.2 | > | r1.1 | More

e d i t a t t a c h r e f - b y d i f f s
Ideas,requests,problems regarding this site? Send feedback.
Copyright @ 2000-2003 by the contribution authors. All material on this collaboration tool is the property of the contributing authors.

Revision r1.1 - 14 Jun 2003 - 00:33 GMT - AlexL
Revision r1.2 - 15 Jun 2003 - 22:21 GMT - AlexL
Copyright © 2001 by the contributing authors. All material on this collaboration tool is the property of the contributing authors.
Ideas, requests, problems regarding this site? Send feedback.