How to debug deactivation?


#1

I am seeing an error from my package flash when I reload atom as part of a dev cycle, so I want to debug it. I tried putting a breakpoint on the deactivate method but when I hit ctrl-alt-R to reload the breakpoint is highlighted like it was hit for just a fraction of a second and then atom locks up including the console.

Any ideas?


#2

Does it appear when you deactivate it from the console? I think this will do it:

atom.packages.deactivatePackage('foo')

#3

Thanks. Works great.


#4

I spoke too soon. It enabled me to find a bug and then all my debug statements looked clean. However there is still an error flashing when I use ctrl-alt-R. Should I worry about this?

Under what conditions does Atom deactivate a package other than ctrl-alt-R.

Edit: Hold on, it may be a different package.


#5

No, it’s the same package. So I’m stuck with a problem.

Edit: I figured it out. The error ctrl-alt-R error only happens when I have already deactivated the package with atom.packages.deactivatePackage('foo'). Atom throws an exception when it tries to deactivate a package that is already deactivated.

I don’t think it should throw an error in that harmless situation.

Edit 2: See https://github.com/atom/atom/issues/4193