When I mentioned it previously, lots of people said there were affected by a regression in smartparens related to symbols ending with ?. Someone has raised a PR that fixes the issue, so if people can test and comment, that might help get it merged. https://github.com/Fuco1/smartparens/pull/1229
Tried it in doom emacs using
(package! smartparens
:pin "109b6fc684a96e3b52ed76ec68eec8c4052b9e61")
And it's not fixing the problemDid you forget some kind of rebuild/compile step? It works fine for me.
yes you're right, my doom emacs conf was bad. I should have been
(package! smartparens
:recipe
(:host github :repo "thatismatt/smartparens")
:pin "109b6fc684a96e3b52ed76ec68eec8c4052b9e61")
And now it's working fineIs there any way to auto-import or auto-suggest clojure imports based on an unresolved function in the code, so if I'd write (m/sqrt 4.0) it would suggest require [clojure.math :as m] or similar? And also update deps.edn?
the deps part not so much, but clj-refactor's "slash" (just hitting slash) does this, in a very fine-grained and configurable manner
If you try it, LMK how it went. It's smarter than one might think, e.g. it scans your projects so that it automatically infers your prefered conventions
It needs cider to work, correct?
Yeah, it works over nrepl where typically you'd have cider and refactor-nrepl middleware
I'm working on a cljojuredart project atm, but as soon as I have something in clojure, I'll try it and let you know. Thanks again
Nice! I know nothing about cljd. If it uses reader conditionals and a .cljd extension, we at cider would surely be happy to accomodate for changes (maybe it's not that simple? I could imagine)
unfortunately, cljd does currently not have a repl, so it's probably not feasible right now (but there's an ongoing discussion that this is on the roadmap)
@gregorybleiker You can take a look at my PR here https://github.com/clojure-emacs/clj-refactor.el/pull/559 It doesn't do anything smart, it just assumes common aliases.
BTW clojure-lsp supports that without the need of a repl, showing the usages count across the project https://clojure-lsp.io/features
I am sure this has come up before, but I haven't found it, is there some way to stop cider from messing with M-.? jump to definition with clojure-lsp works great until I have a repl started and it stops working until I track down the source file the definition is (which jump to definition would be really helpful for) and load it in the repl
Could you please submit a ticket with a small reproducer to https://github.com/clojure-emacs/cider? Maybe there is a way to merge the xref backends.
@alexyakushev They are just a functions in a list (like so many things in Emacs), that's why it's kind of hard to automagically handle this.
What would probably be easier is for our backend to react differently to the lsp-mode or eglot being active, but it is still hard to guess what each user would like to do in this case.
E.g. I'd probably prefer references from LSP, but I'd still want find definitions to come from CIDER, and so on.
From what I heard so far, it sounds like CIDER xref function acts as a catch-all even if it can't resolve the thing to jump to, and that stops other backends from working. Maybe something can be done about that.
Ah, perhaps something can be improved for the chaining, but this still depends on the ordering of the backends in the list of backends.
Or we can suggest putting the cider function to the end of the list. Anyway, a reproducer would be very helpful as a something to work with
I recall most issues reported in the past were along those lines, but I might be forgetting/missing something.
The documentation already linked to explains how to put the cider function at the end of the list (i.e. by setting cider-xref-fn-depth).
https://elpa.gnu.org/packages/xref-union.html exists for combining xref backends, but I haven't used it
https://github.com/clojure-emacs/cider/blob/master/cider-mode.el#L489 this behavior means even if I turn xref off for cider, it still hijacks M-. and turning off xref just means it attaches M-. to an even less useful behavior
Doesn't leaving it turned on, but giving it a lower priority than lsp do what you want? (To be clear: changing the priority/depth doesn't affect any buffers that xref-backend-functions is already set for, but only affects where in that list it'll be put in the future)
> (unless cider-use-xref
I'm not 100% sure, but I think the whole cider-use-xref thing was added as a cautious fallback because we weren't confident about the new xref backend vs the old established functionality. I think at this point we can remove the fallback and use xref exclusively. @bozhidar does it sound right?
ah, yes, it does look like adjusting the cider-xref-fn-depth gets what I want
@alexyakushev More or less - we also had to support older Emacs versions at the time. Fundamentally, the biggest problem remains that the find-references in CIDER is not considered very useful by most people. I'm guessing if we implement in terms of a simple text search it will probably be more useful to the majority of people. I recall that's what SLIME was doing (or rather swank-clojure).
on doom-emacs I do this:
(set-lookup-handlers! '(cider-mode cider-repl-mode) nil) ;; use lsp
which completely delegates definition to LSPyeah, I just figured out if I run (setq xref-backend-functions (cdr xref-backend-functions)) which punts cider's xref stuff out of the list my M-. starts working again
ah, there is a "cider use xrefs" customization and toggling that off unbreaks things. a pitty that information isn't merged properly from different sources
ugh, it is actually unclear if the xrefs customization did fix this, it seems like there is some buffer local state involved, and some of my buffers are working and some are not
arg, with a restarted emacs and xrefs customized to off for cider, when cider is running and I M-. on a symbol I get a "Symbol: " prompt in the mini buffer
when cider is not running it just works thanks to clojure-lsp
yeah, when you turn xrefs off for cider, it still hijacks M-. instead having it call cider's cider-find-var function
well I found the but of the cider keymap that does that and just commented it out 😕
The docs have a section about using LSP https://docs.cider.mx/cider/usage/misc_features.html#xref-integration
This disables CIDER's xref backend, which I assume is what you want to do.
This is what i use
(cider-xref-fn-depth 90)
(cider-use-xref nil)