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

🐛 🐎 Creating a file/directory un-squashes the tree-view - #1012

Merged
winstliu merged 5 commits into
atom:masterfrom
mcampagonzalez:fix/removing_entry_updates_squashed_tree_view
Jan 4, 2017
Merged

winstliu merged 5 commits into
atom:masterfrom
mcampagonzalez:fix/removing_entry_updates_squashed_tree_view

Conversation

@miguelcg

@miguelcg miguelcg commented Jan 2, 2017

Copy link
Copy Markdown
Contributor

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

This pull request solves a bug mentioned in #702. When creating a file/directory within a squashed directory it gets un-squashed (since the directory will contain more than one item in it).

Also improves performance of PR #1008 calling updateRoots() only if necessary (if the squash config key is set to true). I've decided to introduce this change in the same pull request since it's highly related with the bug-fix.

Alternate Designs

Benefits

Solves a bug

Possible Drawbacks

Applicable Issues

#702

Comment thread spec/tree-view-spec.coffee Outdated
jasmine.attachToDOM(workspaceElement)
piDir = $(treeView.roots[0].entries).find(".directory:contains(omicron#{path.sep}pi):first")[0]
expect(piDir).not.toBeNull()
omicronPath = piDir.getPath().replace "/pi", ""

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.

This part doesn't seem Windows-friendly. Can't you do the same logic for piDir and change it something like omicronPath = $(treeView.roots[0].entries).find(".directory:contains(omicron):first")[0].getPath()?

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.

Since the directories are squashed, the execution of $(treeView.roots[0].entries).find(".directory:contains(omicron):first")[0].getPath() returns <path>/omicron/pi.
Anyway I have to change /pi to #{path.sep}pi to make it Windows-friendly.
Commit is on the way! ;)

@miguelcg

miguelcg commented Jan 3, 2017

Copy link
Copy Markdown
Contributor Author

@50Wliu Is there any action pending from my side to get this merged?

expect(piDir.title).toEqual("pi")
rhoDir = $(treeView.roots[0].entries).find(".directory:contains(omicron) .entries .directory:contains(rho) span")[0]
expect(rhoDir.title).toEqual("rho")

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.

🔥 this newline

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.

It's not reflected in this comment but the line has been removed (I removed the next one, 2627, so it's not being shown here...)

jasmine.attachToDOM(workspaceElement)
piDir = $(treeView.roots[0].entries).find(".directory:contains(omicron#{path.sep}pi):first")[0]
expect(piDir).not.toBeNull()
omicronPath = piDir.getPath().replace "#{path.sep}pi", ""

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.

I would appreciate a comment here saying why the jQuery method can't be used, something like "omicron is a squashed dir, so searching for omicron would give us omicron/pi instead"

@miguelcg

miguelcg commented Jan 4, 2017 •

Copy link
Copy Markdown
Contributor Author

@50Wliu Comments addressed, thanks for reviewing 😃

@winstliu

winstliu commented Jan 4, 2017

Copy link
Copy Markdown
Contributor

Looks good, thanks!

@winstliu
winstliu merged commit 0f84437 into atom:master Jan 4, 2017
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.

3 participants