automatically sorting members by visibility/naming in source-code

hi,

inside intellij i do miss the feature to automatically sort members by visibility and naming inside source-file. such a feature makes a respective coding convention practicable in the first place because putting the burdon on developers to do this by hand is too much.

i am a bit uncertain why intellij does not support this feature so before opening an issue i would like to know whether or why there is a killing argument why sorting members won't be supported in intellij? with eclipse i found sorting members always very helpful. in the beginning after introducing such code convention making diffs and merging is a bit hard but after a while code gets cleaner and easier to read.
to summarize i think this feature important to make code cleaner and to make code structure more consistent.

5 comments
Comment actions Permalink

What is lacking in this regard? The icons at the top of the Structure view independently control sorting alphabetically by name (vs. showing the order of appearance in the file) and of grouping by visibility.

Hold your mouse pointer over each of those icons in turn to see the tool-tip that describes what class member display option they control.

Do you want something more / other than that?


Randall Schulz

0
Comment actions Permalink

I think he's talking about actually moving the methods in the source code, not how they're displayed in the structure view. IIRC there was a plugin to do that, but I'm not sure if it's currently maintained.

Cheers,
Colin

0
Comment actions Permalink

yes, i know that i can configure structure view but i want also to move this on source code level to hold consistent source code states in the version control system.

0
Comment actions Permalink

Hello manuel,

The Rearranger plugin (if I remember correctly) supports this type of sorting
members.

We do not believe that this type of sorting increases code readability. It
makes much more sense to group members together if they are logically related,
rather than to group them mechanically by accessibility.

inside intellij i do miss the feature to automatically sort members by
visibility and naming inside source-file. such a feature makes a
respective coding convention practicable in the first place because
putting the burdon on developers to do this by hand is too much.

i am a bit uncertain why intellij does not support this feature so
before opening an issue i would like to know whether or why there is a
killing argument why sorting members won't be supported in intellij?
with eclipse i found sorting members always very helpful. in the
beginning after introducing such code convention making diffs and
merging is a bit hard but after a while code gets cleaner and easier
to read.

to summarize i think this feature important to make code cleaner and
to make code structure more consistent.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

i also think that one should group methods (cohesion). never the less i try to do this on class level (method-groups belong to a class).

when looking at a class firstly i am often interested in public members only (outside visible behaviour). private methods dig deeper into detail and often are the second step for code comprehensability.

thus when looking at source-code outside intellij like in reports or direct subversion webdav access through browser, i would like to only look at the the top of the page and not to scroll back and forth to seek for the "important" methods.

i will give this Rearranger plugin (http://plugins.intellij.net/plugin/?id=173) a try. but i guess the very nice intellij feature of subversion commit-dialog won't be supported, where you can tick on certain code actions (like organizing imports or auto-formatting) before committing...

thanks for the plugin hint.

0

Please sign in to leave a comment.