-
Notifications
You must be signed in to change notification settings - Fork 176
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
Infer :style/indent
metadata
#787
Conversation
Moved to draft, it looks good but something is off from what I'm observing in local usage. |
Ready again! |
:else | ||
(some-> m :name namespace symbol)) | ||
str)] | ||
(not (or (string/starts-with? namespace-name "clojure.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need special handling for the built-in macros?
|
||
(def clojure-core (try (find-ns 'clojure.core) | ||
(catch Exception _e nil))) | ||
|
||
;;; Auxiliary | ||
|
||
(defn- var-meta-with-fn | ||
"Like clojure.core/meta but adds {:fn true} for functions and macros. | ||
(defn- inferrable-indent? [m] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we end up keeping this function (I'm not sure special handling for built-in namespaces is a good idea), let's add a docstring for it.
Thanks for the feedback! Added a commit, please check it out |
I get that clojure-mode has hardcoded indents for Clojure built-ins, but what about other clients? That's my main concern here. Probably that's something that should be handled in CIDER, not here. |
I'm not sure of how would I infer the style/indent for clojure.core macros:
|
...So it seems reasonable to me to not infer anything for this subset of macros. Which is worth emphasizing, does not change anything when compared to traditional cider-nrepl behavior (which always lacked indent inference) |
But some follow the standard naming for params (e.g.
I get this. I'm just trying to understand what makes those macros special. :-) |
Hmm, yes. But I'd have to check clojure.* macros one by one, to verify that they match with clojure-mode's hardcoded list. (any mismatch would be a pain) ...We could copy the whole clojure-mode list into If you are on board with that, I could do it.
(we could try parsing the .el file from Clojure for bonus DRY points) |
I don't want to open extra work for you. I guess for the needs of CIDER this makes sense and we can think down the road if we want to expand the inference. I can live with the PR in its current form. |
Cheers. It's certainly valuable to discuss these, anyway. I'll like to learn more about other cider-nrepl consumers, next months. I have the impression that they don't reach out to us much |
@PEZ (from Calva) is probably the person who communicates most with our team. Not sure if anyone monitors the tracker here, though. |
Implements #777
Most of the work was shipped in clojure-emacs/orchard#169