Do you use Atom while hacking on the core editor?


#1

I am really a newbie, so any help would be appreciated. :smile: My environment is Mac OS.

  1. First of all, I downloaded atom in https://atom.io/, extracted it, and moved the application to my desktop. Then, I forked the atom repository, git cloned it, and ran script/build. This created an atom application as /Applications/Atom.app. I opened the atom application I moved to desktop and opened the cloned local atom repository in the editor. Then, I opened other atom application created in /Applications. I thought they would run as different instances independent of each other because they are two different application files, but they actually ran as one instance. They were just treated as different windows. How do you use Atom while hacking on the core editor?

  2. It seems that every time I make changes to the core editor source code, I need to run script/build, but it is taking too long because the command reinstalls everything. Is there any way to make this faster or just build the core editor only?

  3. After building atom, is there any difference between running atom.sh in my cloned git repository and running /Applications/Atom.app? Both starts up atom, but I am just curious…

Again, any help would be appreciated! :smiley:


Atom core development workflow?
Incremental build?
Running a hacked editor to experiment with mixed tab/space indent?
#2
  1. At home, I only use built Atom. At work, I only use released Atom. In both cases, it is installed in my /Applications directory. Yes, I use built Atom to work on the core editor … along with everything else I code on at home.
  2. Obligatory “back in my day we walked to school in the snow uphill both ways” comment — I just timed a script/build with no modifications. It took less than a minute and a half. I don’t really think that’s terribly long. Are you doing a script/clean every time? Or something else that makes it have to rebuild everything?
  3. I don’t believe so … but I just use Atom as I would normally either clicking on the icon or going to a directory and typing atom on the command line.

#3

I believe you can use your working copy without having to build by running atom -r /path/to/atom.


#4

@postcasio @leedohm Would you please elaborate on your answer? What is ‘working copy’? What does ‘-r’ do? Also, where does /path/to/atom point to? Is it /Applications/Atom.app or the path to the cloned atom repository?

Any comment or help would be appreciated!


#5

-r sets the resources path, which is normally Atom.app/Contents/Resources/app. Your working copy is your local copy of the atom repository. So if you cloned to /Users/yjw9012/github/atom you would run:

atom -r /Users/yjw9012/github/atom

Then instead of loading the code bundled in Atom.app, it will load the code you’re working on.

Also, looking at the source, dev mode will load from ~/github/atom it exists. So if you have your copy stored there, you can just run atom -d.


Using tagged (stable) Atom alongside compiled Atom
Develop core module without rebuild
Core editor symlink to dev
#6

@postcasio Thanks! Where is all this stuff explained? :smile:


#7

Would be indeed helpful to have this in the documentation :blush:


#8

This doesn’t work for me (where the current directory is the clone of the Atom source). What am I doing wrong?

$ atom -f -d -r .
[45801:0622/215741:WARNING:resource_bundle.cc(305)] locale_file_path.empty() for locale English
2016-06-22 21:57:41.955 Atom[45801:119409] Cannot find module 'src/browser/atom-application'
2016-06-22 21:57:41.960 Atom[45801:119409] Error: Cannot find module 'src/browser/atom-application'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at EventEmitter.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/browser/main.js:60:25)
    at emitOne (events.js:82:20)
    at EventEmitter.emit (events.js:169:7)

#9

@yjw9012, @davidspiess All the command line args have explanations in atom --help :slight_smile:.


#10

The src/browser path was recently changed to src/main-process. So if you attempt to run a version of Atom that was from before the path change but the cloned repository is post-change, you’ll get this error. The solution is to build or install a version after the path change and try again.


#11

Thanks for that.

I checked out my git clone to the tag of the binary I’m running eg: v1.8.0. Also the source appears to be there (working dir is git clone)

$ ls src/browser/atom-application.coffee
src/browser/atom-application.coffee

Thinking about the stack trace, given I want to use my local copy of the Atom source, why is it using the main file out of the Atom bundle? What if I changed that file?

at EventEmitter.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/browser/main.js:60:25)


#12

Because it has to get as far as parsing the parameters to realize that you’ve passed --dev before it can decide to act on that :grinning:

You may have to recompile. The behavior where it loads from the ATOM_DEV_RESOURCE_PATH is a convenience, not a magic wand that means you’ll never have to recompile or restart the app :wink:


#13

The real problem was the . For the current working dir I replaced it with $(pwd) and it started fine.

However I can’t see the source for the core atom code (eg: atom-environment.coffee). In the Dev Tools, the tab for the file opens, but there’s no code.


#14

My issue was related to https://github.com/atom/atom/pull/12713 I’m a bit behind upgrading my Atom install as code I’ve been hacking around with breaks on later releases.