Skip to content

No provider error when adding a folder with updateWorkspaceFolders #42658

@octref

Description

@octref

Testing #42195

Tried adding two folders one by one, each operation errored out.
When I add those exact folders by Right Click -> Add Folder to Workspace there was no error.

image

Code

const folders = [
  { uri: Uri.parse('/Users/octref/Code/fiddle/repro') },
  { uri: Uri.parse('/Users/octref/Code/fiddle/ve') },
  { uri: Uri.parse('/Users/octref/Code/repo/postcss-safe-parser') },
  { uri: Uri.parse('/Users/octref/Code/work/tedious') },
]

export const activate = (context: vscode.ExtensionContext) => {
  vscode.workspace.onDidChangeWorkspaceFolders(e => {
    console.log(`Added ${e.added.length} folders`)
    e.added.forEach(f => {
      logFolder(f)
    })
    console.log(`Removed ${e.removed.length} folders`)
    e.removed.forEach(f => {
      logFolder(f)
    })
  })
  function addFolder(n) {
    try {
      vscode.workspace.updateWorkspaceFolders(1, 0, folders[n])
    } catch (e) {
      console.error(e.message)
    }
  }

  vscode.commands.registerCommand('addFolder1', () => addFolder(0))
  vscode.commands.registerCommand('addFolder2', () => addFolder(1))
  vscode.commands.registerCommand('addFolder3', () => addFolder(2))
  vscode.commands.registerCommand('addFolder4', () => addFolder(3))
  vscode.commands.registerCommand('removeFolder', () => {
    try {
      vscode.workspace.updateWorkspaceFolders(1, 2)
    } catch (e) {
      console.error(e.message)
    }
    //vscode.workspace.updateWorkspaceFolders(0, null, { uri: vscode.Uri.parse('/Users/octref/Code/fiddle/repro') })
  })
}

Log

/private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/9…nsiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2924 no provider for /Users/octref/Code/work/tedious: ENOPRO: no provider for /Users/octref/Code/work/tedious
    at file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2805:679
    at n.Class.define.cancel.then (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:147:398)
    at t._withProvider (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2805:618)
    at t._doResolveFiles (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2806:666)
    at t.resolveFile (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2806:78)
    at e.getChildren (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:4401:83)
    at a (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:303:466)
    at e.refreshChildren (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:304:265)
    at e.doRefresh (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:304:544)
    at file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:304:126
e.doShow @ /private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/9…nsiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2924
/private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/9…nsiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2924 no provider for /Users/octref/Code/repo/postcss-safe-parser: ENOPRO: no provider for /Users/octref/Code/repo/postcss-safe-parser
    at file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2805:679
    at n.Class.define.cancel.then (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:147:398)
    at t._withProvider (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2805:618)
    at t._doResolveFiles (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2806:666)
    at t.resolveFile (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2806:78)
    at e.getChildren (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:4401:83)
    at a (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:303:466)
    at e.refreshChildren (file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:304:265)
    at file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:301:857
    at file:///private/var/folders/31/2hth7q4n4bl4kyntrvbyg66h0000gn/T/AppTranslocation/910CB87F-A114-460D-8CD8-5E149B164864/d/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:296:715

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions