I’m making a pretty-printer for a language, and I want it to do the following:
On opening a file of my language, it should act on the editor.
Upon changing a line in an editor for a file of my language, it should act again.
How do I encode this behaviour?
At the moment, I use an activation hook,
"activationHooks": [ "language-fstar:grammar-used" ],
along with the activation command
atom.workspace.observeTextEditors (editor) ->
view = atom.views.getView editor
return unless view
for element in view.querySelectorAll '::shadow .line span:not(.prettyprinted)' <pretty print>
But this seems to be applying my package to all open editors once I have activated the package by opening a file of my language; for example, If I open a file of my language, and then a python file, both will be pretty-printed! This is undesirable.