Fork me on GitHub
#calva
<
2023-03-10
>
pez15:03:45

Dear Calva friends, I'd like some help with testing a build of Calva: https://output.circle-artifacts.com/output/job/590b3089-ce95-4a36-80a2-357c9c73911c/artifacts/0/tmp/artifacts/calva-2.0.336-2094-auto-select-project-root-6a51fd1d.vsix It contains a collection of changes making fully prompt-less jack-in and connect possible. • Added a deprecation message to calva.autoSelectReplConnectProjectType • Added a REPL Connect Sequence config autoSelectForJackIn • Added a REPL Connect Sequence config autoSelectForConnect • Added a config projectRootPath to the REPL connect sequences • Added a config calva.autoSelectNReplPortFromPortFile and made it default true • Made the command calva.connect take host and port arguments • Added a config calva.autoConnectRepl that when true will make Calva automatically connect to a running REPL when a project is opened. When a connect sequence has both projectRootPath and autoSelect configured, both the project root menu and the project type menues will be suppressed. • Fixes https://github.com/BetterThanTomorrow/calva/issues/2094 • Fixes https://github.com/BetterThanTomorrow/calva/issues/2101 • Fixes https://github.com/BetterThanTomorrow/calva/issues/1984 • Fixes https://github.com/BetterThanTomorrow/calva/issues/1908 Thanks in advance! 🙏 ❤️

🙌 6
👀 2
🚀 2
pez15:03:59

CC some people who might be interested: @U04V70XH6 @U7PBP4UVA @U2BDZ9JG3 @domagala.lukas

pez15:03:08

Updated docs for the connect sequences are here: https://github.com/BetterThanTomorrow/calva/blob/2094-auto-select-project-root/docs/site/connect-sequences.md (You should also be able to find the updated connect.md from that.)

👀 2
Lukas Domagala16:03:28

It’s working in our deps.edn mono repo that’s not polylith

Lukas Domagala16:03:38

So as I’m trying this I’m noticing I need more options 😞 Different devs in the project use different aliases, so I can’t set any sequence to autoSelect for starting a repl. On the other hand we often already have a repl running that we connect to, which would be fine if the repl port file exists. Currently the “calva.autoConnectRepl” can’t skip the menu if no sequence is set as “autoSelect”: true, unless I’m doing something wrong. Something like “autoConnect” on a sequence would give us the option to only use it to connect to but not to start if there’s nothing. Not sure if we’re a special case though 🙂

pez17:03:20

Thanks for testing! Maybe we need to device a way to amend a sequence from user config… What do you mean by use it for only connect and not to start? Something like autoSelectForConnect? And maybe the same for jack-in… I think that would solve some issues I have had as well…

Lukas Domagala17:03:55

Yeah, it’d be nice if vscode had user workspace settings that extend the other ones. But until then autoSelectForConnect and autoSelectForStart would give us the option to use the autoConnect feature at least. Might just remove settings.json from the repo and have a settings.json.template in the long run, but for now it’d be nice to split the connect

👍 2
seancorfield18:03:32

I can try to test it whenever we get internet restored - the storm yesterday took out fiber in our whole neighborhood and AT&T has no ETA for service restoration yet.

🙏 2
😬 2
pez09:03:16

PR updated with separate autoSelectForConnect and autoSelectForJackIn. Building now. You can give it a spin when it has built, @domagala.lukas 🙏

🙌 2
Lukas Domagala10:03:04

Not sure if we want to address this here, later, or even at all, but I noticed that the only way of knowing if I’m connecting to a running repl or starting a new one is to look in the repl output file. We might want to change the title of the menu, depending on which one it is. It’s not a big problem though and it might be tricky to get that info into that title.

Lukas Domagala10:03:19

Other than that it’s working really nicely, thank you!

🙏 2
pez10:03:10

Until now we haven't known which connection type it is when rendering the menus. Which particular menu is it you are referring to?

Lukas Domagala10:03:57

When I have

"calva.autoConnectRepl": true,
"calva.autoOpenJackInTerminal": true, 
but no autoSelect* it’ll open a menu for me to select which sequence I want to use. If a replPort file exists it’s actually the connect menu and if there isn’t it’s the repl start menu. They do however look the same 🙂

pez11:03:26

Technically they are the same 😃 But we can title it now that we actually know for which connect scenario it is being used.

orestis11:03:17

Interesting, I will experiment with this at the next opportunity!

pez12:03:23

@U7PBP4UVA: If that opportunity is after today you lose the opportunity to influence the initial implementation. 😃 And when it comes to settings, that is a bit more impactful than many other cases, since it can be quite disruptive to change such things later.

😅 2
orestis13:03:32

@U0ETXRFEW is there a new build I can try? Downloading vscode insiders just now

orestis13:03:24

Ah I didn't know where to look, sorry

orestis14:03:39

