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

Tree-view API is not being called on startup #732

Closed
azawawi opened this issue Feb 12, 2016 · 9 comments · Fixed by #756
Closed

Tree-view API is not being called on startup #732

azawawi opened this issue Feb 12, 2016 · 9 comments · Fixed by #756
Labels

Comments

@azawawi
Copy link
Contributor

azawawi commented Feb 12, 2016

I am trying to use https://github.com/atom/tree-view#api in my https://github.com/azawawi/atom-perl6-editor-tools/blob/master/lib/file-icons.js#L12 to display custom file icons for Perl 6 file type. The problem is that iconClassForPath(path) is called only after a collapse/expand folder event and not on atom environment startup.

I have been trying to work around it via the following code but it is not working either.

atom.workspace.getLeftPanels()[0].emitter.emit("tree-view:collapse-directory")
atom.workspace.getLeftPanels()[0].emitter.emit("tree-view:expand-directory")

Your help is appreciated.

@lee-dohm
Copy link
Contributor

Right now I can't test this because you have a bug in your code. You don't require the Path module, so this throws an exception:

https://github.com/azawawi/atom-perl6-editor-tools/blob/master/lib/file-icons.js#L13

If you could fix that so I can investigate more, I'd appreciate it 😀

@azawawi
Copy link
Contributor Author

azawawi commented Feb 12, 2016

Thanks for pointing it out. It is now fixed. However, it did not throw any exception when loaded. On startup, it is not calling iconClassForPath(path). On collapse/expand, it works since it creates a new entry (i.e. https://github.com/atom/tree-view/blob/master/lib/file-view.coffee#L22).

Thanks for your time.

@lee-dohm lee-dohm removed the blocked label Feb 13, 2016
@azawawi
Copy link
Contributor Author

azawawi commented Feb 15, 2016

@lee-dohm, Any update on this one?

@ssorallen
Copy link
Contributor

It looks like a call to @treeView.updateRoots() after consuming the FileIcons service re-renders and gets the icons correct.

  consumeFileIcons: (service) ->
    FileIcons.setService(service)
    @fileIconsDisposable = service.onWillDeactivate -> FileIcons.resetService()
    @treeView?.updateRoots()

@azawawi
Copy link
Contributor Author

azawawi commented Mar 5, 2016

Thanks.

Fix in azawawi/atom-perl6-editor-tools@fa0339e as a workaround. Please fix in tree-view.

@ssorallen 👍

@lee-dohm
Copy link
Contributor

lee-dohm commented Mar 7, 2016

@azawawi @ssorallen since you both are familiar with the fix, would one of you mind submitting a PR? I'm swamped with a kajillion other things at the moment and I'm not sure when exactly I'll be able to get free to work on this.

@azawawi
Copy link
Contributor Author

azawawi commented Mar 7, 2016

@lee-dohm np, it is already there... #756

@lee-dohm
Copy link
Contributor

lee-dohm commented Mar 7, 2016

Thanks! Sorry I missed it 😆

lee-dohm added a commit that referenced this issue Apr 24, 2016
Fix #732: Tree-view API is not being called on startup
@azawawi
Copy link
Contributor Author

azawawi commented Apr 24, 2016

Thanks 👍

anderoonies pushed a commit to anderoonies/tree-view that referenced this issue Jun 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants