Ctrl-Shift-Enter does not enter a new-line

Is it intentional, that Ctrl-Shift-Enter completes the line, jumps to
the line end but does not creates a new line?

Tom

8 comments

Yes. As the result of the discussion here I finally came up with the
following:

1. If there's no syntax errors to be fixed in the statement at caret
Ctrl+Shift-Enter inserts new line afther that statement even if the
statement is multiline.
1a. If the statement is one of return or throw the new line inserted where
an execution can be continued (thus after current code block).
2. If there are syntax errors they are fixed if possible and the caret is
moved to the end of the line.
3. If there are syntax errors that can't be fixed caret is placed there.

4. (NOT YET AVALIABLE IN 813). If CSE pressed in a whitespace before the
statement the new line is inserted BEFORE the statement and caret left in
that line.

Finally this looks like not easy to understand and use but I've mapped CSE
to plain Enter and it appears handy. I rarely need old Enter behavior
usually when I need to break a line somewhere in comments or whatever. I've
mapped that to Ctrl+Enter.


What do you think?

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Thomas Singer" <fake@fake.com> wrote in message
news:4f2favk01ov4r69t95jtperq85fsshn5h7@4ax.com...

Is it intentional, that Ctrl-Shift-Enter completes the line, jumps to
the line end but does not creates a new line?

>

Tom



0

Thanks for the detailed answer.

>2. If there are syntax errors they are fixed if possible and the caret is
>moved to the end of the line.

Can this be change to insert a new-line, too?

Tom


"Maxim Shafirov" <max@intellij.net> schrieb:

>Yes. As the result of the discussion here I finally came up with the
>following:
>
>1. If there's no syntax errors to be fixed in the statement at caret
>Ctrl+Shift-Enter inserts new line afther that statement even if the
>statement is multiline.
>1a. If the statement is one of return or throw the new line inserted where
>an execution can be continued (thus after current code block).
>2. If there are syntax errors they are fixed if possible and the caret is
>moved to the end of the line.
>3. If there are syntax errors that can't be fixed caret is placed there.
>
>4. (NOT YET AVALIABLE IN 813). If CSE pressed in a whitespace before the
>statement the new line is inserted BEFORE the statement and caret left in
>that line.
>
>Finally this looks like not easy to understand and use but I've mapped CSE
>to plain Enter and it appears handy. I rarely need old Enter behavior
>usually when I need to break a line somewhere in comments or whatever. I've
>mapped that to Ctrl+Enter.
>
>
>What do you think?

0

Can't satisfy everyone, sorry.

If you map CSE to plain Enter then what you ask is just pressing Enter
twice. Quite simple.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Thomas Singer" <fake@fake.com> wrote in message
news:rghfavou4f50ipcqgmgarlsr4cb577jjhf@4ax.com...

Thanks for the detailed answer.

>

>2. If there are syntax errors they are fixed if possible and the caret is
>moved to the end of the line.

>

Can this be change to insert a new-line, too?

>

Tom

>
>

"Maxim Shafirov" <max@intellij.net> schrieb:

>

>Yes. As the result of the discussion here I finally came up with the
>following:
>
>1. If there's no syntax errors to be fixed in the statement at caret
>Ctrl+Shift-Enter inserts new line afther that statement even if the
>statement is multiline.
>1a. If the statement is one of return or throw the new line inserted

where

>an execution can be continued (thus after current code block).
>2. If there are syntax errors they are fixed if possible and the caret is
>moved to the end of the line.
>3. If there are syntax errors that can't be fixed caret is placed there.
>
>4. (NOT YET AVALIABLE IN 813). If CSE pressed in a whitespace before the
>statement the new line is inserted BEFORE the statement and caret left in
>that line.
>
>Finally this looks like not easy to understand and use but I've mapped

CSE

>to plain Enter and it appears handy. I rarely need old Enter behavior
>usually when I need to break a line somewhere in comments or whatever.

