ctkjose
(JOSE CUEVAS)
June 13, 2022, 11:15pm
1
Im tracking documents that change (saved) in my extension.
My approach is to hook a callback for onDidAddTextEditor() and then use the onDidSave() of each text editor.
In Atom the workspace had global events/callbacks for these sort of events which made coding much easier.
Is there another way to track changes?
ctkjose
(JOSE CUEVAS)
June 14, 2022, 12:55am
2
Example of Atom’s API:
observeTextEditors
nlydv
(Neel Yadav)
June 24, 2022, 1:32am
3
You’re probably looking for onWillSave()
Edit:
Oh I might have misinterpreted your question… perhaps the Workspace global properties/methods might be what you’re looking for?
1 Like
unqiue
June 24, 2022, 3:40am
4
I think observeTextEditors
is analogous to Nova’s onDidAddTextEditor
, which doesn’t really do what you describe in your first post. As far as I know, there’s no shorter way than
nova.workspace.onDidAddTextEditor(
editor => editor.onDidSave(() => {
// do something
})
)
or
nova.workspace.onDidAddTextEditor(
editor => editor.onWillSave(() => {
// do something
})
)
.
1 Like