Looking for best practices for iterative development on Atom


Hi all, I’m excited to poke around and contribute to Atom, but I’m having trouble getting a good development flow going, so it would be helpful to learn best practices from those who know The Way. Here are some examples of problems that I have encountered.

Hacking on text-buffer
I want to try messing around with text-buffer. I tried running apm develop text-buffer, but that yields the following error: Request for package information failed: Not Found. I suspect this has to do with text-buffer being part of "dependencies" in package.json rather than "packageDependencies". Since apm develop is not an option, what is the best way to test changes to text-buffer? Do I need to clone the repo, edit the .coffee files, generate the .js, and then overwrite the node_modules/text-buffer directory under Atom every time I make a change? It seems doable, but tedious.

Hacking on tree-view
Having found the docs on contributing to official Atom packages, I decided I would at least try editing code for which there appears to be a development flow. I ran apm develop tree-view and edited ~/github/tree-view/lib/tree-view.coffee, adding an alert('Hello!') after the super call in TreeView.initialize(). Then I ran atom --dev as per the instructions, and huzzah, my alert box appeared! However, I then hit cmd-\ to toggle the tree view to try to get my alert to appear again, but it did not (presumably because my TreeView is cached, which makes sense). To see a change, I needed to close my window (via cmd-shift-w), modify my source, and start Atom again via atom --dev. Is this the most efficient way? Because Atom is built on web technologies, I was hoping for a more seamless edit-refresh cycle: is there one?

Finding things
Because so much of the code is written CoffeeScript, and because npm pulls down only the transpiled JavaScript, git grep has been rendered mostly useless. Is there a good way to get a more complete view of Atom’s source, particularly for searching?


There is a topic that discusses the trials and tribulations of hacking on built-in packages here:

I believe that @ProbablyCorey’s advice near the end of the topic will work for the text-buffer package as well:

I feel though that the entire topic is a good read.

In some cases you can just trigger a window reload with the Window: Reload command from the Command Palette rather than restarting Atom. In other cases that won’t work. It just depends on what you’re trying to change.

I’ve actually gotten really good with the GitHub website’s keyboard commands as part of my work with Atom. Need to look up the actual source of EditorView.getEditor? Here’s my flow:

  1. Swap to the browser (Cmd+Tab)
  2. Go to the address bar (Cmd+L)
  3. Type in the address of the project: https://github.com/atom/atom (because of Chrome’s autocomplete, I rarely have to type anything like the full path)
  4. Press T to fuzzy find a file
  5. Type edview to bring up EditorView in the list and press ENTER
  6. Search for getEditor (Cmd+F and then getEditor)

There are probably other ways to do it, but this is what I’ve gotten used to.