Sorting fields

Hi,

I just started using R# and was wondering if there is functionality that allows me sort fields alphabetically?

Thanks

7 comments
Comment actions Permalink

Hello Daikoku,

Version 3.0 is planned to have automatic member reordering facility. Previous
versions do not have such feature.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


D> Hi,
D>
D> I just started using R# and was wondering if there is functionality
D> that allows me sort fields alphabetically?
D>
D> Thanks
D>


0
Comment actions Permalink

Hi Ilya,

thanks for your reply. This functionality is not yet in your 3.0 preview bits, is it?
Also, are you going to introduce functionality, to automatically format the order of where private, properties, events, etc. are in the code file? For example, I'd like to have my private fields first, then properties, event declarations after that..

Thanks,

Daikoku

0
Comment actions Permalink

Hello Daikoku,

Automatic member ordering during code format is one of our goals for 3.0.
Currently we are experimenting with various techniques, so ReSharper can
support various styles, including regions. It is public in EAP, so you can
try it yourself. However, there is no GUI right now - plain XML and no docs
:) Sorry about that... And we will most likely change pattern specification
in future bits.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


D> Hi Ilya,
D>
D> thanks for your reply. This functionality is not yet in your 3.0
D> preview bits, is it?
D>
D> Also, are you going to introduce functionality, to automatically
D> format the order of where private, properties, events, etc. are in
D> the code file? For example, I'd like to have my private fields first,
D> then properties, event declarations after that..
D>
D> Thanks,
D>
D> Daikoku
D>


0
Comment actions Permalink

One aspect of this that I hope you consider:

When generating new code (via Generate Constructor, Generate Property,
Extract Method, etc) I'd really like the result to go into the proper place.

One of the things I do is I have defined regions for various code, so I can
easily, say, fold all properties out of the way. It'd be nice to be able to
configure something so that all new properties go into a named region (being
able to configure the named region on a per-solution basis... though mine
are named consistently across solutions).

Just something further to consider.

"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:9f6b3e29137e658c952881893b697@news.intellij.net...

Hello Daikoku,

>

Automatic member ordering during code format is one of our goals for 3.0.
Currently we are experimenting with various techniques, so ReSharper can
support various styles, including regions. It is public in EAP, so you can
try it yourself. However, there is no GUI right now - plain XML and no
docs :) Sorry about that... And we will most likely change pattern
specification in future bits.

>

Sincerely,
Ilya Ryzhenkov

>

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>

D> Hi Ilya,
D> D> thanks for your reply. This functionality is not yet in your 3.0
D> preview bits, is it?
D> D> Also, are you going to introduce functionality, to automatically
D> format the order of where private, properties, events, etc. are in
D> the code file? For example, I'd like to have my private fields first,
D> then properties, event declarations after that..
D> D> Thanks,
D> D> Daikoku
D>


0
Comment actions Permalink

Hello Paul,

We've been discussing these issues yesterday. Generate actions do not have
any problems with sorted file, they have problems with unsorted file.
How do you think it should work when file is not sorted?

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


PB> One aspect of this that I hope you consider:
PB>
PB> When generating new code (via Generate Constructor, Generate
PB> Property, Extract Method, etc) I'd really like the result to go into
PB> the proper place.
PB>
PB> One of the things I do is I have defined regions for various code,
PB> so I can easily, say, fold all properties out of the way. It'd be
PB> nice to be able to configure something so that all new properties go
PB> into a named region (being able to configure the named region on a
PB> per-solution basis... though mine are named consistently across
PB> solutions).
PB>
PB> Just something further to consider.
PB>
PB> "Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
PB> news:9f6b3e29137e658c952881893b697@news.intellij.net...
PB>
>> Hello Daikoku,
>>
>> Automatic member ordering during code format is one of our goals for
>> 3.0. Currently we are experimenting with various techniques, so
>> ReSharper can support various styles, including regions. It is public
>> in EAP, so you can try it yourself. However, there is no GUI right
>> now - plain XML and no docs :) Sorry about that... And we will most
>> likely change pattern specification in future bits.
>>
>> Sincerely,
>> Ilya Ryzhenkov
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>> D> Hi Ilya,
>> D> D> thanks for your reply. This functionality is not yet in your
>> 3.0
>> D> preview bits, is it?
>> D> D> Also, are you going to introduce functionality, to
>> automatically
>> D> format the order of where private, properties, events, etc. are in
>> D> the code file? For example, I'd like to have my private fields
>> first,
>> D> then properties, event declarations after that..
>> D> D> Thanks,
>> D> D> Daikoku
>> D>


0
Comment actions Permalink

Obviously there has to be some configuration or setup here.... based on user
preferences.

But essentially, the code should go at the cursor if there's no "obvious"
place for it to go. If the cursor isn't at the beginning of a line or on a
blank line, then it should place the code at the next appropriate place
(i.e.. if the cursor is in a property, then the new generated property would
go after the current one). Also, by "obvious", I mean, if I've configured
all properties to go into a named region, then it should go in that region.
Even if the file is sorted, it should probably just go at the cursor, and
another key press could 'resort' the file to move the method to the correct
location. Or maybe that same keypress (or a different one) could sort
things into the specified named regions.
Just some ideas that would be okay with me.

"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:9f6b3e291380ba8c95482aee77563@news.intellij.net...

Hello Paul,

>

We've been discussing these issues yesterday. Generate actions do not have
any problems with sorted file, they have problems with unsorted file. How
do you think it should work when file is not sorted?

>

Sincerely,
Ilya Ryzhenkov

>

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>

