Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Collapse Java-style empty hierarchies #125

Closed

Description

@lee-dohm

I occasionally have to work on Java projects for work. Java essentially requires project hierarchies like the following:

\project
    \src
        \com
            \example
                \project
                    \app
                        source1.java
                        source2.java
                        source3.java
                    \library-foo
                        source1.java
                        source2.java
                        source3.java

Java IDEs have a feature in their tree-view controls to collapse directories that only have one entry in them underneath src. So the above would look like this:

\project
    \src
        \com.example.project
            \app
                source1.java
                source2.java
                source3.java
            \library-foo
                source1.java
                source2.java
                source3.java

I'd like to see Atom tree-view support this feature as well on an opt-in basis.

Activity

  1. Grimeh commented on May 1, 2014

    @Grimeh

    Would love this feature, +1

  2. changed the title [-]Concatenate Java-style empty hierarchies[/-] [+]Collapse Java-style empty hierarchies[/+] on Feb 18, 2015
  3. lee-dohm commented on Feb 18, 2015

    @lee-dohm
    ContributorAuthor

    @lloeki points out that the GitHub website now offers this feature. I'm not picky on the visual representation, just think it would be great if the option was available.

  4. lloeki commented on Feb 18, 2015

    @lloeki

    Just tossing an idea in the air, as the feature here might be slightly different. There is a case to be made for simple grouping and one for logical grouping. Here:

    \src
        \com
            \example
                \project1
                \project2
    

    Simple grouping would result in

    \src
        \com.example
            \project1
            \project2
    

    whereas logical grouping would result in:

    \src
        \com.example.project1
        \com.example.project2
    

    This example takes Java and the above notation as an example, but I'm not too fond of the dot as a separator. Here's why.

    Go also has a similar structure in its workspace (output of tree(1), note the dots in the dir names):

    src
    ├── code.google.com
    │   └── p
    │       └── go.tools
    ├── github.com
    │   ├── codegangsta
    │   │   └── negroni
    │   ├── gorilla
    │   │   ├── context
    │   │   └── mux
    │   ├── nsf
    │   │   └── gocode
    │   └── yosssi
    │       └── ace
    └── gopkg.in
        └── yaml.v2
    

    Here simple grouping would output:

    src
    ├── code.google.com
    │   └── p / go.tools
    ├── github.com
    │   ├── codegangsta / negroni
    │   ├── gorilla
    │   │   ├── context
    │   │   └── mux
    │   ├── nsf / gocode
    │   └── yosssi / ace
    └── gopkg.in / yaml.v2
    

    An arguably more balanced logical grouping would give:

    src
    ├── code.google.com / p / go.tools
    ├── github.com / codegangsta / negroni
    ├── github.com / gorilla / context
    ├── github.com / gorilla / mux
    ├── github.com / nsf / gocode
    ├── github.com / yosssi / ace
    └── gopkg.in / yaml.v2
    

    Maybe a threshold (default: 1) of number of children could give us something interesting (in the latter case it'd be at least 5 for github.com not to collapse). The alternative would be to have Atom recognise typical project layouts and do true logical mapping, and in that case it'd indeed map directories to Java package names, as hinted by the slash-to-dot conversion.

    Regarding the separator, the argument for keeping slash is more obvious here (I actually used Unicode's DIVISION BAR in my original issue). Also, whitespace between slashes and names may hint at and allow for each name to be independently selectable regardless of collapsing, allowing for right-click action (possibly wanting to create a subdir or a new file halfway through the collapsed hierarchy).

  5. billbonney commented on Mar 17, 2015

    @billbonney

    👍 For this feature. I started working on android and java projects and this woudl be a great feature. I'd suggest

    \src
        \com
            \example
                \project1
                \project2
    

    would become

    \src\com\example
                     \project1
                     \project2
    

    you could colorize the \com\example to highlight it's collapsed. Using . ie 'period' would confuse directories names /com.mycompany.stuff/ which i also have to deal with from time to time.

  6. qayshp commented on Mar 18, 2015

    @qayshp

    👍

  7. geoffnin commented on Apr 16, 2015

    @geoffnin

    👍

  8. DDoS commented on Apr 19, 2015

    @DDoS

    👍

  9. zet4 commented on May 4, 2015

    @zet4

    👍

  10. FossPrime commented on Jun 24, 2015

    @FossPrime

    👍 Reference to the Gedit feature request... I almost need this feature more then Linux retina support.

    https://bugzilla.gnome.org/show_bug.cgi?id=750707

  11. sandokandias commented on Aug 1, 2015

    @sandokandias

  12. jonasws commented on Aug 7, 2015

    @jonasws

    👍 Would be cool to have. Maybe it would be easier if this package exported a service that other packages could make use of to add such a feature? Seems to me that it would be in spirit with the whole "seperation of concerns into packages" paradigm that the community seems to embrace 😄

  13. FossPrime commented on Aug 7, 2015

    @FossPrime

    never have I once thought to myself "Oh, I wish the trees were bigger and more expanded, so that I may scroll more" It's a bit of an essential feature for many projects and too many addons I depend on are half baked and frequently push buggy updates.

    Because we lack this feature, I'm forced to use the "Autohide Tree View" which has broken 3 times in the past month and has to annoying bugs relating to selection, accidental file deletion and renaming. But it's better than nothing.

    In other words, it makes more sense to make Java style empty hierarchies default.

  14. cebor commented on Aug 14, 2015

    @cebor

    👍

  15. flyisland commented on Aug 25, 2015

    @flyisland

    +1

  16. arkadiyt commented on Aug 28, 2015

    @arkadiyt

    👍

  17. chrissphinx commented on Sep 12, 2015

    @chrissphinx

    👍

  18. dabbeg commented on Sep 18, 2015

    @dabbeg

    +1

  19. flako-dd commented on Sep 25, 2015

    @flako-dd

    One of the issues that keeps me from using Atom on bigger Java projects and use a much heavier IDE instead, so +1

  20. leesei commented on Oct 28, 2015

    @leesei

    👍

  21. tgvdinesh commented on Mar 4, 2017

    @tgvdinesh

    For those who are still searching on how to collapse directory,

    1. Open Package settings of tree-view
    2. Go to Settings and enable Collapse directories

    This is not enabled by default, which it should have been.

  22. lee-dohm commented on Mar 6, 2017

    @lee-dohm
    ContributorAuthor

    This is not enabled by default, which it should have been.

    @Dinesh-V Thanks for the feedback. There are still edge-case bugs caused by the feature as implemented (such as #670 and #1015, among others). Perhaps you would like to help make the feature bullet proof so that turning the feature on by default is an option? At this stage, we may still opt to leave it off by default but we certainly aren't going to enable it by default as the feature is currently implemented.

  23. trubelik commented on Mar 3, 2018

    @trubelik

    Still have a problem with .DS_Store files 😔 Why the "ignored files" option is ignored by the Collapse directories?

  24. winstliu commented on Mar 5, 2018

    @winstliu
    Contributor

    @MartinTrubelik please open a new issue and we'll take a look 🙇.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions