It’s on my todo list to integrate with more tools that can improve the quality of the JavaScript written in Scriptable. It’s not on the top of my list right now but it’s certainly not at the bottom either
If you want to automatically add all keywords, you can take a look at https://docs.scriptable.app/scriptable.json which contains a Tern language definition for Scriptable’s APIs. You can probably fairy easily map it to whatever format you need.
I’ve now committed and pushed the changes to my Git repo. I’ve also included await because ESLint doesn’t accept it in the top level scope. You can find the file here:
It generates from the Tern definition file, which @simonbs referenced here, a TypeScript type definition file. This file is used by various desktop IDEs like VS Code to provide code completion and documentation help when hovering with the mouse over the keywords.
When I remove the entire !define section from the Tern file, completion works without errors (as well as navigation), but I don’t have any documentation (only links to the website).
I don’t understand enough of Tern, but might it be related to this issue?
The answer there is You can’t have non-object types in !define., but I don’t understand that…