PB> One aspect of this that I hope you consider:
PB> PB> When generating new code (via Generate Constructor, Generate
PB> Property, Extract Method, etc) I'd really like the result to go into
PB> the proper place.
PB> PB> One of the things I do is I have defined regions for various code,
PB> so I can easily, say, fold all properties out of the way. It'd be
PB> nice to be able to configure something so that all new properties go
PB> into a named region (being able to configure the named region on a
PB> per-solution basis... though mine are named consistently across
PB> solutions).
PB> PB> Just something further to consider.
PB> PB> "Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
PB> news:9f6b3e29137e658c952881893b697@news.intellij.net...
PB>

>>> Hello Daikoku,
>>>
>>> Automatic member ordering during code format is one of our goals for
>>> 3.0. Currently we are experimenting with various techniques, so
>>> ReSharper can support various styles, including regions. It is public
>>> in EAP, so you can try it yourself. However, there is no GUI right
>>> now - plain XML and no docs :) Sorry about that... And we will most
>>> likely change pattern specification in future bits.
>>>
>>> Sincerely,
>>> Ilya Ryzhenkov
>>> JetBrains, Inc
>>> http://www.jetbrains.com
>>> "Develop with pleasure!"
>>> D> Hi Ilya,
>>> D> D> thanks for your reply. This functionality is not yet in your
>>> 3.0
>>> D> preview bits, is it?
>>> D> D> Also, are you going to introduce functionality, to
>>> automatically
>>> D> format the order of where private, properties, events, etc. are in
>>> D> the code file? For example, I'd like to have my private fields
>>> first,
>>> D> then properties, event declarations after that..
>>> D> D> Thanks,
>>> D> D> Daikoku
>>> D>
>


0
Comment actions Permalink

Hello Paul,

First, if someone uses Alt-Ins, we generate members at the place of invocation.
We are reading user's mind as "I want to generate properties here". In case
of sorted file it is doubtful, but we don't want to break any habit and don't
want to introduce unexpected or unintuitive behaviour. It's not much of the
effort to hit "Format file" to place all things where they should be, after
all.

Second, there are many cases when we generate members "there" instead of
"here", e.g. "Implement Member" context action on newely created interface
member, or "Use body for implementations" for abstract method with body.
In this case reformatting of all affected files is not good thing, there
could be many of them. We not only have to decide where to place generated
members without any questions, but also which class part to put them in.
If file is not yet sorted, it is getting more complex.

These are just random thoughts, in reality it is even more complex :)

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


PB> Obviously there has to be some configuration or setup here.... based
PB> on user preferences.
PB>
PB> But essentially, the code should go at the cursor if there's no
PB> "obvious"
PB> place for it to go. If the cursor isn't at the beginning of a line
PB> or on a
PB> blank line, then it should place the code at the next appropriate
PB> place
PB> (i.e.. if the cursor is in a property, then the new generated
PB> property would
PB> go after the current one). Also, by "obvious", I mean, if I've
PB> configured
PB> all properties to go into a named region, then it should go in that
PB> region.
PB> Even if the file is sorted, it should probably just go at the
PB> cursor, and
PB> another key press could 'resort' the file to move the method to the
PB> correct
PB> location. Or maybe that same keypress (or a different one) could
PB> sort
PB> things into the specified named regions.
PB> Just some ideas that would be okay with me.
PB> "Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
PB> news:9f6b3e291380ba8c95482aee77563@news.intellij.net...
PB>
>> Hello Paul,
>>
>> We've been discussing these issues yesterday. Generate actions do not
>> have any problems with sorted file, they have problems with unsorted
>> file. How do you think it should work when file is not sorted?
>>
>> Sincerely,
>> Ilya Ryzhenkov
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>> PB> One aspect of this that I hope you consider:
>> PB> PB> When generating new code (via Generate Constructor, Generate
>> PB> Property, Extract Method, etc) I'd really like the result to go
>> into
>> PB> the proper place.
>> PB> PB> One of the things I do is I have defined regions for various
>> code,
>> PB> so I can easily, say, fold all properties out of the way. It'd
>> be
>> PB> nice to be able to configure something so that all new properties
>> go
>> PB> into a named region (being able to configure the named region on
>> a
>> PB> per-solution basis... though mine are named consistently across
>> PB> solutions).
>> PB> PB> Just something further to consider.
>> PB> PB> "Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
>> PB> news:9f6b3e29137e658c952881893b697@news.intellij.net...
>> PB>
>>>> Hello Daikoku,
>>>>
>>>> Automatic member ordering during code format is one of our goals
>>>> for 3.0. Currently we are experimenting with various techniques, so
>>>> ReSharper can support various styles, including regions. It is
>>>> public in EAP, so you can try it yourself. However, there is no GUI
>>>> right now - plain XML and no docs :) Sorry about that... And we
>>>> will most likely change pattern specification in future bits.
>>>>
>>>> Sincerely,
>>>> Ilya Ryzhenkov
>>>> JetBrains, Inc
>>>> http://www.jetbrains.com
>>>> "Develop with pleasure!"
>>>> D> Hi Ilya,
>>>> D> D> thanks for your reply. This functionality is not yet in your
>>>> 3.0
>>>> D> preview bits, is it?
>>>> D> D> Also, are you going to introduce functionality, to
>>>> automatically
>>>> D> format the order of where private, properties, events, etc. are
>>>> in
>>>> D> the code file? For example, I'd like to have my private fields
>>>> first,
>>>> D> then properties, event declarations after that..
>>>> D> D> Thanks,
>>>> D> D> Daikoku
>>>> D>


0

Please sign in to leave a comment.