Listing all editor tabs
JonB last edited by
For what it's worth, been playing around with objc in the beta, and came up with this method to list all editor file paths. I was going to use this in git to check whether editor files need to be reloaded, although the editor seems to be pretty good about figuring this out in the beta (I think it checks file date, though I have not yet tried faking file date older, such as would happen in git or opening tars, etc).
I have not had success programatically switching tabs, although I think editor.open_file with the optional arguments would work.
Also, one pet peeve of mine is that when I close some tabs, then crash the app, my tabs are not necessarily saved... turns out you can force the tab list to save.
# coding: utf-8 from objc_util import * UIApplication=ObjCClass('UIApplication') app=UIApplication.sharedApplication() def saveTabRestorationInfo(): app.delegate().viewController().saveTabRestorationInfo() def list_editor_open_files(): return [str(x) for x in app.delegate().viewController().allOpenFilePaths()]