///
namespace pxt.editor {
initExtensionsAsync = function(opts: pxt.editor.ExtensionOptions): Promise {
pxt.debug('loading microbit target extensions...')
const res: pxt.editor.ExtensionResult = {
hexFileImporters: [{
id: "blockly",
canImport: data => data.meta.cloudId == "microbit.co.uk" && data.meta.editor == "blockly",
importAsync: (project, data) => project.createProjectAsync({
filesOverride: {
"main.blocks": data.source
}, name: data.meta.name
})
}, {
id: "td",
canImport: data => data.meta.cloudId == "microbit.co.uk" && data.meta.editor == "touchdevelop",
importAsync: (project, data) =>
project.createProjectAsync({
filesOverride: { "main.blocks": "", "main.ts": " " },
name: data.meta.name
})
.then(() => project.convertTouchDevelopToTypeScriptAsync(data.source))
.then(text => project.overrideTypescriptFile(text))
}]
};
return Promise.resolve(res);
}
}