Fork me on GitHub
#helix
<
2023-05-03
>
timrichardt17:05:17

A question to emacs users. How do you get defnc to render as a defn ? I made LSP aware of helix adding :lint-as {helix.core/defnc clojure.core/defn} , but emacs does not render the doc string in the right color.

zane17:05:29

Do you have CIDER connected + that namespace evaluated?

zane17:05:45

Odd. That usually takes care of it for me.

timrichardt17:05:16

Okay, do by chance have your docstrings and strings the same color?

zane17:05:24

Wait. I was wrong.

zane17:05:44

defnc seems to render correctly for me without CIDER.

zane17:05:57

Might you be using an outdated instance of clojure-mode?

zane17:05:17

If it helps, I’m not using LSP.

zane17:05:00

I am using clj-kondo, and have the same :lint-as declaration you do in .clj-kondo/config.edn.

timrichardt17:05:45

Ah, I think LSP uses kondo, too. Thanks for the pointers, hope I can get it working too.

2
zane17:05:47

> same color No, different colors for each. defnc is jusing font-lock-keyword-face, and docstrings are using font-lock-string-face.

hifumi12318:05:56

iirc there is a custom hook for defnc, which may provide the proper coloring

rafaeldelboni18:05:40

Usually clojure-lsp downloads for me automatically some kondo config files for the libs I'm using, this is what it downloads for helix: https://github.com/rafaeldelboni/clojuredocs-helix/blob/main/.clj-kondo/lilactown/helix/clj_kondo/lilactown/helix.clj#L29

timrichardt19:05:10

> clojure-lsp downloads for me automatically some kondo Yes, for me too. Didn't notice the new .clj-kondo directory and I didnt reload the lsp after adding helix. After reloading, linting works without any customization.

🆒 4
timrichardt21:05:09

But M-x describe-face still says font-lock-string-face for me. :melting_face: It should be font-lock-doc-face. I've attached a minimal emacs conf that just installs LSP.

emacs -q -l docstring.el

timrichardt22:05:44

> docstrings are using font-lock-string-face. @U050CT4HR I did miss right away that you wrote -string-face. It's -string-face for me too, but it should be font-lock-doc-face. So everything seems consistent. Haven't had a look into clj-kondo yet, but it looks like passing the bare docstring in analyze-definition isn't enough for the full defn experience. https://github.com/lilactown/helix/blob/68c7d38113155603f1df47b9e0c22315ff576af4/resources/clj-kondo.exports/lilactown/helix/clj_kondo/lilactown/helix.clj#L47

2