I accidentally deleted main.blocks

When i try to fix it by adding another file named: main.blocks. but it turns it into: main.blocks.ts.

Is there a fix?

1 Like

Can you share the project?

1 Like
  1. Are you saving the project on GitHub and did you commit before you deleted main.blocks? You might be able to revert back to the previous version, I believe there’s a button on the GitHub commit screen on your Arcade project to revert back to the previous commit. (A commit is like a version that contains changes to files and code)
  2. Switch to JavaScript or Python, then switch back to Blocks: If you’re lucky, Arcade might be able to convert the code back to blocks.
  3. When you add/create a file, it’s empty. So you can’t recover it by adding a new file named after the file you deleted.

I hope you get your code back!

1 Like

I took some pictures of it happening:


Here is a game just for show:

1 Like

Ah, I meant the game in which you want to have it fixed, not just a project without the file; I can mess around with it and manually fix it for this case, assuming you give me a project that has the ts / assets in it, but there’s no easy way right away in the editor. I filed https://github.com/microsoft/pxt-arcade/issues/5855 for a ‘general’ fix / easier path

1 Like

Here is the game:

I tried to delete file i had misspelled and missclicked.

Here you go https://makecode.com/_PLoR7Kfi8hoK will generate the .blocks file back when you click into blocks

That said, this doesn’t look like a project that you would particularly want to go to blocks in, as it’s nicely formatted in text / swapping back and forth won’t look as pretty. One thing to note is that I did change this line:
as tiles.setTilemap is the old, deprecated version that doesn’t support variables in blocks (that is, it can only be set with a literal value like tiles.setTilemap(`asdf`) in blocks, so if you put a variable in it will get replaced with a new, empty tilemap)