Orphaned Markers


#1

Is there any way to destroy the markers that my package is creating when Atom quits or is reloaded?

It seems like my markers are still around as long as the editor tab is not closed. I have tried destroying them in the serialization method, but it doesn’t seem to be called when quitting/reloading.

I do clear them every time the package (split-diff) is run, but the minimap plugin I am making for this package just searches the editor for my markers. So they are still hanging around when atom is reopened and they show up in the minimap despite my package being off.


#2

You should be able to destroy them in the package’s deactivate function. I believe that markers return a Disposable that you can call dispose() on to destroy them.


#3

It would appear they are still hanging around and no flags anywhere in the marker object indicate it’s been disposed. I have tried both calling dispose() on the Disposable and destroy() on the Marker. Seems like my method is not being called at all.

However when deactivating from command line, my marker’s Disposable objects are being disposed. But the markers are still there.


#4

If you don’t want your markers to be serialized with the text editor you should set the persistent flag to false when creating them.

Edit: The link to the documentation: https://atom.io/docs/api/v1.1.0-beta.0/TextEditor#instance-markBufferRange


#5

Ah that makes a lot of sense, thank you very much


#6

Also, you can make your package reused the serialized markers to speed-up the activation time (that’s what the text editor do with selections and cursor and what I do in pigments as well).