Sublime Forum

Def on_project_load

#1

Hi folks,

I am trying to develop a plugin for sublime text 2. I want to use the onProjectLoad event (I think now it is the on_project_load event)

But I cant get it. The documentation I have found is out of date?

Here one of my tries:

[code]import sublime, sublime_plugin
from pprint import pprint

class CreateCompassProjectCommand(sublime_plugin.WindowCommand):
def run(self):
print dir(self)

 def on_project_load(window):
 	print "hi"
 	print window.project().fileName()[/code]

What I have to do? Sorry, if it is obvious, but I cant find it!

0 Likes

#2

I don’t see any way to catch an event when a project is loaded in the docs:
sublimetext.com/docs/2/api_reference.html
or for ST3:
sublimetext.com/docs/3/api_reference.html

(It looks like you were looking at the docs for ST1.)

0 Likes

#3

Me too, but I found it on this page:

sublimetext.com/docs/api-reference

is this for ST1? So there is no possibility for checking the onProjectLoad event? So I have to use one which will be fired more often.

Thanks

0 Likes

#4

I would also be interested if there was a way a plugin can detect that a project is/has being loaded?

0 Likes

#5

Related: github.com/SublimeText/Issues/issues/7

0 Likes

#6

Is there any possibility this can be added to ST2? It would be very useful for developing plugins which help users manage their projects within ST2. I was hoping to use this for a plugin I created which mounts to remote servers with the intent that when you open a project it will attempt to mount to the remote server based on pre-defined settings.

0 Likes