What does “on folder open” mean in VSCode's “run on folder open” tasks?

前端 未结 1 1330
轻奢々
轻奢々 2021-01-28 20:29

VSCode added a feature last year that will auto-run a task \"on folder open\". But what does \"on folder open\" mean when using workspaces?

Specifically, if you open

相关标签:
1条回答
  • 2021-01-28 20:51

    "On folder open" tasks will run when you open a workspace, just like when you use the "Open Folder..." link when opening a non-workspace folder.

    However, there's an additional step required: you need to opt into auto-run tasks. I figured this out via subtle hint in the documentation which said this:

    everyone who allows tasks to be run automatically

    That made me wonder how to enable tasks to run automatically. It turns out there's a configuration change you need to make, as follows:

    1. Open the command palette (SHIFT+CMD+P) and choose "Tasks: Manage Automatic Tasks in Folder"

    2. Choose "Allow Automatic Tasks in Folder"

    3. Now close and re-open the workspace, and on-folder-open tasks will run as expected.

    Frustratingly, this setting is not present in the usual JSON settings files, which means that it won't show up in the search of Settings.

    This made me waste a bunch of time trying to find this setting, which is why I'm posting a Q&A pair here to help the next victim of this problem.

    UPDATE: I also suggested that VSCode add this to Settings. https://github.com/microsoft/vscode/issues/64618#issuecomment-554072124

    0 讨论(0)
提交回复
热议问题