This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-28
Channels
- # announcements (2)
- # aws (21)
- # babashka (4)
- # babashka-sci-dev (17)
- # beginners (3)
- # cider (16)
- # clj-kondo (61)
- # clojure (122)
- # clojure-europe (11)
- # clojure-spec (3)
- # clojurescript (2)
- # conjure (19)
- # helix (9)
- # hyperfiddle (2)
- # inf-clojure (18)
- # lsp (12)
- # off-topic (15)
- # react (2)
- # releases (1)
- # shadow-cljs (40)
- # spacemacs (4)
- # tools-deps (5)
- # vim (15)
I have a problem with the clojure.repl/source
function in CIDER. Consider:
(ns omicron.core
(:require [clojure.repl :as repl]))
(defn foo [a] (inc a))
(repl/source omicron.core/foo)
When I eval this buffer in CIDER, it will print in the repl Source not found
, while if I require the file via clj
it will print the source. What could the problem be?when you eval code interactively, especially via a repl, the source is the repl, so it makes sense for the source not to be found What specific cider ops are you using to load code? Those that are related to files should preserve source info, and those that are more 'free form', not so much
I am using both cider-eval-buffer
and cider-eval-defun-at-point
. What should I be using instead?
cider-refresh is one that would almost certainly work, however if that's not your jam, I wouldn't want to suggest a change of workflow
probably cider-eval-buffer
/`cider-eval-defun-at-point` might be fixable although I'd imagine we cannot always guarantee that the file will be associated.
cider-eval-file
surprises me more, and it could make a stronger guarantee
Could you create a (single) issue for this? Perhaps it's never been implemented to begin with, IDK
Indeed, cider-ns-refresh
does the right thing. Yes, jump-to-source works (but I'm not sure which function is used to get that in doom emacs+lsp, so maybe that's not CIDER's merit)
I find this behavior counterintuitive because:
> (meta #'omicron.core/foo)
{:arglists ([a]),
:line 40,
:column 1,
:file "/home/carlo/code/clojure/omicron/src/omicron/core.clj",
:name foo,
:ns #namespace[omicron.core]}
so at some point we know that the var belongs to the file (and where)my point being that I would like cider-eval-defun-at-point
to try to associate the right informations, at least
yes indeed would be a bug as hinted in https://clojurians.slack.com/archives/C0617A8PQ/p1653749641225689?thread_ts=1653748360.112699&cid=C0617A8PQ
Here's the issue https://github.com/clojure-emacs/cider/issues/3210
I verified and described what has to be done. I might give it a shot, however I don't have much time in my hands (and other priorities for cider dev!) so this would be both a pretty easy task and a very appreciated one. Up to you :)
Thank you @U45T93RA6, much appreciated 🙌