Incorrect behaviour with braces?

Hi,

I've noticed the following behaviour from ReSharper build 67 (not sure
if it was present before, but I don't recall it). When I type out
something which uses {}s (e.g. if statement, using, foreach, etc.), I
will usually use the key sequence { - Enter - } as a way of creating an
empty block in which to dump my code. With the current build, this key
sequence will cause a second } to be added rather than overwriting the
auto-generated } as I would expect.

A second behaviour with brackets that I've noticed is with ()s. Assume I
have the following line of code:

Panel curPanel = this.LoadPanelForName(someString);

Now, I want to change the 'someString' parameter to something else,
which involves adding a bracket after the parameter. When I attempt to
add a ) bracket after someString, it will auto-overwrite the ) that is
there, no matter how many times I press the back arrow and type ) again.

Finally (and this I just noticed while writing this post), if I
highlight 'someString' and press the " or ' key, I only get one "/'
instead of two. Please note that this works as expected for (), {}, and
[] (I get both brackets).

These are really minor nitpicks though, and overall I'm really enjoying
having this plugin so far. Thanks for creating this.

-=Straxus=-

P.S. Does output which appears on the Debug console get logged anywhere
other than in that console? I've encountered a consistent crash when
adding a project to a solution (which required me to uninstall ReSharper
66 to get the add completed) and I was wondering if I could locate a log
to pass along.

6 comments
Comment actions Permalink

"David Spade" <mines@home.com> wrote in message
news:c1jok9$3dj$1@is.intellij.net...

P.S. Does output which appears on the Debug console get logged anywhere
other than in that console? I've encountered a consistent crash when
adding a project to a solution (which required me to uninstall ReSharper
66 to get the add completed) and I was wondering if I could locate a log
to pass along.


David,

since build 67 the debug console is hidden, and the debug output is logged
to a temporary file.
However, all unhandled exceptions can be posted via the error reporting
form. Have you
seen this form during the crash? Could you please tell us more about this
crash?

It is also unnecessary to uninstall ReSharper in the case you mentioned. You
can temporarily
turn it off thru Tools->Options->Add-in Manager.


0
Comment actions Permalink

Hi David!

Thank you for the usability report.

I've noticed the following behaviour from ReSharper build 67 (not sure
if it was present before, but I don't recall it). When I type out
something which uses {}s (e.g. if statement, using, foreach, etc.), I
will usually use the key sequence { - Enter - } as a way of creating an
empty block in which to dump my code. With the current build, this key
sequence will cause a second } to be added rather than overwriting the
auto-generated } as I would expect.


Yes, this is the case for the 67 build.
There is no brace auto-insertion strategy which will satisfy all user cases
of the input, so we've tried to optimize some most useful cases.

In your example you have to press only { - Enter
At this point cursor will not be at the closing brace, so we can't skip it
(otherwise it will be impossible to insert the closing brace first, before
the opening one).

If you dislike the brace auto-insertion, you could switch it off through the
ReSharper options menu.
Any suggestions are welcomed! :)

A second behaviour with brackets that I've noticed is with ()s. Assume I
have the following line of code:
Panel curPanel = this.LoadPanelForName(someString);
Now, I want to change the 'someString' parameter to something else,
which involves adding a bracket after the parameter. When I attempt to
add a ) bracket after someString, it will auto-overwrite the ) that is
there, no matter how many times I press the back arrow and type ) again.


Please clarify:

If you have the following code (cursor at the | position):
Panel curPanel = this.LoadPanelForName(someString|)
Pressing the ")" will overwrite the existing one (because the bracket
balance is correct)

If you have the following code (cursor at the | position):
Panel curPanel = this.LoadPanelForName(someString(|)
Pressing the ")" will ADD the closing bracket

Anyway, I think it is a good practice to type the open bracket first, and
then the close bracket (and not otherwise) :)

Finally (and this I just noticed while writing this post), if I
highlight 'someString' and press the " or ' key, I only get one "/'
instead of two. Please note that this works as expected for (), {}, and
[] (I get both brackets).


If you have the following code:
|someString
Typing the " char will not auto-insert pair quote. The smart inserter thinks
here that you are going to enclose the someString in quotes

---
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Dmitry Shaporenkov(JetBrains) wrote:

"David Spade" <mines@home.com> wrote in message
news:c1jok9$3dj$1@is.intellij.net...

>>P.S. Does output which appears on the Debug console get logged anywhere
>>other than in that console? I've encountered a consistent crash when
>>adding a project to a solution (which required me to uninstall ReSharper
>>66 to get the add completed) and I was wondering if I could locate a log
>>to pass along.


David,

since build 67 the debug console is hidden, and the debug output is logged
to a temporary file.
However, all unhandled exceptions can be posted via the error reporting
form. Have you
seen this form during the crash? Could you please tell us more about this
crash?

