Big update to prettier-extension-monkeyc

I've posted about prettier-extension-monkeyc before, but I've added a bunch of new features that developers will probably like (well, I've been missing them, so maybe you have too).

The new features it implements for VSCode include:

  • Goto Definition. Point at a symbol, Ctrl/Cmd click, and it will take you to the definition. Or F12
  • Goto References. Right click on a symbol and select "Goto References". It will show you all the references. Or Shift-F12
  • Peek Definition/Peek References. Same as above, but in a popup window so you don't lose your place in the original document.
  • Rename Symbol. Right click on a local, function, class or module name, and select "Rename Symbol". It will rename all the references. It doesn't yet work for class members/methods.
  • Goto Symbol. Type Ctrl/Cmd-Shift-O and pick a symbol from the drop down (which has a hierarchical view of all symbols in the current file). This also appears as an outline across the top of the file.
  • Open Symbol By Name. Type Ctrl/Cmd-T, then start typing letters from a symbol name. A drop down will be populated with all matching symbols from anywhere in your project.

Older features include a prettier based formatter for monkeyc, and a monkeyc optimizer that will build/run/export an optimized version of your project.

[edit: My last couple of replies seem to have just disappeared, and the whole conversation seems to be in a jumbled order, so tldr: there's a new test-release at https://github.com/markw65/prettier-extension-monkeyc/releases/tag/v2.0.9 which seems to work for me on linux. I'll do more verification tomorrow, and push a proper update to the vscode store once I'm sure everything is working]

  • It seems that they've switched to using LZMA2 compression - and I can't find a zip library that supports it. There are libraries that support LZMA2 compression/decompression, so maybe it's not too hard to add to an existing zip implementation.

  • Yeah, I also looked into the iq file yesterday, and that reminded me the changelog of 8.4.0 that they changed to 7zip

  • I've found a suitable library, which seems to be the source code for 7zip itself compiled into WASM. In any case, it works for both new and old .iq files.

    I'm trying to test everything now, but Garmin seem to have deliberately made things hard. After downloading the new Device files (which I did while updating to 8.4.0), lots of devices refuse to build with any of the 8.2.x sdks. This seems like really bad backward compatibility, even for Garmin...

    Anyway, 8.1 still seems to work, so I can still test both the old and new iq formats. [edit: I was wrong - I can still build .iq files which contain fr955 targets using 8.1, but I can't build for the simulator if I target fr955. Fortunately, I have Time Machine backups, so was able to restore to older device files, and I can build again]

  • I also don't like that they are forcing us to build only with the latest SDK. There might be some good reasons for it that we don't know, but maybe it doesn't matter. I mean if devs are forced to do the upgrade then you could just do the same, after all the number of devs who still build old apps with old SDK for old devices only must be diminishing by now.

    Update: maybe except for good reasons, i.e: until Garmin fixes 8.4.0 related bugs (no ERA) most devs will probably stick to 8.3.0

  • After following this work from time to time I have done a trial now for one of my projects.

    All works fine when I build for any specific device, but following error occurs if I export the project. Is there any way to overcome the call stack size limit?

    * Ejecutando tarea: omonkeyc: export

    Starting optimization step...
    ERROR: Internal: RangeError: Maximum call stack size exceeded
    RangeError: Maximum call stack size exceeded
    at String.match (<anonymous>)
    at Object.parse (/Users/Inigo/.vscode/extensions/markw65.prettier-extension-monkeyc-2.0.119/node_modules/@markw65/prettier-plugin-monkeyc/build/prettier-plugin-monkeyc.cjs:15:54764)
    at Object.parse (/Users/Inigo/.vscode/extensions/markw65.prettier-extension-monkeyc-2.0.119/node_modules/prettier/index.js:7515:23)
    at coreFormat (/Users/Inigo/.vscode/extensions/markw65.prettier-extension-monkeyc-2.0.119/node_modules/prettier/index.js:8829:18)
    at formatWithCursor2 (/Users/Inigo/.vscode/extensions/markw65.prettier-extension-monkeyc-2.0.119/node_modules/prettier/index.js:9021:18)
    at /Users/Inigo/.vscode/extensions/markw65.prettier-extension-monkeyc-2.0.119/node_modules/prettier/index.js:38183:12
    at Object.format (/Users/Inigo/.vscode/extensions/markw65.prettier-extension-monkeyc-2.0.119/node_modules/prettier/index.js:38197:12)
    at formatAst (/Users/Inigo/.vscode/extensions/markw65.prettier-extension-monkeyc-2.0.119/node_modules/@markw65/monkeyc-optimizer/build/chunk-BOVSYC7N.cjs:20065:14)
    at /Users/Inigo/.vscode/extensions/markw65.prettier-extension-monkeyc-2.0.119/node_modules/@markw65/monkeyc-optimizer/build/chunk-BOVSYC7N.cjs:30342:17
    at async Promise.all (index 9)