Fork me on GitHub
#cursive
<
2024-05-15
>
msolli08:05:06

Good morning! nREPL since 1.0.0 supports Unix domain (filesystem) sockets: https://nrepl.org/nrepl/usage/server.html. Does Cursive support configuring nREPLs to use Unix domain sockets instead of TCP connections?

cfleming09:05:10

It doesn’t, no. If that’s useful I can look at adding support.

msolli09:05:23

Yes, I think it'd be useful. As they say on that page: > UNIX domain sockets know that they’re running locally, so they can avoid some checks and operations (like routing), which makes them faster and lighter than TCP/IP sockets. In practice this means they are a better option for local development. But TCP to localhost works fine as it is, so maybe not top priority.

cfleming09:05:41

Right, my understanding is pretty limited here, but if they don’t add anything in terms of actual functionality then I’d consider it low priority. I’d think network performance to localhost is probably very seldom a serious performance issue.

👍 3
onetom10:05:28

> If you’re not under a defn or some other type of var, it will navigate to the test namespace instead. — https://cursive-ide.com/userguide/testing.html#navigation-to-and-from-tests @cfleming why is this restriction to defn forms useful? i often need tests for defs or defmulti too. for example, 1. i might have some complicated computation in an rmap. 2. i need to test an interceptor, which has both an :enter and a :leave function, which are just inlined into a map, so it's practical to test them together. 3. i want to test the dispatch function a multimethod

onetom10:05:55

actually, based on the documentation, i should be able to navigate from a def too, since that's also "some other type of var".

cfleming19:05:15

Yes, you should be able to.

onetom01:05:49

i don't think such navigation ever worked for me and im using cursive for a few years by now

Leo E14:05:25

I tried it and I'm moving from the def form to the test namespace with Go to Test. If no ns exist, proposes to create new ns, but only with ns form, no deftest form created. True, not to the test function, as is the case with defn, but to the head of the file. Same as def behavour for defmulti and defmethod

Leo E21:05:04

Hi, all. Maybe somebody know. Is any way to work with internal variables in macros? Through a search I found a https://github.com/cursive-ide/cursive/issues/147 discussion that has been going on since 2013. In my case i have simple macro, but it's not fit any standard signature

(defmacro cond+ [& clauses]
  (when-some [[test expr & rest] clauses]
    (case test
      :let `(let ~expr (cond+ ~@rest))
      :do  `(do ~expr (cond+ ~@rest))
      :when-let `(when-let ~expr (cond+ ~@rest))
      `(if ~test ~expr (cond+ ~@rest)))))
And when i use it like this i can't navigate definition/reference var a or any other vars inside form
(cond+
    :let [a 1
          b 2]
    :when-let [c 3]
    :true a)
Also with enabled clojure-extras extension i see lint errors. But when i use https://github.com/clj-kondo/clj-kondo/blob/18448daa0ca2b53b2dddce5773f641bed3b5fc85/doc/hooks.md?plain=1#L270, all lint errors gone and linting work fine. But i still miss navigation between bindings within the form. In for example i can navigate from/to y binding
(for [x [0 1 2 3 4 5]
      :let [y (* x 3)]
      :when (even? y)]
  y)
@cfleming I understand that cursive have internal mechanics to recognizes these forms like for macro. Is there a way for me to also make my own resolution form? Or, ideally, if cursive to understand what i write in clj-kondo config? I made a small https://github.com/velios/idea-condplus for better explanation. P.S. I'm not a native speaker, so forgive me if my message doesn't seem polite enough.

Leo E06:05:26

I also decided to check and it works if clj-kondo configurated in vscode+calva, emacs+cider, even in idea+clojure lsp. Unfortunately clojure lsp not recommended to use with cursive in the same time. But anyway all this plugins have some mechanics to resolve navigation paths, maybe i miss something and cursive can do it too?

cfleming09:05:03

Unfortunately there still isn’t a good story in Cursive for this, sorry. You can disable the warnings within the form, but that’s about it at the moment. In order to support this I have to rewrite some very old bits of Cursive and make some large changes, and I haven’t gotten around to it yet. I’m planning to add support for https://github.com/Engelberg/better-cond, perhaps that would work for you?

Leo E11:05:22

Yes, signature like better-cond is definetely what i need. It may be inconvenient to ask about this, but are there any plans for when this will get into work?

Leo E11:05:38

I’m also wondering if I can resolve the signature like in better-cond if I don’t have a dependency on the better-cond library itself in my project? For example, if I want to add my own implementation, but at the same time I want cursive to treat it as if it were a better-code?

onetom15:05:25

we are also holding off on using better-cond exactly because we would lose symbol resolution and refactoring capabilities as a consequence. we also use the scope-aware highlighting of symbol references a lot. it's not a pressing issue, because there are only a handful of places in our code, which could significantly benefit from the better-cond style, but i have the feeling that i would use it more often, if cursive would understand it. it's a bit silly that we are being held back in utilizing such nice capabilities because of tooling issues... i wasn't aware it's possible to "disable the warnings within the form". maybe i should re-assess the situation.

Leo E16:05:41

@U086D6TBN Let's hope that this modification of the better-cond signature will not be too complex given the already existing solutions, for example for macro formats. Also, while I was figuring it out, I found out how to solve this problem in clj-kondo for better-cond and other custom macros resolving during linting. If you interested in it, you can check https://github.com/velios/idea-condplus in subj message. I'm like you interested to https://github.com/Engelberg/better-cond/tree/master?tab=readme-ov-file#minimizing-rightward-drift.

👍 1
Leo E20:05:45

@cfleming Should this be added somewhere else, like github, or have we discussed it here enough for it to appear sometime?

cfleming21:05:27

I’ll make sure the better-cond support arrives soon, and I definitely have a long-term plan for the general macro support.

👍 2