1. I tried with a custom sequence (I don't use those currently) and I really like not having to press enter three times -> just select my custom sequence and it does the right thing (not sure if I could do this before!) 2. The autoSelectForConnect is also nice, but I can't use it, because I can't find a way to opt out of it if I want to do something different in this project. I have the usual way to connect to the REPL, but sometimes I connect to a different shadow-cljs build, and sometimes I connect to a production server. If I have an auto-connect, I can't connect to other REPLs any more --> could there be a different menu command to bring back the selection? (I could also fallback to joyride) 3. When doing (vscode/commands.executeCommand "calva.connect" "localhost" "6666") I still get a prompt to select a project type, which to me makes little sense. I picked "generic" and it seems to work.

orestis14:03:26

So all in all a positive change for me, @U0ETXRFEW!

orestis14:03:20

Actually re (2), when using joyride, and having an autoSelectForConnect option, Calva tries to use my main project command and to upgrade a CLJS repl which is not there. (It actually works, but there's error messages in the output)

orestis14:03:33

My hunch (might very well be wrong) is that the Joyride command should just connect a REPL, and then there should be a separate command to split/upgrade a REPL to CLJS. In fact it seems like most of the complexity of the connect sequence relates to CLJS...

orestis14:03:36

(But Calva has managed to hide that complexity away from me! Switching between the CLJ/CLJS work in the same project is seamless, so definitely don't change that 😄 )

orestis14:03:27

4. it would be nice for us folks who connect to production REPLs to be able to specify host/port directly in the replConnect sequence, but I think we can also commit a custom .production-nrepl-port in the project and create a custom connect sequence pointing there.

pez15:03:42

Thanks, @U7PBP4UVA! I also have this problem with some workspaces that I can't use the auto-select feature because I sometimes want to use some other project type. A separate command or some toggle for bypassing it would be nice, I think.

pez15:03:56

> Actually re (2) Should that be re (3)?

orestis16:03:34

Possibly 😄 I wanted to show that the presence of autoConnect will interfere with joyride, so bypassing with joyride isn't 100% there yet.

orestis16:03:33

Perhaps it would be better UX to have a menu option to offer "auto connect" as a separate action, and leave the existing menu option as-is? In fact, "auto connect" could default to the previous selected menu options, so it would be available without any custom repl sequences.

pez17:03:14

Not following. Auto-connect is something happening when the project is opened. Not a menu option.

Lukas Domagala17:03:56

I think he means autoSelect*

pez17:03:53

OK. We did discuss such an option (auto-selecting menu defaults) here: https://github.com/BetterThanTomorrow/calva/issues/2094#issuecomment-1450183530 We probably should file an issue about it. It doesn't cover the main use case for which I am now adding auto-select, so makes sense as a separate thing.

Lukas Domagala17:03:12

Yeah, I think these settings cover a lot of ground. Not sure if we need to hit all possibilities right from the start 🙂

orestis17:03:26

Ah sorry, auto connect when the project is opened never even crossed my mind. My project is open for weeks at a time. What does happen a lot is I restart my REPL or reload VSCode after some extension upgrade.

orestis17:03:12

So yes, I mean an auto-select command that would just select the previously selected menus.

pez17:03:36

> or reload VSCode after some extension upgrade Auto-connect comes in handy here.

pez01:03:13

I've now made the calva.connect and calva.jackIn commands accept an option for disabling the auto-selection of connect sequences. So a keyboard shortcut can be defined for forcing the project root and project type menus to show. Like so for connect:

{
        "command": "calva.connect",
        "args": {"disableAutoSelect": true},
        "key": "ctrl+alt+c shift+c",
    },
This can be done from Joyride code as well, of course. The commands also take a connectSequence option. And the connect command still takes port and host (though, now in the optional options map). A Joyride snippet for connecting to a port and providing the Generic project type:
(require ["vscode" :as vscode])

(vscode/commands.executeCommand
 "calva.connect"
 (clj->js {:port "55555"
           :connectSequence "Generic"}))
• VSIX: https://output.circle-artifacts.com/output/job/7c9bbc56-a8ec-4cfb-811a-29767c9bb328/artifacts/0/tmp/artifacts/calva-2.0.336-2094-auto-select-project-root-796c93c2.vsix • Updated connect sequence docs: https://github.com/BetterThanTomorrow/calva/blob/2094-auto-select-project-root/docs/site/connect-sequences.md • Updated jack-in/connect docs: https://github.com/BetterThanTomorrow/calva/blob/2094-auto-select-project-root/docs/site/connect.md Please help test this. 🙏 ❤️ Late night hacks like this aren't always bringing forward the highest quality...

Lukas Domagala09:03:28

I like the solution of having a parameter on the command. If your setup is complicated enough that you need it you can use that but normal users don’t have to think about it. 👍 I’ll try it tomorrow though 😛

🙏 2
orestis11:03:46

Thanks @U0ETXRFEW I’ll try to test today. The high level description makes sense so far.

pez11:03:28

Thanks, @U7PBP4UVA. I agree that it was a mistake to make the cljs connection dictate the sequence like it does. For now it will have to do to be able to provide a sequence together with the port, though. Not much bother there, but it’s still a bit confusing why it is needed.

pez13:03:58
replied to a thread:Dear Calva friends, I'd like some help with testing a build of Calva: https://output.circle-artifacts.com/output/job/590b3089-ce95-4a36-80a2-357c9c73911c/artifacts/0/tmp/artifacts/calva-2.0.336-2094-auto-select-project-root-6a51fd1d.vsix It contains a collection of changes making fully prompt-less jack-in and connect possible. • Added a deprecation message to `calva.autoSelectReplConnectProjectType` • Added a REPL Connect Sequence config `autoSelectForJackIn` • Added a REPL Connect Sequence config `autoSelectForConnect` • Added a config `projectRootPath` to the REPL connect sequences • Added a config `calva.autoSelectNReplPortFromPortFile` and made it default true • Made the command `calva.connect` take `host` and `port` arguments • Added a config `calva.autoConnectRepl` that when true will make Calva automatically connect to a running REPL when a project is opened. When a connect sequence has both `projectRootPath` and `autoSelect` configured, both the project root menu and the project type menues will be suppressed. • Fixes https://github.com/BetterThanTomorrow/calva/issues/2094 • Fixes https://github.com/BetterThanTomorrow/calva/issues/2101 • Fixes https://github.com/BetterThanTomorrow/calva/issues/1984 • Fixes https://github.com/BetterThanTomorrow/calva/issues/1908 Thanks in advance! :pray: :heart:

PR updated guided from feedback from @domagala.lukas and @brandon.ringe. Latest build: https://output.circle-artifacts.com/output/job/a5370237-c7d5-496f-bcd3-c6bc66aab17d/artifacts/0/tmp/artifacts/calva-2.0.336-2094-auto-select-project-root-8bb8d17d.vsix

pez01:03:13
replied to a thread:Dear Calva friends, I'd like some help with testing a build of Calva: https://output.circle-artifacts.com/output/job/590b3089-ce95-4a36-80a2-357c9c73911c/artifacts/0/tmp/artifacts/calva-2.0.336-2094-auto-select-project-root-6a51fd1d.vsix It contains a collection of changes making fully prompt-less jack-in and connect possible. • Added a deprecation message to `calva.autoSelectReplConnectProjectType` • Added a REPL Connect Sequence config `autoSelectForJackIn` • Added a REPL Connect Sequence config `autoSelectForConnect` • Added a config `projectRootPath` to the REPL connect sequences • Added a config `calva.autoSelectNReplPortFromPortFile` and made it default true • Made the command `calva.connect` take `host` and `port` arguments • Added a config `calva.autoConnectRepl` that when true will make Calva automatically connect to a running REPL when a project is opened. When a connect sequence has both `projectRootPath` and `autoSelect` configured, both the project root menu and the project type menues will be suppressed. • Fixes https://github.com/BetterThanTomorrow/calva/issues/2094 • Fixes https://github.com/BetterThanTomorrow/calva/issues/2101 • Fixes https://github.com/BetterThanTomorrow/calva/issues/1984 • Fixes https://github.com/BetterThanTomorrow/calva/issues/1908 Thanks in advance! :pray: :heart:

I've now made the calva.connect and calva.jackIn commands accept an option for disabling the auto-selection of connect sequences. So a keyboard shortcut can be defined for forcing the project root and project type menus to show. Like so for connect:

{
        "command": "calva.connect",
        "args": {"disableAutoSelect": true},
        "key": "ctrl+alt+c shift+c",
    },
This can be done from Joyride code as well, of course. The commands also take a connectSequence option. And the connect command still takes port and host (though, now in the optional options map). A Joyride snippet for connecting to a port and providing the Generic project type:
(require ["vscode" :as vscode])

(vscode/commands.executeCommand
 "calva.connect"
 (clj->js {:port "55555"
           :connectSequence "Generic"}))
• VSIX: https://output.circle-artifacts.com/output/job/7c9bbc56-a8ec-4cfb-811a-29767c9bb328/artifacts/0/tmp/artifacts/calva-2.0.336-2094-auto-select-project-root-796c93c2.vsix • Updated connect sequence docs: https://github.com/BetterThanTomorrow/calva/blob/2094-auto-select-project-root/docs/site/connect-sequences.md • Updated jack-in/connect docs: https://github.com/BetterThanTomorrow/calva/blob/2094-auto-select-project-root/docs/site/connect.md Please help test this. 🙏 ❤️ Late night hacks like this aren't always bringing forward the highest quality...