Question / feature request

In some other tools I've used, there is a feature that I have found quite
useful, and I'm wondering if it is in VS.Net / ReSharper and I've missed
it somehow.

Say I am calling a function foo. I type

foo("

and get

foo("")

So far so good. I now type some text, so I get

foo("my string value")

In the other (nameless...) tool, I can now hit tab to move the cursor to
the end of the line. IOW, I can type ; ]]> to complete the line.
Is there a key already in RS that does this? If not, I can create a VS macro
easily enough, but would rather not (they tend to be a bit slow).

TIA,
Keith Lancaster




2 comments
Comment actions Permalink

The Complete Statement feature is on our list of 2.0 features. The feature
completes the current construct (statement, loop header, etc) and ends the
line. Most probably default shortcut for Complete Statement would be Ctrl+Enter.

In some other tools I've used, there is a feature that I have found
quite useful, and I'm wondering if it is in VS.Net / ReSharper and
I've missed it somehow.

Say I am calling a function foo. I type

foo("

and get

foo("")

So far so good. I now type some text, so I get

foo("my string value")

In the other (nameless...) tool, I can now hit tab to move the cursor
to the end of the line. IOW, I can type <tab> ; <return> to complete
the line. Is there a key already in RS that does this? If not, I can
create a VS macro easily enough, but would rather not (they tend to be
a bit slow).

TIA,
Keith Lancaster

Thanks,
Andrey Simanovsky


0
Comment actions Permalink

In IntelliJ IDEA, I mapped the 'complete statement' to the Enter key
directly. The feature essentially worked just like "Enter" when there was
nothing special for it to do. I do hope you're going to try and make the
Resharper version that smart (I called the feature "Smart Enter" because it
just knew what to do in just about every case). I'd then map regular
'enter' to Ctrl+Enter for those very, very few cases where what Smart-Enter
and Enter would do are necessarily different, and I wanted the later
function.

For example (with '|' representing the cursor position), if I typed:

int x = foo("somestring|")

and pressed the "Complete Statement" key, I'd get:

int x = foo("somestring");


If I typed:

while (!someVar.Equal("Done

"))

and pressed the "Complete Statement" key, I'd get:

while (!someVar.Equal("Done"))
{

}

(depending on my brace preference settings of course).

Additionally, if my cursor was at the end of the line and there was nothing
left to do to "complete" it, it would just function like regular enter,
moving the cursor to the next line and opening a new line.

If I were just inside some quotes or some parens, and the statement simply
cannot be 'trivially' completed, then the keypress would simply move the
cursor outside the quotes or the parents to the next place where typing
needs to occur to complete the statement. For example, say I'm in a
function that has multiple parameters (and no single or empty parameter
overload exists), like "public string bar(string param1, string param2)" ...
if I type:

string result = bar("one|")

and then press "complete statement", it cannot validly complete the
statement, because bar takes TWO parameters, so it would position the cursor
like this:

string result = bar("one", |)

(again, depending on my spacing preference settings). Then, if I press
Complete Statement again immediately, because of the comma immediately to
the left of the cursor (ignoring white-space), it would work just like a
regular enter, allowing me to put the second parameter on a new line, like
this:

string result = bar("one",

)

Now, typing the following:

string result = bar("one",
"two

")

and pressing "Complete Statement" (aka "Smart Enter"), would result in the
finished statement, like this:

string result = bar("one",
"two");


I sincerely hope that this is the plan for the functioning of this "Complete
Statement" feature. It's by far one of the most useful features of IDEA,
and it makes the auto-insert of closing quote and brace and paren feature
really meaningful and useful rather than something that can occasionally get
in the way.




"Andrey Simanovsky (JetBrains)" <ands@intellij.com> wrote in message
news:36223632509251805487941@news.intellij.net...

The Complete Statement feature is on our list of 2.0 features. The feature
completes the current construct (statement, loop header, etc) and ends the
line. Most probably default shortcut for Complete Statement would be
Ctrl+Enter.

>
>> In some other tools I've used, there is a feature that I have found
>> quite useful, and I'm wondering if it is in VS.Net / ReSharper and
>> I've missed it somehow.
>>
>> Say I am calling a function foo. I type
>>
>> foo("
>>
>> and get
>>
>> foo("")
>>
>> So far so good. I now type some text, so I get
>>
>> foo("my string value")
>>
>> In the other (nameless...) tool, I can now hit tab to move the cursor
>> to the end of the line. IOW, I can type ; to complete >> the line. Is there a key already in RS that does this? If not, I can >> create a VS macro easily enough, but would rather not (they tend to be >> a bit slow). >> >> TIA, >>]]> Keith Lancaster

Thanks,
Andrey Simanovsky

>



0

Please sign in to leave a comment.