calva

kiemdoder 2025-04-03T10:51:49.849539Z

Is there a way to rename a function using Calva? I did not see something like that in the https://calva.io/refactoring/ but I just wondered if there could be some vscode feature to refactor a function name.

pez 2025-04-03T11:49:32.821579Z

Yes, what’s lacking from our documentation is that some refactoring are implementations of VS Code commands. Including rename. It’s bound to F2 on my Mac. Dunno if that may be the default.

seancorfield 2025-04-03T17:02:52.390589Z

It's F2 on Windows too. That's the default.

🙏 1
kiemdoder 2025-04-04T05:31:07.806859Z

I see on my mac it is bound to CMD + F2 but can also be found in the context menu when right clicking on a symbol.

👍🏻 1
chromalchemy 2025-04-03T17:20:40.443769Z

Is there a way of preventing inline results from shifting my editor WAY to the right? Can they be turned off?

pez 2025-04-04T07:04:39.528599Z

Gotcha. So I can get it to happen if there is code to the right of the cursor and I do Evaluate Current Form:

(comment
  (str "a b c" "1 2 3"| => "1 2 3")
                                  ^-- trailing code
  :rcf)
If i then do cursorRight (and the window is narrow enough) the window will scroll. I guess this is correct as long as we display inline attached to what is evaluated as we do today. A problem is that it is not scrolling back if we move the cursor to the left again. I don’t know what hotkey you created for scrolling back, but here is one:
{
    "key": "alt+cmd+left",
    "command": "runCommands",
    "args": {
      "commands": [
        "cursorHome",
        "cursorUndo"
      ]
    }
  },
It’s a workaround at least. You are welcome to file an issue about making the inline display optional. There may already be one, the issue has been brought up before, but I haven’t seen the problem described in a way that I have thought it warrants more branching code in Calva. But I think you make a good case, and it should be pretty easy to support.

chromalchemy 2025-04-05T16:33:28.985609Z

Thanks for looking into it, and for the hotkey. It’s certainly not a dealbreaker. Now that I understand the limited cases it happens it feels less egregious. And it makes makes sense to go right, to the end of the enclosing form, even if there are inline results in-between. The shift can be a bit jarring at times, and new users may encounter this, so maybe still worth an issue. But I have also found that hitting escape to dismiss the inline results can be an effective way to return to the original view.

chromalchemy 2025-04-03T17:20:48.045999Z

chromalchemy 2025-04-03T17:21:22.051739Z

notice the horizontal scroll indicator on the left pane. This happens if i (accidentally) move my cursor onto or click on the inline results. Then it shift to the right to show the end of the results.

chromalchemy 2025-04-03T17:21:35.693049Z

I’m fine with having the terminal results only.

chromalchemy 2025-04-03T17:25:06.280679Z

I like the idea of inline results for small evaluations, but in practice, things that hijack my visual code state unexpectedly and drastically give an unsettling feeling, like things are too “brittle”, or the “rug is pulled out” from under me.. PS. AI autocomplete jumpiness also gets on my nerves sometimes.

pez 2025-04-03T17:55:39.347499Z

There is currently no way to opt out of inline results.

chromalchemy 2025-04-03T20:28:01.282139Z

Ok. I set up a hotkey to scroll all the way (back) to the left, to help in that situation.

pez 2025-04-03T20:42:41.021299Z

I wonder what’s different between our setups. The scrolling out to the right never happens to me. > This happens if i (accidentally) move my cursor onto or click on the inline results. Then it shift to the right to show the end of the results. I can’t make this happen. I can’t move my cursor onto the inline results and nothing happens when I clicking on it. > I set up a hotkey to scroll all the way (back) to the left On a Mac there is cmd+left.

chromalchemy 2025-04-03T22:38:18.766959Z

Ok on further testing, it doesnt happen when clicked. It also doesn’t seem to happen on a top level form. It happens when a form is inside a comment form, and the cursor is moved right, from the end of the evaluated form. Ex: move cursor right from after range form (with inline results showing).

(comment
  (range 0 1000))
Sometimes i have the last paren of the comment form dangling
(comment
  (range 0 1000)
)
Right now I can’t replilcate shifting in this casee, but I have seen it shift after moving cursor down from end evaluated line. So basically seems to be limited to when I am evaluating from the tail of a form that is inside a comment form, then if i hit the right (or maybe down key..?), the page can shift all the way to the right (to travel to and show the last paren of the comment form)