VSCode extension get workspace state

Viewed 255

I've VSCode extension and I need to know if user is using multiroot projects view (multiple projects are opened ) or just one project, how should I differentiate ?

I try with the following:

if (!workspace.workspaceFolders || workspace.workspaceFolders.length < 2) {
    console.dir(`workspace folders ${JSON.stringify(workspace.workspaceFolders)}  && workspace length ${workspace.workspaceFolders?.length}`)
}

But it doesn't works give me that data, is there other way to achive this ?

this is what I need

  1. if user open a project directly
  2. if user open more then on project using multi root mode
  3. if user open one project in multi root mode (maybe it's like the first)
0 Answers
Related