Sublime Forum

Is there any way to detect folder added or project loaded in sublime plugin

#1

Hi all,

I’m making a plugin for code analysis, and one of the features is to start the analysis of the project as soon as that project is loaded in sublime. is there any way to detect this.

0 Likes

#2

as of ST 4050, there are on_load_project(window) and on_load_project_async(window) event listeners.

0 Likes

#3

@jfcherng
Oh great, I didn’t know about that, that is not in docs https://www.sublimetext.com/docs/3/api_reference.html

So that is a part of EventListener right?

0 Likes

#4

It’s ST 4 hence not in 3’s docs.

0 Likes

#5

Sorry, I should probably have start with that. this is a Sublime Text 3 plugin.

Is there a way to do this in ST3?

0 Likes

#6

I am not aware of any (direct way) and I guess that’s the point why it’s introduced in ST 4.

0 Likes

#7

Oh ok, that is a bummer.

Thanks @jfcherng

0 Likes

#8

But the LSP plugin should’ve done something like this I guess. Maybe @rwols @rchl.

0 Likes

#9

I guess you just have to get the folders information of the current project settings when ST plugin_load() and then do what you want to do in Python. You don’t really need to wait for the project to be fully loaded?

0 Likes

#10

I believe LSP just reacts to on_load_async and on_activated_async view listeners. Not specifically to project being opened.

0 Likes