Announce: project-view


#1

Happy to announce my first package for Atom called project-view. The goal of this package is to enrich the tree-view by some useful project metadata.

It’s still a very small package and just shows so far the project name in the Atom tree-view root folder with the folder path next to it. Without this package you’d normally see atom-project-view as root name but when installed this name gets replaced by the actual project project-view. The project name gets so far retrieved by the package.json or .bower.json.

As it’s my first package for Atom I’d be awesome if somebody could review my code and give me some advices. Also my CoffeeScript knowledge has yet to be improved :blush:


#2

Looks good to me, just one tiny thing: when you activate the tree view, you expect it to have the .treeView property, but this is not necessarily true. If you take a look at the source code you’ll see that the property only exists after running createView(). You could replace

@treeView = treeViewPkg.mainModule.treeView

with

@treeView = treeViewPkg.mainModule.createView()

to be sure @treeView isn’t undefined.


#3

Aweseome, thanks a lot for the review and feedback :slight_smile:

Right I see what you mean. In case there is no active pane i.e. no file or folder is opened then the tree view won’t be created and @treeView will be null. Just feels a bit strange that I’ve to call @createView manually from outside. But thanks for pointing this out, I’ll add that fix.


#4

Fixed in project-view @ v0.1.1 :bug:


#5

Happy to help :slight_smile: If you have any other questions, don’t hesitate to ask


#6

@olmokramer Actually there is something I wanted to ask regarding fetching the home folder path but this might be OT here… in the Atom contribution docs following is written:

  • Avoid platform-dependent code:
    Use require(‘atom’).fs.getHomeDirectory() to get the home directory.

But atom.fs is undefined somehow… :frowning: Any other way to get the home directory in an “Atom conform” way?

Edit: Oh never mind, I’ve just found that function in the fs-plus package. So actually the docs should say

require(‘fs-plus’).getHomeDirectory()