joyride

pez 2022-05-18T10:49:34.984139Z

Joyride updated! https://twitter.com/pappapez/status/1526876760591286273?s=20&t=P-VgeyJCUCiI1qIqSTxxYg

1
🎉 1
pez 2022-05-18T19:49:52.070139Z

I Joyrided my own extension (not Calva) 😃 https://twitter.com/pappapez/status/1527012190909349888

pez 2022-05-18T19:59:11.867849Z

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.)