-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require/eval fails when the folder hierarchy isn't typical for a Clojure project #44
Comments
@daveyarwood Did you try to specify let g:acid_alt_paths = ['src/backend', 'src/frontend'] After telling your paths to Acid, However, I agree with your opinion that it is better to parse the |
Parsing the file for the ns, when I wrote acid, was probably more complicated than figuring out with the paths. Take for example this top part of a clojure file: ;; TODO This file should be merged with sample.utils
(ns sample.tools) Or this sample from eftest: (ns ^:eftest/synchronized foo.core-test (:require [clojure.test :refer :all] [foo.core :refer :all])) Or even a hypothetical poorly formatted file: (
ns something) None of those would reliably give me a ns unless I parse/interpret clojure, which is something that feels very hacky to do in Python. I can give another shot. I won't remove the path-based ns finding since this is the most reliable way (obviously, when everything is configured), but I'm open to suggestions for the cases above. Cheers |
You can use nrepl to query for the classpath, and use that as your roots (after filtering out jars). |
@rinx Specifying @hkupty I see your point about parsing the |
@SevereOverfl0w Could you elaborate? I like the idea of outsourcing to the nrepl. |
I think cider provides a classpath op, it will return a list which is the classpath. If you filter it to just directories, it should give you back a list like You may have a few false-positives (e.g. /home/dominic/.gitlibs/edge/foo.bar) but they don't really matter for calculating the ns that should be used. |
Amazing! I'll try that. |
Since updating recently, I am no longer seeing evaluation results in the buffer. Running
:AcidRequire
and then usingcpp
to evaluate a form has no visible effect.I noticed that when I press
cqp
to get the prompt, the namespace is incorrect. In this particular project, I have afrontend
folder and abackend
folder, and acid appears to be incorrectly prefixing the namespace withbackend.
:;; should be `geir-backend.main-class` backend.geir-backend.main-class=>
From
/tmp/acid-log-handler.log
:I tried doing the same thing in another project with a "standard" Clojure folder hierarchy, and there is no problem, so this appears to be a bug where acid uses the file path to determine the namespace name. I think it should probably parse the
ns
declaration at the top of the file instead?The text was updated successfully, but these errors were encountered: