RockBoro
RockBoro

Reputation: 2483

How to detect if a folder has been added to the vscode workspace?

Can any vscode extension detect if a folder has been added to the workspace?

That would be the file, add folder to workspace menu option.

Once the folder is added to the workspace, I want to use FileSystemWatcher to watch for changes in the folder.

Upvotes: 2

Views: 552

Answers (1)

Matt Bierner
Matt Bierner

Reputation: 65633

Try the vscode.workspace.onDidChangeWorkspaceFolders event. It is fired with a WorkspaceFoldersChangeEvent with has the added and removed folders

Upvotes: 4

Related Questions