From 13c1876ddb4be5ac54531ad8d00a1b2cdb028776 Mon Sep 17 00:00:00 2001 From: Picorims Date: Fri, 8 Oct 2021 22:18:35 +0200 Subject: [PATCH] add vscode commands for groups and snippets --- applications/vscode.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 applications/vscode.js diff --git a/applications/vscode.js b/applications/vscode.js new file mode 100644 index 0000000..7e82d93 --- /dev/null +++ b/applications/vscode.js @@ -0,0 +1,16 @@ +/*Move between groups when multiple groups are set up in the window*/ +serenade.app("vscode").command("group <%direction%>", async (api, matches) => { + api.pressKey("k",["control"]); + api.pressKey(`${matches.direction}`,["control"]); +}); + +/*Insert a snippet (from VSCode or an extension) at the current position. +It can be edited using Serenade's "system" command. The first match in the list +of snippets is the snippet actually written in the document.*/ +serenade.app("vscode").command("snippet <%name%>", async (api, matches) => { + api.evaluateInPlugin("editor.action.insertSnippet"); + setTimeout(function() { + api.typeText(matches.name); + api.pressKey("enter"); + }, 500); +});