[quote="tito"]I was able to create a solution for project related things with SideBarEnhancements
from sidebar.SideBarProject import SideBarProject
That will return "folders" value of the project file.
it would be nice if you can use that api if available and fit your needs. I'll appreciate contributions to that file.
You may can include a copy of that file in your package and load it only if SideBarProject is not already defined.[/quote]
Pretty cool. Are you searching the session as well or are you doing it differently? I did throw together a simple solution. It isn't a lot of code, I just didn't want to have to parse the session.
project = None
with open(join(sublime.packages_path(), "..", "Settings", "Session.sublime_session")) as f:
j = json.load(f)
for w in j'windows']:
if w'window_id'] == win_id:
if "workspace_name" in w:
project = w"workspace_name"]
Now with this I track the windows IDs that have been toggled to use per project favorites and I pair them in a dictionary with their project file path. Then you can also prune the them when the windows get closed (assuming my logic isn't off).
dead = set(projects.keys()) - set([x.id() for x in sublime.windows()])
for key in dead:
I am considering just using the settings section in the project to store per project favorites. That way I don't have to guess what folder to put them in. And that is what the settings section in the project file is for...per project settings. Still playing around though.