This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-08
Channels
- # announcements (6)
- # atom-editor (1)
- # babashka (21)
- # beginners (70)
- # clerk (4)
- # clj-kondo (71)
- # clj-yaml (1)
- # clojure (54)
- # clojure-art (1)
- # clojure-denmark (1)
- # clojure-dev (1)
- # clojure-doc (1)
- # clojure-europe (31)
- # clojure-nl (1)
- # clojure-norway (41)
- # clojure-uk (15)
- # clojurescript (36)
- # conjure (1)
- # cursive (2)
- # datomic (14)
- # duct (10)
- # emacs (12)
- # etaoin (176)
- # gratitude (25)
- # hyperfiddle (17)
- # jobs (1)
- # juxt (5)
- # london-clojurians (1)
- # malli (3)
- # nbb (21)
- # off-topic (29)
- # reitit (12)
- # releases (2)
- # remote-jobs (7)
- # shadow-cljs (9)
- # testing (9)
Hi, I have updated Malli to the latest version and clj-kondo now reports “insufficient input” (that map in image for example).
This is the schema:
[:map {:closed true} [:name string?] [:description string?] [:created-by {:optional true} [:maybe string?]] [:id {:optional true} int?]]
Can you make a clj-kondo only repro that I can clone locally so I don’t have to copy or type code from screenshots? Then I’ll have a look later today
I don’t get this error in a new project, so I won’t even upload it. The definition in malli-types-clj/config.edn is same for both projects. I tried to delete clj-kondo .cache and also .lsp from the original project, no luck. Unfortunately I can’t share the original project and it is really complex, so there are a lot of variables. Do you have any idea where I could look?
If you can't make a repro, I can't help you fix it, unfortunately, but maybe you can downgrade malli and ask in #CLDK6MFMK - seems like a downstream problem
Interesting, the downgrade didn’t help. So I thought to delete .clj-kondo/metosin and it worked (with old and new version as well).
Hook question: I have a macro that acts like def
but takes a namespaced symbol and strips the namespace from it and then uses def
to make a var: (defrule style/some-var ...)
macroexpands to (simplified): (def some-var ...)
. i wrote a simple hook for this, and for some reason, clj-kondo/clojure-lsp seem to treat the whole block now as a single unit instead of parsing/analyzing each sub expression:
(ns hooks.noahtheduke.splint.rules
(:require
[clj-kondo.hooks-api :as api]))
(defn defrule-hook
[{:keys [node]}]
(let [[rule-name & body] (next (:children node))
node (api/list-node (list* (api/token-node 'def)
(api/token-node (symbol (name (api/sexpr rule-name))))
body))]
{:node node}))
that's a demonstration of "show docs" called on ->violation
displaying the docs for this whole top-level form
is there a better way to do this?
if I switch the hook to (api/token-node 'defrule)
instead of 'def
, then go to definition and show docs work but the whole form has an "unresolved symbol: sorted-rules-require" error
🤷 it's the api i've decided on, it's shortest and simplest and communicates the intentions
This is wrong:
(list* (api/token-node 'def)
(api/token-node (symbol (name (api/sexpr rule-name))))
I have "body" at the end, doesn't that expand properly?
I recommend using (println node)
before you return it, and then execute this on the command line
(defn defrule-hook
[{:keys [node]}]
(let [[defrule rule-name & body] (:children node)
new-node (api/list-node
(list* (with-meta (api/token-node 'def) (meta defrule))
(with-meta (api/token-node (symbol (name (api/sexpr rule-name))))
(meta rule-name))
body))]
{:node (with-meta new-node (meta node))}))
thank you for the help
I’ve got a clj-kondo/clojure-lsp issue with emacs. It stopped working. I did something, what I do not know. All components work in isolation, just not together. Deleting and reinstalling did not help. How do I go about troubleshooting this? I’m a little lost in where to start digging. Any advice is appreciated.
I could make a repro repo, but I think the issue is much deeper. I’ve gone into the repro repo I sent you when I had issues with defn-spec. It doesn’t work. I’ve messed something up at the global/emacs config level or something else deeper in the well than the project. That’s why I’m a little lost as to how I should continue
It lints
It gives me an output similar to linting filled with how not perfect my code is
I’m assuming that’s the same as moving my straight repos folder.?
you could try that one. @UKFSJSM38 knows where it is probably
Yes, and if it's a problem with not even starting clojure-lsp check this https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/
Lsp starts, the server info gives me a clojure-lsp version of 2.27, and lsp of 2.17, the classpath settings is nil.
scratch that, clj-kondo of 2.17
I can’t copy the server info, because I’m not sure how to open it in a proper buffer.
Duh, not a proud moment
:client-settings
{:dependency-scheme "jar",
:show-docs-arity-on-same-line? true,
:text-document-sync-kind nil,
:source-paths nil,
:source-aliases nil,
:cljfmt-config-path ".cljfmt.edn",
:document-formatting? true,
:document-range-formatting? true},
:project-root-uri "file:///home/pat/m",
:port "NREPL only available on :debug profile (`bb debug-cli`)",
:project-settings {},
:server-version "2023.02.27-13.12.12",
:clj-kondo-version "2023.02.17",
:log-path "/tmp/clojure-lsp.3157811663365747466.out",
:classpath-settings nil}
:client-settings
{:dependency-scheme "jar",
:show-docs-arity-on-same-line? true,
:text-document-sync-kind nil,
:source-paths nil,
:source-aliases nil,
:cljfmt-config-path ".cljfmt.edn",
:document-formatting? true,
:document-range-formatting? true},
:project-root-uri "file:///home/pat/m",
:port "NREPL only available on :debug profile (`bb debug-cli`)",
:project-settings {},
:server-version "2023.02.27-13.12.12",
:clj-kondo-version "2023.02.17",
:log-path "/tmp/clojure-lsp.3157811663365747466.out",
:classpath-settings nil}
It does. I’m doing a proper full on reinstall of my emacs deps as borkdude outlined. It feels like I must have messed something up with my emacs config, but for the life of my I don’t remember touching it.
@U036UJBDM5G I don't want to sound patronizing, but do you save your emacs config in version control? I even save my entire elpa directory in version control since 2013 haha
I have all my configs, but I git ignore my autodownloaded deps.
If that turns out to be my problem, I may jump on that ship.
It supposed to immutable like nix, but all I know is I just add :straight t to my use-package and it works.
I've had issues with .elc
files before, when I removed those, emacs re-compiled the .el
files and suddenly a problem was fixed
The same has happened with straight many times. This time I deleted andything with clojure in the name and it didn’t help, but it costs nothing to go further.
@UKFSJSM38 what was the minimal emacs project to install clojure-lsp / lsp-mode again? it helped me find the weird delay problem at the time
ah yes, @U036UJBDM5G you could try that file instead of init.el
and see if you can get things working
Well, no dice on the rebuilding emacs with fresh packages, and no dice on the minimal config.
I appreciate you both for coming out. HMU if you think of anything. I’m a frustrated dog, so maybe my dog and I should go outside for a walk with the beautiful weather we’re having. When I come back, I’m installing clojure-lsp and clj-kondo from source again, and launching with a custom command. That worked in the past. clojure lsp is there it just doesn’t seem to link with emacs, emacs knows it’s there, it knows my classpath. The problem lies somewhere in the middle.
A simple project usually helps a lot debug such issues, I recommend testing with my http://github.com/ericdallo/clojure-sample project
@U04V15CAJ @UKFSJSM38 Thanks for all the help. After no luck with building from source. I went nuclear rm -rfed the f out of everything I could find, then I reinstalled things just like the readme brought my custom config back in piece by piece. I wish I had something smart to say… I’m just happy I can use my tooling again. Side note, I’ve grown way to reliant on tooling to be comfortable. Keep up the good work. I appreciate the quality things you make.