Fork me on GitHub
#calva
<
2021-08-05
>
pez10:08:30

Bring some emoji-love to this one in the #announcements channel, Calva-friends.

woohoo 18
seancorfield13:08:36

@U0ETXRFEW I reset the LSP version, and Calva complains (after the restart) that the field isn't set and LSP will not be started.

seancorfield13:08:54

Ah, this seems to be on WSL2 only, with the Remote install.

pez13:08:58

Strange WSL2 specific behaviour... How did you reset this? (Editing settings.json or other method.)

seancorfield14:08:16

I just blanked out the field in the setting pane. It works fine on macOS as far as I can tell.

pez14:08:18

Can you check if there is an entry in settings.json for this still? (There are VS Code commands for opening the relevant JSON file.)

seancorfield14:08:43

Well, I just set the field again and reloaded to get it working 🙂

seancorfield14:08:21

And it's downloading LSP at the moment (I'm on mobile data, waiting for my wife at the hospital)

pez14:08:30

I can try it myself from your description. Hoping things are not too awful for your wife?

seancorfield14:08:59

Just a CT scan. Possible cyst on her pancreas.

seancorfield14:08:08

Here's the message from Calva: The calva.clojureLspVersion setting is blank and calva.clojureLspPath is also blank, so clojure-lsp will not be started. Please reset the calva.clojureLspVersion setting to use the default version of clojure-lsp, or set it to a clojure-lsp version you want to use. Alternatively, you can set the calva.clojureLspPath to use a downloaded binary of clojure-lsp.

seancorfield14:08:33

(it downloaded & started LSP -- now I blanked out the field and reloaded to repro)

seancorfield14:08:38

The JSON has

"calva.clojureLspVersion": "",

pez14:08:16

Yes, so that should behave like the message says. I would say the WSL2 issue you had is the correct one. 😃

seancorfield14:08:43

Yup. If I delete that line from the JSON and reload, it finds LSP and starts it just fine.

pez14:08:47

I don’t remember why we don’t support a blank setting, but anyway, reset it in the settings panel, using the cog-wheel icon menu, or remove the entry from settings.json.

pez14:08:57

You beat me to it. 😃

seancorfield14:08:02

So blanking out the field should work, but doesn't?

pez14:08:41

Not really. There are two complected settings for lsp. Either you set the clojureLspPath (providing an executable at the path) or the clojureLspVersion (telling Calva to download that version). I think the path overrides the version. (And I still don’t remember why a blank version setting isn’t working.)

seancorfield14:08:23

It's working now, so thank you 🙂

pez14:08:20

And thank you. I think I need to fix the blank version setting case and/or clarify what “reset” means in the documentation and description.

bringe15:08:33

I added that message in the past after realizing an issue with it being blank. Here's a comment from the code:

// This should never be an empty string and can cause issues with clojure-lsp starting, particularly if there is no version file yet from a previous download and no custom clojure-lsp path set. Inform the user.
At the time, we weren't defaulting to latest. When the version setting is blank, I may have thought/assumed there was no way to get the default setting (it's set in package.json), though I'm not sure why I thought so. Also at that time we weren't defaulting to the latest version like we are now, so when the setting was blank, assuming we couldn't get the default value (maybe we actually can), we had no way to know which version to run.

bringe15:08:29

I probably goofed there, but at least added a message informing of the situation. 😄

bringe15:08:44

Now, we can probably set the version to 'latest' if it's blank.

pez15:08:40

That makes sense. At least one user assumed this behaviour. 😃

seancorfield16:08:19

If I'd already read the text over the setting field, I would have seen that latest is a valid setting... but I just followed "reset the setting..." in the release announcement 🙂

pez16:08:52

We instruct to reset in the docs as well. (Since if a user wants to go with the defaults it is better to reset them than to set them to whatever is the current default.)

pez16:08:32

Fixed it so that blank is interpreted as latest in this PR. https://github.com/BetterThanTomorrow/calva/pull/1252

3
👍 3
pithyless11:08:54

Anyone using VSpaceCode? I'm trying it out with Calva, just to see how the other side lives and I'm going through the hello_repl docs 🌟. I've got two questions (already):

(->> colt-express
       :ratings
       vals
       average)
1. In normal-mode I can't put my cursor past s in :ratings so I can't eg. run the Ctrl+Alt+Enter to just eval up to that point (I would need to put my cursor on the whitespace before vals. 2. I can't seem to find any major-mode keybindings for this operation to eval "up to some step" in the threading macro. e.g. I can use the keybinding , e f to eval top-form or , e e to eval current form, but nothing for this operation. Is there some extended keybindings I'm not aware of? I apologize in advance for my #noob questions, but I'm new to both VSCode and Calva. Also, let me know if this is not the right channel for VSpaceCode questions.

pithyless11:08:09

OK, it seems I can mainly just replace it with Shift+Alt+Enter on the next line and it will Work As Expected. I don't think there would be many times where I would not want to eval from top-level-form

pez11:08:30

These evaluation commands are pretty new, so maybe they predate the VSpaceCode configuration. Could that be it, @U05254DQM?

pithyless11:08:10

I was looking for the equivalent of emacs describe-key to find out what this shortcut was doing, but I ended up just digging into the source: https://github.com/BetterThanTomorrow/calva/blob/fc236c9778d0e2d6bd6596f6586ed69665820b14/package.json

practicalli-johnny12:08:35

I just used the command pallet to find the command names. 1) this is how Evil is supposed to work in my opinion, nothing to change here 2) The PR you found on VSpacemacs shows you how to add keybindings I dont use Calva myself, unless I am going to do a VSCode Live coding session, so it would be quicker to add your own that wait for me:)

practicalli-johnny12:08:26

I use #_ reader macro comments if I want to see only part of a threading macro. I have a keybinding in Emacs to comment sections of the thread this way, perhaps something can be to Calva for this (I have no idea how)

pez12:08:10

@U05476190, the source works well for this. There is also the Keyboard Shortcuts panel cmd/ctrl+k cmd/ctrl+s. There you can search for commands by shortcut or by name.

pithyless13:08:12

@U05254DQM RE: 1, this is how it works in ViM, but in Emacs Evil mode, I can put the cursor after the last char in the line (even though there is no actual whitespace character written to the file); which is super useful for all the kinds of commands that are based on "eval the last form/thing/etc". I wonder if this is some kind of option I can change in vscode.vim

pithyless13:08:46

Thanks for the following up @U05254DQM and @U0ETXRFEW; I'll be sure to try to use Calva more over the next couple of days

pez14:08:19

It’s tricky for Calva to solve this. The Vim extension does not have an API. So there is no way for Calva to know that Vim normal mode is active.

practicalli-johnny16:08:47

1. thats not normal evil mode behaviour as I see it. some people like to change the behaviour of evil and are free to do so, but its not for me. I use use the next line, as lines are irrelevant to those commands. I only use eval-last s-expression commands to evaluate nested expressions

pithyless11:08:45

Thanks for the gist, I will diff the two :)

practicalli-johnny18:08:02

That PR was the most JSON I have ever written in one weekend, not the most enjoyable weekend I've had. But happy it works and others find it useful