Issues Compiling w/ json files in VS Code on OSX (Level_1-1 Example)

Hey Folks,

I'm having trouble attempting to compile the Level_1-1 example in VS Code on my M2 MacBook using the template at: GitHub - cadin/playdate-vscode-template: VS Code template with tasks for building and running in Playdate simulator..

The compiler never adds the json files to datastore and so the call in LevelLoader.lus for local s = playdate.file.getSize(path) fails and I error out at the call to json.decode(levelData).

I've used this template to build other examples and my own projects without issues, albeit not ones that use .json. Any ideas where I should look to hunt down why VS Code is so scared of these json files?

A couple of things I've tried so far are:

  • Moving the files into a sub directory: levels
  • Creating new .json files and copying the contents of the old ones: Level_1-2.json
  • Calling the files files with and without the extension: local level = Level('levels/level_1-2') and local level = Level('levels/level_1-2'.json)

Welp, in classic rubber duck fashion, after of screwing with this I solved the issue minutes after making this post.

It turns out using that templated the build task uses pdc -k which skips unrecognized file types, json included. I saw elsewhere on the forum here that there was request to add json as a recognized type, but in the meantime pulling the -k out of my build task solved the issue. Hopefully this will help someone else in the future.

2 Likes