Joyride updated! https://twitter.com/pappapez/status/1526876760591286273?s=20&t=P-VgeyJCUCiI1qIqSTxxYg
I Joyrided my own extension (not Calva) 😃 https://twitter.com/pappapez/status/1527012190909349888
Here are the ingredients:
1. Joyride
a. Two functions in my my-lib Joyride User script namespace
b. Two keyboard shortcuts
2. Paste Replace (that other extension)
a. Settings for this extension
The two Joyride functions:
(defn replace-all-text []
(p/do (vscode/commands.executeCommand "editor.action.selectAll")
(vscode/commands.executeCommand "execCopy")
(vscode/commands.executeCommand "paste-replaced.paste")))
(defn replace-last-word []
(p/do (vscode/commands.executeCommand "cursorWordLeftSelect")
(vscode/commands.executeCommand "execCopy")
(vscode/commands.executeCommand "paste-replaced.paste")))
The shortcuts:
{
"key": "cmd+f4",
"command": "joyride.runCode",
"args": "(my-lib/replace-all-text)",
"when": "!editorTextFocus"
},
{
"key": "cmd+f4",
"command": "joyride.runCode",
"args": "(my-lib/replace-last-word)",
"when": "editorTextFocus"
},
The Paste Replaced settings:
"paste-replaced.replacers": [
[
[
"\"",
"\\\"",
"g"
],
[
" +",
" ",
"g"
],
[
"\n",
"\\n",
"g"
],
[
"^!r7$",
"(repeat 7 \"I am using the REPL! 💪\")",
],
[
"^!hw2$",
"(p/let [choice (vscode/window.showInformationMessage \"Be a Joyrider 🎸\" \"Yes\" \"Of course!\")]\n (if choice\n (.appendLine (joyride/output-channel) (str \"You choose: \" choice \" 🎉\"))\n (.appendLine (joyride/output-channel) \"You just closed it? ðŸ˜\")))"
],
[
"^!hw$",
"(vscode/window.showInformationMessage \"Hello World!\")"
],
]
],
(Those first three settings are so that I can paste Clojure code into the other settings where the actual fast-typing replacments happen. Bootstrapping, haha.)