Visual Studio Code Snippets, for rapid Hype API function lookups

Tumult Hype supports editing in external editors, and to help speed up workflows for those of you working in Visual Studio Code, I published a snippet extension that makes writing Hype API code super fast.

When you start typing something like shownex, you'll see all the Hype API functions which contain that string with a helpful bit of documentation as well. Arrow down to select the function you want, and you can then tab between all the function's properties.

I may have missed one or two, so please let me know if you experience any issues.

To get started, install VSCode, install the extension, and edit any JS function (a Hype function or .js file) from the Resource Library:

11 Likes

AWESOME! :smiley:

Nice idea Daniel!

  • Add additional helper functions for Matter.js.

Do you want to cut-and-paste the "Photics Physics Bridge" into your extension? (I'll probably be expanding it though, while working on the new book.)

Although... what's the license for this extension?

I was thinking of creating some license text for my Hype related downloads. I suppose it would be compatible with an Open Source license.


Ha ha, if I had a GitHub account, I'd probably be doing a Pull Request…

Delete those Mac droppings. :poop:

It's in your .gitignore... hype-snippets-vscode/.gitignore at master · themorgantown/hype-snippets-vscode · GitHub ...but still got through somehow.

2 Likes

wonderful :slight_smile: well done!

2 Likes

That is nice, Love the way it also offers the arguments.

Thanks. :+1::+1:

p.s,

I did not sport the post the first time around… So glad you did an edit on this it which popped it back up to the top…

Maybe worth pinning for a while.

2 Likes

Connect with me when it's done? I'd like to have more longer snippets. The format for those is pretty awkward. Here's one for HypeDocumentLoad: Longer Code Snippet Example: Listener for HypeDocumentLoad · themorgantown/hype-snippets-vscode@49c7459 · GitHub

There's a few that would be great to pull from @MaxZieb's Cookbook as well and the Extension Project as well. But a tricky thing for me is I don't really know how frequently these scripts are used.

Added that.

I zapped those Mac poops, thanks.

:pushpin: for a lil bit :slight_smile:

2 Likes

Hello Daniel, how did I miss this thread?! Great work!

Offering this in an external editor should just be a great example or test bed for similar support in Whisk and hence Hype. This is just too convenient to ignore. :wink:

2 Likes

Tonight, I’m writing about this extension in the JavaScript section of the Hype book.

It truncates the APIs pretty hard. Not sure how to fix that. (Not without hacking Visual Studio Code.)

Looks like a known issue with Visual Studio Code

Does it need part of the description in the left window?

1 Like

Hmm that’s annoying. Yeah I can only provide the snippet and the description, VScode handles everything else. At least you get the full function name shown at the bottom of the description:

If a description isn’t shown, it still might be cut off.

1 Like

I think this needs a play button. It’s pretty tedious to jump between browser, Hype and Visual Studio Code when working on a JavaScript file. Perhaps there should be a Hype preview button in Visual Studio Code. I don’t know if that’s possible though, as Hype doesn’t really open up to Apple Script JXA.

1 Like

Snippet suggestions are now resizable so everything's a bit more readable

2 Likes

That's pretty neat. Now there's lots of space...

It's done...

https://photics.com/books/a-book-about-hype/photics-physics-bridge-ppb-js/

...well, version 1.0 is done. HA HA! :smile:

Well, I think it would be better if something like the Photics-Physics-Bridge was already part of the Hype runtime. I don't think the PPB is used a lot, but maybe that will change. (I don't know if anyone besides me has used it in a Hype game.) Now that I have it, making games with Hype is so much easier. It's included with the latest "Controlling" template...

https://photics.com/free-template-tuesday-39-tumult-hype-controlling/

1 Like