Fork me on GitHub
#cider
<
2022-05-26
>
borkdude06:05:44

@bozhidar Thanks for the nREPL improvements. I just tried connecting to an nbb server with CIDER 1.4.1 but it still didn't work for me

borkdude06:05:00

Well, connecting worked :)

borkdude06:05:23

I still have to go into clojure-mode to be able to evaluate things from a .cljs buffer. Connecting with clojurescript-mode and then choosing the custom REPL type doesn't do it either

borkdude06:05:57

cc @U07SQTAEM - Perhaps also try with Hubble?

mkvlr07:05:02

thanks for the release from me as well!! Also tried it with the clerk nrepl and connecting worked but not eval so the same behavior that you saw @U04V15CAJ

bozhidar05:05:43

That's a different problem and it will be addressed separately. Basically the issue is that CIDER now thinks that the connection in Clojure not ClojureScript. There are a couple of ways to solve this, but I'm still wondering what's the best option.

bozhidar06:05:14

I'm guessing that manually setting the type of the connection should fix this problem as well.

bozhidar06:05:31

Still, I'm thinking that probably a better fix would be to just dispatch to whatever connection there is if there's a single connection within a session and just disregard the connection type check.

bozhidar06:05:40

Decisions, decisions... 😄

borkdude06:05:41

How to set the connection type?

David Pham07:05:32

Is it cider-set-repl-type emacs function?

bozhidar08:05:01

You can ignore the part about the middleware, as this is only relevant to hosted ClojureScript REPLs.

jackrusher08:05:46

While I agree with @U04V15CAJ that it shouldn't matter whether it's a clj or cljs REPL for connect to work, in the meantime should we be able to use cider-connect-cljs?

mkvlr08:05:53

what’s this needed for? Might be nice if we could get at least the https://nrepl.org/nrepl/ops.html (especially eval + completions) could work without a repl detection?

borkdude08:05:36

@U07SQTAEM No, cider-connect-cljs didn't work either :/ You still need the custom snippet, I documented that here: https://github.com/babashka/scittle/tree/main/doc/nrepl#cider

borkdude08:05:21

> could work without a repl detection Yes, that's the whole point of just using nREPL as a protocol, there should be no REPL type detection necessary, or at least, if you try to do it, fall back on something that assumes nothing specific.

bozhidar08:05:10

cider-connect-cljs doesn't work for non-hosted REPLs yet, which is part of the problem.

bozhidar08:05:50

@U04V15CAJ The REPL type is needed mostly because a common workflow was to have 2 different REPLs for the same project and we needed some way to figure out which evaluations to go into which REPL. That's not really related to nREPL, but was rather an artefact of how people were using CIDER.

bozhidar08:05:36

In hindsight I almost regret moving away from the early design where you simply had to select what REPL you want to use manually. This worked flawlessly, but required people to do some manual work when running multiple REPLs.

borkdude08:05:00

Isn't that managed by sesman now?

bozhidar08:05:08

All the logic to detect automatically which REPL is related to which source file resulted in some problems.

bozhidar08:05:52

@U04V15CAJ Yep. Sesman replaced the old code in CIDER, but it didn't really solve anything related to the REPL types. It's main focus what to simplify the grouping of REPLs by mapping them to project paths.

bozhidar08:05:20

You can still have different types of REPLs in the same project and you need to figure out which one you want to use.

bozhidar08:05:43

Anyways, all of this is fixable, I'm just trying to explain that this time around the problem is not really nREPL-related. I'm still wondering how to best address this in CIDER.

bozhidar09:05:15

@U5H74UNSF This detection is mostly for the purpose of not sending the code to be evaluated in the wrong REPL. This may or may not be a problem depending on one's perspective.

bozhidar09:05:24

(e.g. you're in a ClojureScript source file, but you have two REPLs running)

mkvlr09:05:37

I see, yeah this would become less automatic but maybe manual selection is actually good here? I’m often confused when things get evaluated in two repls.

jackrusher09:05:56

Seems like a buffer-local variable binding would be good for this — though less convenient than magical auto-detection, obvs.

borkdude09:05:35

sesman-link-with-buffer should also work, I think?

bozhidar05:05:44

Yeah, there are workarounds, but ideally things should just work out-of-the-box for everyone. I'll keep thinking about a proper solution.

bozhidar05:05:14

To give you a bit more context - the problem is the cider-repls functions, which we happen to be discussing in a PR currently https://github.com/clojure-emacs/cider/pull/3201/files

bozhidar05:05:18

As you can see it filters the available REPLs by their session and by their type to decide which are the valid options.