It is also unnecessary to uninstall ReSharper in the case you mentioned. You
can temporarily
turn it off thru Tools->Options->Add-in Manager.


Hi Dmitry,

The mentioned form didn't appear during that crash. The debug console
appeared with several stack traces in it, and then the standard
WindowsXP "Please report this error to MS" dialog came up.

Also, thanks for the note on the disabling of the plugin - noted for
future reference.

-=Straxus=-

0
Comment actions Permalink

Eugene Pasynkov wrote:

Hi David!

Thank you for the usability report.

>>I've noticed the following behaviour from ReSharper build 67 (not sure
>>if it was present before, but I don't recall it). When I type out
>>something which uses {}s (e.g. if statement, using, foreach, etc.), I
>>will usually use the key sequence { - Enter - } as a way of creating an
>>empty block in which to dump my code. With the current build, this key
>>sequence will cause a second } to be added rather than overwriting the
>>auto-generated } as I would expect.


Yes, this is the case for the 67 build.
There is no brace auto-insertion strategy which will satisfy all user cases
of the input, so we've tried to optimize some most useful cases.

In your example you have to press only { - Enter
At this point cursor will not be at the closing brace, so we can't skip it
(otherwise it will be impossible to insert the closing brace first, before
the opening one).

If you dislike the brace auto-insertion, you could switch it off through the
ReSharper options menu.
Any suggestions are welcomed! :)


"You can't please all the people all the time" - noted. :)

>>A second behaviour with brackets that I've noticed is with ()s. Assume I
>>have the following line of code:
>>Panel curPanel = this.LoadPanelForName(someString);
>>Now, I want to change the 'someString' parameter to something else,
>>which involves adding a bracket after the parameter. When I attempt to
>>add a ) bracket after someString, it will auto-overwrite the ) that is
>>there, no matter how many times I press the back arrow and type ) again.


Please clarify:

If you have the following code (cursor at the | position):
Panel curPanel = this.LoadPanelForName(someString|)
Pressing the ")" will overwrite the existing one (because the bracket
balance is correct)

If you have the following code (cursor at the | position):
Panel curPanel = this.LoadPanelForName(someString(|)
Pressing the ")" will ADD the closing bracket

Anyway, I think it is a good practice to type the open bracket first, and
then the close bracket (and not otherwise) :)


Adopting the | as the position of the caret, I start with the following
code:

Panel curPanel = this.LoadPanelForName(someString);

Now, I want to turn this into:

Panel curPanel = this.LoadPanelForName(((Cast) someString).Property);

and, since I'm lazy, I want to use autocompletion to automatically add
.Property once I cast someString correctly. So, since my cursor's
already at the end of the line:

Panel curPanel = this.LoadPanelForName(someString|);

I start with the ) at the end of the cast:

Panel curPanel = this.LoadPanelForName(someString)|);

And then move to the front and complete the cast:

Panel curPanel = this.LoadPanelForName(((Cast) someString)|);

and then, I bounce back to the end and press . to trigger my
autocompletion. However, since the ) that I first type automatically
overwrites the existing ), I don't get the behaviour I'd expect.

I think the main issue stems from the fact that, when I return to this
line after doing some edit somewhere else e.g. another file, I wouldn't
expect the auto-overwrite to still be happening.

>>Finally (and this I just noticed while writing this post), if I
>>highlight 'someString' and press the " or ' key, I only get one "/'
>>instead of two. Please note that this works as expected for (), {}, and
>>[] (I get both brackets).


If you have the following code:
|someString
Typing the " char will not auto-insert pair quote. The smart inserter thinks
here that you are going to enclose the someString in quotes


Looks like I wasn't clear what I meant with this one. For this example,
assume that the code in [] is currently highlighted.

So, I have the following line:

Panel curPanel = this.LoadPanelForName(someString);

And I highlight 'someString', giving me:

Panel curPanel = this.LoadPanelForName(|);

Now, when I press either " or '. I am actually deleting the highlighted
text:

Panel curPanel = this.LoadPanelForName(|);

And then automatically replacing it with " or ':

Panel curPanel = this.LoadPanelForName("|);

and this sequence doesn't generate the double ""/'' that I would expect.

Thanks,

-=Straxus=-

0
Comment actions Permalink

This is just FYI to the ReSharper team just in case you didnt already know
it: you can sign up your application with Microsoft (free) to receive the
dumps that are submitted using this dialog. I don't have the link handy but
I can look it up if you'd like.

-Michael

>

The mentioned form didn't appear during that crash. The debug console
appeared with several stack traces in it, and then the standard
WindowsXP "Please report this error to MS" dialog came up.

>

Also, thanks for the note on the disabling of the plugin - noted for
future reference.

>

-=Straxus=-



0
Comment actions Permalink

Hi David!

>>I've noticed the following behaviour from ReSharper build 67 (not sure
>>if it was present before, but I don't recall it). When I type out
>>something which uses {}s (e.g. if statement, using, foreach, etc.), I
>>will usually use the key sequence { - Enter - } as a way of creating an
>>empty block in which to dump my code. With the current build, this key
>>sequence will cause a second } to be added rather than overwriting the
>>auto-generated } as I would expect.


