This is a migrated thread and some comments may be shown as answers.

Code formatter: whitespaces missing in type initializers

4 Answers 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrei
Top achievements
Rank 1
Andrei asked on 24 Jul 2012, 08:53 PM
Hi guys,

Here's a new issue wth the formatter. Say you type an array initializer:
private string[] _myarray = new[] {"",""};
Typing assistant was kind enough to help me out with double quotes but in the end there are no whitespaces...
I checked my settings and it says to put whilespaces in array initializer wherewhere except for 'Before comma' and it seems to be the default.

Funny enough, selecting this piece of code and hitting Ctrt+Alt+F will bring the spaces back. However, as I remember bare-bones VS does this as you type in this case. By the way, I tried to enable 'Autoformat on semicolon' with no luck..

It's not only an issue with arrays, but it concerns all initializers. Imagine you have a class MyClass with a public property MyProp. Then you are instantiating it like this:
var mc = new MyClass { MyProp = 2|}

The whitespace before MyProp is there because I typed it.

When you hit semicolon it becomes:
var mc = new MyClass { MyProp = 2};|

Something is missing ;)

4 Answers, 1 is accepted

Sort by
0
Zdravko
Telerik team
answered on 26 Jul 2012, 04:03 PM
Hi,

 Thanks for contacting.
I tried to reproduce, but with no success. Would you open your setting file located in %appdata%\JustCode\settings-justcode.xml and check if these tags are "true" :

<ArrayInitializerSpaceAfterOpenBrace>true</ArrayInitializerSpaceAfterOpenBrace>
      <ArrayInitializerSpaceBeforeCloseBrace>true</ArrayInitializerSpaceBeforeCloseBrace>
<ObjectInitializerSpaceAfterOpenBrace>true</ObjectInitializerSpaceAfterOpenBrace>
      <ObjectInitializerSpaceBeforeCloseBrace>true</ObjectInitializerSpaceBeforeCloseBrace>

I look forward to hearing from you.

All the best,
Zdravko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Andrei
Top achievements
Rank 1
answered on 26 Jul 2012, 06:50 PM
Hi Zdravko,
Yes, all options you've mentioned are set to True in my settings file. I've created support ticket #569979 where I could attach my settings file. Could you try with it, please?
0
Zdravko
Telerik team
answered on 27 Jul 2012, 12:57 PM
Hi Andrei,

Thanks for the assistance. 
You were right. I was misunderstanding the way of reproducing this issue. Sorry for that.
Anyway, the issue is fixed and probably will be included in some of the upcoming internal builds. 
Thanks for your help.

Kind regards,
Zdravko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Andrei
Top achievements
Rank 1
answered on 27 Jul 2012, 01:42 PM
great!
Tags
General Discussions
Asked by
Andrei
Top achievements
Rank 1
Answers by
Zdravko
Telerik team
Andrei
Top achievements
Rank 1
Share this question
or