Code formatter: whitespaces missing in type initializers

5 posts, 0 answers
  1. Andrei
    Andrei avatar
    30 posts
    Member since:
    May 2012

    Posted 24 Jul 2012 Link to this post

    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 ;)
  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 26 Jul 2012 Link to this post

    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.

  3. DevCraft banner
  4. Andrei
    Andrei avatar
    30 posts
    Member since:
    May 2012

    Posted 26 Jul 2012 Link to this post

    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?
  5. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 27 Jul 2012 Link to this post

    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.

  6. Andrei
    Andrei avatar
    30 posts
    Member since:
    May 2012

    Posted 27 Jul 2012 Link to this post

    great!
Back to Top
DevCraft banner