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

JustCode formatting can be too annoying as you type

9 Answers 95 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 05 Jul 2012, 08:52 PM

Guys,

I'm not sure if it's today's internal build or not but I have this weird behavior now. I have an option about putting single line statements on a new line switched off so I can type properties like this:

public int MyProperty
{
   get { return _myProperty; }
   set { _myProperty = value; }
}

In fact, if you don't switch it off JustCode will force the body of getters and setters to be moved on a new line. This _also_ isn't very nice as I would like to define this when I type the code, sometimes I want it to be on a new line, sometimes not. There is no true or false. But I'll get back to this later.

What I've noticed on the latest internal build (I can't compare to the old behavior, though) is when I type this:

public int MyProperty
{
   get
   { | }
}

as soon as I hit enter it would turn into this:

public int MyProperty
{
   get { }
}
     |

Please note the cursor position! It's left outside of the block.

I have a feeling it wasn't like this on previous builds but anyway, you don't know what I'm going to type now. It may be a single line statement, it may well be a bunch of statements. You just don't have enough information to judge at that point so why do you force this single line rule?

In my opinion this formatting stuff should be adaptive, that is there is no black and white, true or false. There should be a reasonble breathing room. I'm fine with default VS formatting, it's not obtrusive and I would like JustCode to remain unobtrusive as well. You could also provide an option to disable JustCode formatting. Importing VS settings is not enough as JustCode seems to do a lot of extra formatting anyway.

To give you another example, say you want to type a lambda as a paramter to a method:

Calculate(
   obj =>
   {|})
 
// suppose my method parameter looks somthing like this:
private void Calculate(Action<MyBusObject> callback)
{
    // do something here
    callback(new MyBusObject());
}

As I know I'm going to put some several statements in my callback I move stuff to new line as I type (| indicates current cursor position) and when I hit enter I'm faced with this:

Calculate(
   obj =>
   {
   }|)

I almost got used to it by now and it helps with that 'smart semicolon' feature because when the cursor is at that position pressing ; does the right thing.
However, my 'gut' expectation would be:

Calculate(
obj =>
 {
   |
 })

So I can comfortably continue typing... But again, we lose the 'smart semicolon' here... It's never black and white ;)

However that issue with property declaration does need an attention. It just too roughly inforces formatting rules on me while I'm typing and I have more information about what it's going to be than the tool does. It just shouldn't get in the way. Just like VS never does...

My JustCode settings are close to defaults regarding code style, I wanted to attach my settings file but it looks like only images are allowed as attachments. I can send it to you, no problem.

9 Answers, 1 is accepted

Sort by
0
Andrei
Top achievements
Rank 1
answered on 06 Jul 2012, 07:40 AM
Just had a chance to try it on the previous internal build (622.1) at work - that's right, the offending behavior when typing a property has been introduced in the latest internal build (705.1).
0
Borislav
Telerik team
answered on 09 Jul 2012, 01:25 PM
Hello Andrei,

Thank you for your feedback.

About the first problem you described (property declaration):
In the latest internal build we introduced a new setting whether to format an empty blocks or blocks with only one statement inside, on a single line. Probably this new setting in combination with some other setting is causing the problem. I was not able to completely reproduce the problem. However I found a bug in our code, which we already fixed. Probably this fix will also fix the problem you reported. Can you please open a support ticket and attach you JustCode settings there, so we can test and try to reproduce the problem. You can find JustCode settings here:
%appdata%\JustCode\settings-justcode.xml

The second problem is caused by our Typing Assistance feature. I will log it for fixing and we will do our best to fix it as soon as possible.

I also granted your account with some Telerik points for you contribution of making JustCode better.

Please do not hesitate to contact us again if you have any questions of issues with JustCode.

All the best,
Borislav
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Andrei
Top achievements
Rank 1
answered on 09 Jul 2012, 03:02 PM
Hi Borislav,

thanks for the response! I've created support ticker # 563245 with my settings file attached.

Looking forward to hearing from you soon!
0
Borislav
Telerik team
answered on 10 Jul 2012, 11:32 AM
Hi Andrei,

Thanks to your settings file, I was able to reproduce and fix the problem. The fix will be available in our next release.

Do not hesitate to contact us again if you have any questions about JustCode.

Regards,
Borislav
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Andrei
Top achievements
Rank 1
answered on 10 Jul 2012, 01:11 PM
Hi Borislav,

thanks a lot! looking forward to it.
0
Andrei
Top achievements
Rank 1
answered on 20 Jul 2012, 09:31 AM
resolved in q2 sp1, great job, thanks!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 20 Jul 2012, 03:02 PM
I'm wondering if this is similar to an issue I'm having?

Here's my template
private string _$2$ = $3$;
public string $1$
{
    get{ return _$2$; }
    set{ _$2$ = value;}
}

I have the "Place one-line accessor bodies on a seperate line" unchecked...but it comes out as this

private string _link1Url = String.Empty;
        public string Link1Url
        {
            get
            {
                return _link1Url;
            }
            set
            {
                _link1Url = value;
            }
        }

0
Andrei
Top achievements
Rank 1
answered on 23 Jul 2012, 11:55 AM
Hi Steve,

I also have this option unchecked and it collapses single line getters/setters when you run a formatter (Ctrl+Alt+F) on selected piece of code.
And now it's great that it doesn't interfere while I'm typing as I may type several statements and it's too early for the formatter to know.

In your case it's a template insertion scenario and in that particular case it would make sense to put them on single lines.
0
Borislav
Telerik team
answered on 25 Jul 2012, 07:53 AM
Hi Steve,

Have you tried with our latest SP1 build? The problem is fixed there. I couldn't reproduce it.

Code inserted after template expansion should also be formatted according the Code Style settings.

Kind regards,
Borislav
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
General Discussions
Asked by
Andrei
Top achievements
Rank 1
Answers by
Andrei
Top achievements
Rank 1
Borislav
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or