Jupyter file listener

Answered

I want to call the function for every change of the .ipynb file. 
DocumentListener does not give change events. Jupyter files can't be listened to?
How can this be done? 

1
3 comments

Hi Vseslav!

com.intellij.openapi.vfs.newvfs.BulkFileListener listens for .ipynb file changes as for any other virtual files. Please note, that the file is updated on actual file change event, not on text/Document update. Hole this helps!

Don't hesitate to ask in case of further questions.

 

1

Thank you for your reply! 
Now I'm trying to work with BulkFileListener. The problem is that the .ipynb changes are accumulated and only then sent. And BulkFileListener event list contains only one event with all changes at once. But I want to get event for every change. 
For example, 5 events for 5 changes:
p
pr
pri
prin
print

0

That the expected behavior since file saving occurs not on every edit event, but when file saving is called (e.g. if user invokes Ctrl + S, file is run, etc.). To listen for the event you mention DocumentListener / BulkAwareDocumentListener should be used. They should work for .ipynb files as well, but capture changes in text representation of Jupyter files (as seen in the editor), not in underlying JSONs.

0

Please sign in to leave a comment.