I've

>mapped that to Ctrl+Enter.
>
>
>What do you think?

>


0

Sounds good to me, but the proof will be in the using... I'll let you know
:)

"Maxim Shafirov" <max@intellij.net> wrote in message
news:b88877$n2b$1@is.intellij.net...

Yes. As the result of the discussion here I finally came up with the
following:

>

1. If there's no syntax errors to be fixed in the statement at caret
Ctrl+Shift-Enter inserts new line afther that statement even if the
statement is multiline.
1a. If the statement is one of return or throw the new line inserted where
an execution can be continued (thus after current code block).
2. If there are syntax errors they are fixed if possible and the caret is
moved to the end of the line.
3. If there are syntax errors that can't be fixed caret is placed there.

>

4. (NOT YET AVALIABLE IN 813). If CSE pressed in a whitespace before the
statement the new line is inserted BEFORE the statement and caret left in
that line.

>

Finally this looks like not easy to understand and use but I've mapped CSE
to plain Enter and it appears handy. I rarely need old Enter behavior
usually when I need to break a line somewhere in comments or whatever.

I've

mapped that to Ctrl+Enter.

>
>

What do you think?

>

--

>

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"

>
>

"Thomas Singer" <fake@fake.com> wrote in message
news:4f2favk01ov4r69t95jtperq85fsshn5h7@4ax.com...

Is it intentional, that Ctrl-Shift-Enter completes the line, jumps to
the line end but does not creates a new line?

>

Tom

>
>


0

Thanks for this, I have found it useful to map CtrlShiftEnter to enter too.

However, there's still a problem with the situation:

Hashtable h = new Hashtable();
h.put("hello|

This goes to

h.put("hello");

which is immediately marked as an error. I think it may be worth considering again how this function works with methods taking multiple parameters.

Personally, I'd like to see this go to something like:

h.put("hello", |

Or at least a tooltip pops up saying "method put(Object, Object) expects more parameters".

0

A few more quirks:

start with:

press CSE

usually I'd want this

Another quirk:

start with

press CSE

Looks like this double {} insertion happens anytime there are more than one set of parentheses. Should I file this as a bug? Also, the insertion point should be on the line between the new braces, not right after the first brace.

0

Personally, I'd like to see this go to something like:

>

h.put("hello", |

>

Exactly. If more parameters are expected/required, it should do just as you
indicated above. Only if there's a valid function signature that matches
the number of parameters, should it close and complete.

Of course, maybe another (easier to implement) option would be to do the
following:

h.put("hello",|);

In other words, complete as it does currently, then notice that there aren't
enough parameters, and then place the comma (and space according to your
space formatting), and position the cursor to allow you to type in the next
parameter. :)

However, it would be nice if the feature were aware of not only the method
signatures, but if you had use auto-complete and selected a specific
signature from the list, that it would remember the correct number of
parameters for that signature (this disambiguating cases where the same
method can take one, two, or three parameters).

Just a thought.


0

Definitely file a tracker on these issues.

"Peter Morelli" <jiveadmin@jetbrains.com> wrote in message
news:19738163.1051289669580.JavaMail.jrun@is.intellij.net...

A few more quirks:

>

start with:

    if (true)|
>
>    System.out.println("after if");
> ]]>

press CSE

    if (true)
>
>    System.out.println("after if");
>    |
> ]]>

usually I'd want this

    if (true)
>    {
>       |
>    }
>
>    System.out.println("after if");
> ]]>

Another quirk:

>

start with

    if ((true) && (true|
>    {
>        System.out.println("true");
>    }
> ]]>

press CSE

    if ((true) && (true))
>    {|
>
>    }
>    {
>        System.out.println("true");
>    }
> ]]>

Looks like this double {} insertion happens anytime there are more than

one set of parentheses. Should I file this as a bug? Also, the insertion
point should be on the line between the new braces, not right after the
first brace.


0

Please sign in to leave a comment.