cursive 2025-05-29

Is it possible to get cursive to recognize <> as a special symbol in swiss.arrows threading macros? https://github.com/rplevy/swiss-arrows

@shaunlebron use https://github.com/akovantsev/archery _> _>> and _ instead :) trick there is to refer that _ placeholder:

(ns com.akovantsev.archery
...

(def _ (symbol "_"))
(ns foo.bar
 (:refer-clojure :exclude [-> ->> some-> some->>])
 (:require
  [com.akovantsev.archery :refer [some_>> _>> _] :rename {_>> ->, some_>> some->}]

                                              ^

(ns swiss.arrows)
...
   (cond (> c 1) (throw (Exception. "No more than one position per form is allowed."))
unusable :D

thanks, unfortunately indentation isn’t the problem and its behavior is distinct from clojure’s normal arrow functions. <> controls where the argument is inserted

ahhh, so it's sort of an anaphoric as->, right? In that case, based on the docs, it seems like the best solution currently offered is to resolve -<> as 'none', which purports to basically turn off complaints about unresolved symbols in the scope of the macro

oh yes as-> is a better comparison, and you can omit the special symbol (the anaphor? had to look that up, nice)

another option would be to (declare <>) somewhere, so that cursive recognizes the symbol - I've seen a similar thing in tests with clojure.test where people declare 'thrown?' and 'thrown-with-msg?' to keep the syntax highlighter happy. That does mean changing the source to satisfy the tooling though, so that might be too distasteful for you.

I think it should be possible to right-click or alt+enter on the symbol and get "resolve -<> as ...", and then tell cursive to treat it like an arrow (for purposes of indenting)