import { DebugConfiguration , workspace , WorkspaceConfiguration , WorkspaceFolder } from "vscode" ; const configurationsKey = 'configurations' ; const launchKey = 'launch' ; const versionKey = 'version' ; export const launchVersion = '0.2.0' ; export function getDebugConfigs ( folder ) { return getLaunchConfig ( folder ) . get < DebugConfiguration [ ] > ( configurationsKey ) || [ ] ; } export async function updateDebugConfigs ( folder , configs ) { await getLaunchConfig ( folder ) . update ( configurationsKey , configs ) ; } export function getLaunchVersion ( folder ) { return getLaunchConfig ( folder ) . get < string > ( versionKey ) ; } export async function updateLaunchVersion ( folder , version ) { await getLaunchConfig ( folder ) . update ( versionKey , version ) ; } export function isDebugConfigEqual ( c1 , c2 ) { return c1 . name === c2 . name && c1 . request === c2 . request && isTypeEqual ( c1 . type , c2 . type ) ; } function isTypeEqual ( type1 , type2 ) { return type1 === type2 || ( isNodeType ( type1 ) && isNodeType ( type2 ) ) ; } /**
 * Special case node debug type because it can be either "node", "node2", or "pwa-node"
 * https://github.com/microsoft/vscode-azurefunctions/issues/1259
 */ function isNodeType ( t ) { return /node/i . test ( t ) ; } function getLaunchConfig ( folder ) { return workspace . getConfiguration ( launchKey , folder . uri ) ; } export interface ILaunchJson { version : string ; configurations ? : DebugConfiguration [ ] ; }