I want to achieve the following: when inserting text inside a certain app, after pressing a shortcut, bring up a VSCode window with LaTeX as the language (and open a default file), edit text there, and when closing that window, copy the entire text I just input without saving. The first part (listening to keystroke events) is done via hammerspoon (since I'm using macOS), and I don't really know what to do with the latter parts.
More specifically, I'm trying to implement the adding text functionality from this post. There, the author used a python script to listen to keystroke events, and when a t is pressed, a default vim window is brought up, and certain snippets can be used when creating texts. I have already recreated the snippets part in VSCode, so having the ability to bring up such a window in VSCode will be a huge help whenever I'm trying to typeset LaTeX formulas.