Fork me on GitHub
#cider
<
2020-11-01
>
frederic18:11:38

Hi, silly question: I have a deps.edn project with a directory structure where the foo namespace would be in the src/main/foo/bar.clj file. But when I create that file in Cider, it adds a (ns main.foo.bar) namespace declaration instead. Is there some configuration I can tweak so that it generates a (ns foo.bar) form instead?

practicalli-johnny20:11:28

It seems unusual to have a directory under src that is not part of the namespace. I would remove the main directory if its not part of the namespace and problem solved.

practicalli-johnny20:11:58

Otherwise, if you keep main directory, I assume you have had to set :paths ["src/main"] configuration in the project deps.edn file to make the code run with a namespace without main (otherwise I assume it will fail if run on the command line or as a jar)

frederic22:11:01

I agree that it's unusual.

frederic22:11:44

:paths is already set to ["src/main"] , and the code runs fine

frederic22:11:00

I'm just trying to find out if there is a way to make Cider work a little better with the existing code base

practicalli-johnny01:11:51

If the namespace is being added automatically when a new file is created in cider, then it's clj-refactor at work. The namespace is not added if clj-refactor is not enabled. So take a look at that project for options. Also try the clojure-mode refactoring to manually add the namespace, see if that respects the path set in the deps.edn file

frederic10:11:55

Oh, that would explain why I didn't find anything in the cider docs 😅 Thank you!