BTW, in build 68 there are minor changes in braces processing strategy.
Please take a look on it - may be it will satisfy you.

I think the main issue stems from the fact that, when I return to this
line after doing some edit somewhere else e.g. another file, I wouldn't
expect the auto-overwrite to still be happening.


I will think on this....
Looks like your suggestion is good

>and this sequence doesn't generate the double ""/'' that I would expect.

This is a bug. Will be fixed in the neares build.

--
---
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"David Spade" <mines@home.com> wrote in message
news:c1l7j5$t16$1@is.intellij.net...

Eugene Pasynkov wrote:

>

Hi David!

>

Thank you for the usability report.

>
>>I've noticed the following behaviour from ReSharper build 67 (not sure
>>if it was present before, but I don't recall it). When I type out
>>something which uses {}s (e.g. if statement, using, foreach, etc.), I
>>will usually use the key sequence { - Enter - } as a way of creating an
>>empty block in which to dump my code. With the current build, this key
>>sequence will cause a second } to be added rather than overwriting the
>>auto-generated } as I would expect.
>

Yes, this is the case for the 67 build.
There is no brace auto-insertion strategy which will satisfy all user

cases

of the input, so we've tried to optimize some most useful cases.

>

In your example you have to press only { - Enter
At this point cursor will not be at the closing brace, so we can't skip

it

(otherwise it will be impossible to insert the closing brace first,

before

the opening one).

>

If you dislike the brace auto-insertion, you could switch it off through

the

ReSharper options menu.
Any suggestions are welcomed! :)

>

"You can't please all the people all the time" - noted. :)

>

>>A second behaviour with brackets that I've noticed is with ()s. Assume I
>>have the following line of code:
>>Panel curPanel = this.LoadPanelForName(someString);
>>Now, I want to change the 'someString' parameter to something else,
>>which involves adding a bracket after the parameter. When I attempt to
>>add a ) bracket after someString, it will auto-overwrite the ) that is
>>there, no matter how many times I press the back arrow and type ) again.
>

Please clarify:

>

If you have the following code (cursor at the | position):
Panel curPanel = this.LoadPanelForName(someString|)
Pressing the ")" will overwrite the existing one (because the bracket
balance is correct)

>

If you have the following code (cursor at the | position):
Panel curPanel = this.LoadPanelForName(someString(|)
Pressing the ")" will ADD the closing bracket

>

Anyway, I think it is a good practice to type the open bracket first,

and

then the close bracket (and not otherwise) :)

>

Adopting the | as the position of the caret, I start with the following
code:

>

Panel curPanel = this.LoadPanelForName(someString);

>

Now, I want to turn this into:

>

Panel curPanel = this.LoadPanelForName(((Cast) someString).Property);

>

and, since I'm lazy, I want to use autocompletion to automatically add
.Property once I cast someString correctly. So, since my cursor's
already at the end of the line:

>

Panel curPanel = this.LoadPanelForName(someString|);

>

I start with the ) at the end of the cast:

>

Panel curPanel = this.LoadPanelForName(someString)|);

>

And then move to the front and complete the cast:

>

Panel curPanel = this.LoadPanelForName(((Cast) someString)|);

>

and then, I bounce back to the end and press . to trigger my
autocompletion. However, since the ) that I first type automatically
overwrites the existing ), I don't get the behaviour I'd expect.

>

I think the main issue stems from the fact that, when I return to this
line after doing some edit somewhere else e.g. another file, I wouldn't
expect the auto-overwrite to still be happening.

>

>>Finally (and this I just noticed while writing this post), if I
>>highlight 'someString' and press the " or ' key, I only get one "/'
>>instead of two. Please note that this works as expected for (), {}, and
>>[] (I get both brackets).
>

If you have the following code:
|someString
Typing the " char will not auto-insert pair quote. The smart inserter

thinks

here that you are going to enclose the someString in quotes

>

Looks like I wasn't clear what I meant with this one. For this example,
assume that the code in [] is currently highlighted.

>

So, I have the following line:

>

Panel curPanel = this.LoadPanelForName(someString);

>

And I highlight 'someString', giving me:

>

Panel curPanel = this.LoadPanelForName(|);

>

Now, when I press either " or '. I am actually deleting the highlighted
text:

>

Panel curPanel = this.LoadPanelForName(|);

>

And then automatically replacing it with " or ':

>

Panel curPanel = this.LoadPanelForName("|);

>

and this sequence doesn't generate the double ""/'' that I would expect.

>

Thanks,

>

-=Straxus=-



0

Please sign in to leave a comment.