Auto code issues

2 posts, 0 answers
  1. J-P Minderhoud
    J-P Minderhoud avatar
    13 posts
    Member since:
    Sep 2007

    Posted 04 Nov 2010 Link to this post

    Having recently upgraded to latest internal build (2010.3.1029.3) JustCode now automatically adds code blocks when you type a keyword like IF, P, S. Although I find this sometimes useful I also have a issues with it.

    1. JustCode being a little to enthusiastic in adding code blocks.

    When trying to add a C# compiler #IF directive JustCode thinks I want to add a IF block when I certainly don't.
    After typing '#if' but before hitting space, with cursor right after #if. (VS nicely adds the #endif for me):
    #if
    #endif
    After hitting space:
    #if (V1)
    {
      
    }
    #endif

    When trying to write a Lambda expression or a Linq statement JustCode adds code blocks where it shouldn't.
    Both cases before hitting space, with cursor right after the 's' in first and 'p' (before ')') in second
    var q = from s

    var q = list.Select(p)
    After hitting space:
    var q = from struct V1
    {
    }
     
     
    var q = list.Select(public V1 V2
    {
        get
        {
            return V3;
        }
        set
        {
            V3 = value;
        }
    })
    And I was trying to write something like:
    var q = from s in list
        where s.ToString() == "Bla"
        select s;
     
    var q = list.Select(p => p.ToString() == "Bla");

    While typing this and creating examples in VS I came to the conclusion that no matter what the key phrase is and where it is in the code, except for in comments, after hitting space JustCode adds the corresponding code block. I can't even write:
    string s = "";
    After typing 'string s' and hitting space JustCode adds the struct block.

    I think the simplest solution would be for JustCode to check whether or not there is any other text on the same line,.

    2. While wrestling with JustCode being a little eager it found one more 'issue'. After JustCode adds the code block corresponding with a key phrase it's not possible to cancel/undo this. My first instinct was to hit Esc but that is 'Accept as it is' and as far as I found does exactly the same as hitting Enter. And Ctrl-Z (undo) didn't work either.
    Is there a way to completely Undo the adding of a code block by JustCode with 1 keystroke?

    3. Inprovement:
    When I do want a IF code block and I hit Enter to finish I expected JustCode to place the cursor between the brackets which is 99% of the time where you want to be when adding a IF statement. Instead it stayed where it was, in my case just before the closing ')'. This is also the case for 'c' (class).

    Besides these minor issues and annoyances I just love JustCode.

    J-P

  2. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    409 posts

    Posted 04 Nov 2010 Link to this post

    Hello J-P Minderhoud,

    Sorry about the inconvenience.  What happens is you get JustCode templates (similar to Visual Studio code snippets) expanded when typing an acronym and pressing space after it.

    It seems you have installed a succession of our internal builds. While we are doing our best to have these stable and coherent it does not always work out that way. We had the Acronym Expansion Hotkey set to default value of Space in one of these builds. We realized it might be a problem for a variety of reasons and we set it to Shift+Space in the next ones so that the user can control more precisely when our code  templates get expanded. However, since these are internal builds there was no proper merge between the settings files implemented. Hence, the users that installed that first internal build remained with the default setting of Space which causes all that trouble.

    What you could do to avoid the annoyances is manually set your CodeTemplates -> General -> Acronym Expansion Hotkey setting to Shift + Space. That would prevent templates exapnsion while typing as usual and you could resume your normal workflow while still having the chance to use the templates whenever you find appropriate.

    Once again I beg your pardon about it. 

    Regards,
    Tsviatko Yovtchev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top