This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-09
Channels
- # aws (3)
- # babashka (48)
- # babashka-sci-dev (1)
- # beginners (143)
- # calva (62)
- # clj-kondo (6)
- # clj-otel (3)
- # cljs-dev (59)
- # cljsrn (4)
- # clojure (39)
- # clojure-austin (5)
- # clojure-europe (60)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-romania (4)
- # clojure-spec (3)
- # clojure-uk (2)
- # clojurescript (32)
- # datomic (17)
- # events (3)
- # figwheel-main (4)
- # graphql (3)
- # gratitude (2)
- # holy-lambda (52)
- # introduce-yourself (3)
- # jobs (1)
- # juxt (5)
- # kaocha (2)
- # lsp (33)
- # nyc (3)
- # off-topic (9)
- # other-languages (4)
- # overtone (1)
- # portal (21)
- # reitit (2)
- # remote-jobs (5)
- # shadow-cljs (65)
- # tools-deps (2)
- # xtdb (8)
Upon adding a missing libspec, LSP changes the formatting of the ns
form. Is that an opinionated change on LSP’s side or is it following some cljfmt config that I’m not aware of?
Before
(ns foo
(:require [clojure.spec.alpha :as s])
(:import [java.util Date])
After
(ns foo
(:require
[clojure.spec.alpha :as s])
(:import
[java.util Date])
@U3RBA0P4L check here: https://clojure-lsp.io/settings/#ns-inner-blocks-indentation
clojure-lsp does that as default because it's the recommended by clojure style guide, but since it's common to have that formatting as well like Nubank has, clojure-lsp allows you to use it as well
Interesting, thanks! I didn’t know that clojure-style-guide encouraged the line break. I don’t have a strong opinion so now I’ll consider adopting it.
It’ll be hard to enforce though since cljfmt apparently doesn’t support formatting ns forms
Hi guys! anyone could point me how clojure-lsp could use the :node
conditional reader instead of :clj
one?
my clojure ns contains following required namespace
#?(:browser
(:require
[com.kubelt.lib.http.browser :as lib.http])
:node
(:require
[com.kubelt.lib.http.node :as lib.http])
:clj
(:require
[com.kubelt.lib.http.jvm :as lib.http]))
and inside the ns there is (lib.http/->HttpClient)
but i got Unresolved namespace lib.http. Are you missing a require? [unresolved-namespace]
and my ns com.kubelt.lib.http.node
exists in the proper place/folder
It seems that it always tries to read the :clj
ns, thus when i navigate to lib.http i go to com.kubelt.lib.http.jvm
I'm not aware there was a :node conditional reader 😂 , does clj-kondo support it as well @U04V15CAJ?
yep I imagine it's related with shadow-cljs 🙂
could be any workaround for that kind of projects?
maybe you could add a :cljs
conditional duplicating those requires, not sure how bad would be that tho
There is already a :cljc {:features [:clj]}
config which only lints the project for clojure
but we would need :cljc {:features [:node :browser :clj]}
and some mapping that tells clj-kondo what :node
means, e.g. :cljc {:lint-feature-as {:node :cljs}}
sure!
seems much better now 🙂