Fork me on GitHub
#calva
<
2023-09-01
>
Karol Wójcik11:09:01

Is it possible to hide line numbers in calva REPL? line numbers are distracting me pretty much ;(

pez11:09:56

VS Code doesn’t have direct commands for it, iiuc. But you can use #joyride! If you don’t have Joyride installed these are the steps: 1. Install the Joyride extension 2. Focus the REPL window 3. Run the command Joyride: Run Clojure Code… 4. Paste this and hit ENTER

(set! (.-lineNumbers vscode/window.activeTextEditor.options)
        ({1 0 0 1} (.-lineNumbers vscode/window.activeTextEditor.options)))
From there you can make this into a keyboard shortcut, something like:
{
    "key": "alt+r 0",
    "command": "runCommands",
    "args": {
      "commands": [
        "calva.showOutputWindow",
        {
          "command": "joyride.runCode",
          "args": "(set! (.-lineNumbers vscode/window.activeTextEditor.options) ({1 0 0 1} (.-lineNumbers vscode/window.activeTextEditor.options)))"
        },
        "workbench.action.focusPreviousGroup"
      ]
    }
  }

pez11:09:23

You can also make it part of your Joyride user script and have it done more automatically.

Karol Wójcik08:09:26

❤️ This is just beautiful! Thank you so much @U0ETXRFEW!

🙏 2
❤️ 2
Karol Wójcik08:09:44

@U0ETXRFEW Last question. I'm trying to build a hook that when I click a certain keybinding the Joyride will run the user/reset! function and pipe the output and result to the current CLJ repl. Do you maybe have an example of something similiar?

pez09:09:36

Hoping it is not the last question! 😃 I’m not sure I follow, but sounds like you will need to use Calva’s repl API: https://calva.io/api/#repl The Clojuredocs example (inspired by @U04V70XH6’s VS Code setup) does this to resolve the current symbol in the repl. https://github.com/BetterThanTomorrow/joyride/blob/master/examples/.joyride/src/clojuredocs.cljs

Karol Wójcik12:09:53

Hey @U0ETXRFEW! It’s working like a charm! Thank you so much! Calva rocks!!!!!

🙏 2
pez11:09:56

VS Code doesn’t have direct commands for it, iiuc. But you can use #joyride! If you don’t have Joyride installed these are the steps: 1. Install the Joyride extension 2. Focus the REPL window 3. Run the command Joyride: Run Clojure Code… 4. Paste this and hit ENTER

(set! (.-lineNumbers vscode/window.activeTextEditor.options)
        ({1 0 0 1} (.-lineNumbers vscode/window.activeTextEditor.options)))
From there you can make this into a keyboard shortcut, something like:
{
    "key": "alt+r 0",
    "command": "runCommands",
    "args": {
      "commands": [
        "calva.showOutputWindow",
        {
          "command": "joyride.runCode",
          "args": "(set! (.-lineNumbers vscode/window.activeTextEditor.options) ({1 0 0 1} (.-lineNumbers vscode/window.activeTextEditor.options)))"
        },
        "workbench.action.focusPreviousGroup"
      ]
    }
  }