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

Add setting to squash directories - #608

Merged
lee-dohm merged 3 commits into
atom:masterfrom
Tyriar:125_squash_single_dirs
Oct 28, 2015
Merged

lee-dohm merged 3 commits into
atom:masterfrom
Tyriar:125_squash_single_dirs

Conversation

@Tyriar

@Tyriar Tyriar commented Oct 17, 2015

Copy link
Copy Markdown
Contributor

A new setting tree-view.squashDirectoryNames that squashes directories
together when a directory only contains a single directory. Take the following
directory structure:

  • foo
    • bar
      • file.txt

foo and bar would be merged in to a single DirectoryView:

  • foo/bar
    • file.txt

Notes:

  • Squashing occurs recursively so multiple directories can be merged together.
  • There is a loss of functionality when the squash is enabled since the
    directories on the left are no longer available to right click. The
    DirectoryView is treated as if it's the full directory.
  • The style .squashed-dir was added to allow styling of the left portion of the
    squashed directory ('foo/' in the above example).
  • This feature is disabled by default.

Fixes #125

A new setting tree-view.squashDirectoryNames that squashes directories
together when a directory only contains a single directory. Take the following
directory structure:

- foo
  - bar
    - file.txt

foo and bar would be merged in to a single DirectoryView:

- foo/bar
  - file.txt

Notes:
- Squashing occurs recursively so multiple directories can be merged together.
- There is a loss of functionality when the squash is enabled since the
  directories on the left are no longer available to right click. The
  DirectoryView is treated as if it's the full directory.
- The style .squashed-dir was added to allow styling of the left portion of the
  squashed directory ('foo/' in the above example).
- This feature is disabled by default.

Fixes #125
@Tyriar

Tyriar commented Oct 17, 2015

Copy link
Copy Markdown
Contributor Author

With .squashed-dir { color: #777; } added to my stylesheet:

squash_dirs

@kevinsawicki

Copy link
Copy Markdown
Contributor

😍

@lee-dohm

Copy link
Copy Markdown
Contributor

So much awesomeness ⚡:godmode:🤘⚡

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could a test be added that would ensure that the platform-specific path separator is used? From what I've read, I can see that it currently does ... but I wouldn't want it to break in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this approach to test that but it doesn't seem to work, I think because it breaks other calls to path like path.join in directory.coffee.

describe "when path.sep is overridden", ->
  originalPathSep = path.sep

  beforeEach ->
    path.sep = '#'

  afterEach ->
    path.sep = originalPathSep

  it "should use the overridden path.sep in the UI", ->
    atom.project.setPaths([rootDirPath])
    expect($(treeView.roots[0].entries).find('.directory:contains(alpha#beta):first')).toExist()

Any ideas without exposing test a test-only function in directory.coffee?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, thinking more about this I feel like changing the other tests to use path.sep covers this. I'd prefer it to be more explicit as a form of documentation, but I also don't feel injecting a dependency just for the path separator here in this one spot is warranted.

lee-dohm added a commit that referenced this pull request Oct 28, 2015
@lee-dohm
lee-dohm merged commit a5ac023 into atom:master Oct 28, 2015
@lee-dohm

Copy link
Copy Markdown
Contributor

Thanks for this!

@Tyriar

Tyriar commented Oct 28, 2015

Copy link
Copy Markdown
Contributor Author

No problems, excited to see it land!

@thomasjo

Copy link
Copy Markdown
Contributor

Brilliant work! Thanks ❤️

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants