In the past I have used verious means to have a snippets library to hand for Hype.
I even wrote my own app that allowed me to replace text in a Hype function editor from a list of stored snippets. This worked great but broke when Apple changed the way they did extensions and did not give a lot of documentation on how to do what I was doing to adapt the legacy code I had put together (even that was a task due to crap/old documentation ).
Using the keyboard Text Replacement was another. But that shared a similar issue I had with my own app.
You have to remember what the text shortcut word is, type it in the doc before you get the option to replace it.
A snippet should not need to do this. You really just want to insert it where the cursor is.
While playing with Shortcuts.app I realised that it has an option overlooked by me to do just that.
It is not new to me to add a shortcut to the Service menu, which can be accessed in apps either by the App Menu (menu with the app name ) -> Services.
Or Control Clicking within an App.
But what I had been missing was the option Provide Output. Checking that one little check box gives us an ideal way of doing the above very easily.
1, Open up the shortcuts.app and add a new short cut.
2, Give it a name.
Mine will all start with Snippet Hype ....
So they all list together in the Services menu.
2, Add a Text Action.
If you cannot see it in the action library use the search field to find it.
3, paste you snippet text into it.
4, up at the top right of the window, you will see an info icon. click that.
This will show the Shortcut details. Its options.
5, Check the check boxes.
And Use as Quick Action, if it does not automatically check after checking Service Menu.
This will add a couple of Actions the short cut.
6, In the Receive action, make sure it set to Continue for the If there's no input.
It may be set to Ask For or another option .
Just click the blue word and change it to Continue.
That's it for the set up. You can create new ones for each snippet you want.
I use console.log a lot, so having a snippet for that and is also easy using a Combine Text action
This example will ask for the text for the console and the prompt you to choose quoted or plain and then use either of the Combine Text actions respectively.
With quotes embed.
Note the + with part will be use to surround the input text, so here I just put a quote. (makes sure you paste a plain text double quote in rather than type one, otherwise you will get a smart double quote.
without quotes embed
+ with part left blank
Now when in Hype (or other apps) you just need to access the Services menu to see your snippets listed.
Oh, if the Actions stop showing up. There is a bug in shortcuts.app that will turn them all off after an edit. It does not always happen, but I noticed it did it a couple of times when I was adding a new one.
You will need to turn on the checkboxes again.