'Get launch configurations from vscode extension

How can I get all launch configurations?

I considered reading the launch.json file in the .vscode folder, but then I realized that there are some launch configurations that are created dynamically and others that are available without any launch.json file present anywhere. How do I get these configurations?



Solution 1:[1]

You can use below code to fetch all the launch configurations:

let workspace =  workspace.uri.path;
const config = vscode.workspace.getConfiguration("launch", workspace);
const configurations = config.get<any[]>("configurations");

if (!configurations) {
    return;
}

configurations.forEach((config) => {
  // read or modify the config
})

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcus