Hi,
I understand sublime text already persists some information tied to a single view (Bookmarks, caret location, sublime. PERSISTENT regions, etc)
I have a few plugin ideas but they require saving view-specific data. Here are the following challenges I am facing:
- Load data by using an event listener whenever a view is opened
- Figure out a robust way to see if the view has had any data saved before (I use a key-value dictionary with the MD5 hash of the filename as the key)
- Whenever set_data is called, save in the background (making sure to keep a backup)
- If the same file is open in two views, am not sure how to handle it - though they are two separate views, they are the same file.
I am requesting three functions to add to the view API:
view.get_data(key)
view.set_data(key, value)
view.get_all_data()
Edit:
Turns out I can just use view.settings() to do exactly this! I wasn’t aware of it
Thanks!