This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-15
Channels
- # announcements (27)
- # architecture (15)
- # aws (2)
- # babashka (5)
- # beginners (77)
- # calva (42)
- # cider (22)
- # clj-kondo (47)
- # cljfx (7)
- # clojure (66)
- # clojure-australia (1)
- # clojure-europe (32)
- # clojure-france (10)
- # clojure-israel (2)
- # clojure-italy (1)
- # clojure-nl (8)
- # clojure-uk (53)
- # clojurescript (29)
- # conjure (28)
- # core-async (2)
- # cursive (26)
- # data-science (1)
- # datascript (11)
- # datomic (33)
- # emacs (4)
- # fulcro (5)
- # girouette (3)
- # helix (1)
- # jobs (2)
- # leiningen (17)
- # luminus (2)
- # malli (15)
- # music (2)
- # off-topic (51)
- # pathom (3)
- # rdf (91)
- # remote-jobs (1)
- # reveal (7)
- # sci (6)
- # shadow-cljs (10)
- # spacemacs (3)
- # sql (23)
- # tools-deps (52)
- # uncomplicate (2)
- # vim (3)
- # xtdb (9)
in our codebase we use a macro for setting up ns aliases without having to require the ns the alias resolves to (for the purpose of namespaced keywords, see https://ask.clojure.org/index.php/2817/lighter-weight-aliasing-for-keywords)
until now, we used clj-kondoโs :unresolved-namespace
to not warn about usages of those aliases, which we mostly use for only a handful of namespaces. but Iโm wondering if I can use the hooks to make it actually lint correctly
my best guess would be to use the hooks to transform our macro which sets up the alias to a
(require '[foo.bar :as bar])
node, as aliasing with require
does work with kondo. would this be a viable approach?since your company is sponsoring clj-kondo, would you like to have access to the private sponsor channel?
Trying to use clj-kondo (v2021.01.20) with IntelliJ Ultimate 2020.3.2 and Cursive 1.10.1-eap2-2020.3 with File Watchers as instructed here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/editor-integration.md For some reason I can't see clj-kondo warnings in editor. Trying LSP next.
The clj-kondo LSP jar should work. I am not a Cursive user myself. What I wonder about is if the clojure-lsp plugin works for IntelliJ as well. That would be super awesome, since you get clj-kondo + many other things for free. @ericdallo?
Oh, god.
LanguageServer for definition
rawCommand : java -jar /mnt/ssd2/local/bin/clj-kondo-2021.02.13-standalone.jar
not initialized after 15s
Check settings
Programming Clojure without clj-kondo is not worth living - I open my veins. ๐Ah, I just realized. It's not the lsp version.
LSP integration with IntelliJ / Cursive works nicely. I just first didn't realize that I get the warning tooltips only when I first click the yellow triangle in the upper right corner of the editor:
Stupid me. ๐
@borkdude it should work ๐ https://clojure-lsp.github.io/clojure-lsp/clients/#intellij-cursive
using that Intellij-lsp
plugin: https://github.com/gtache/intellij-lsp
@kommen yes, (api/list-node (list* (api/token-node 'quote) ...)))
something like this
yes, weโre using it, very useful. but I donโt see the connection on how this helps me here?
but the nice thing: with that hook for the macro now also lsp-find-references
understands the aliases weโre setting up with it. this is so awesome
is there a kondo-based "find usages" thing? Maybe one that I can invoke from the repl? (clj-refactor offers this but it doesn't scale gracefully with project size)
other than that, you can also use the raw :analysis output (exactly the output that clojure-lsp uses)
guess I'll wait for https://github.com/clojure-lsp/clojure-lsp/issues/215 then :) and yes I suspected one can use :analysis - it's simply a matter of putting the time (which someone else might have invested already)
There will be a talk about clojure-lsp Wednesday at the Dutch Clojure Meetup. 20:00 GMT+1
@vemv If I understand correctly, you want to leverage the logic from clojure-lsp from the REPL right? That may make sense, maybe clojure-lsp could publish part of their thing as a normal Clojure lib
Yes, I'm thinking on this and refactoring clojure-lsp code step by step to make this possible on the future ๐
I'm also interested in this. Was actually browsing through clj-lsp's source to find some entry point ๐ . (Stuck with raw analysis for now)
@UHJH8MG6S I'm thinking about start exposing basic features first, like find-defintiion/references, but still need some hammock time
It might also be cool to do this from the cmd line, like:
clojure -X clojure-lsp/find-usages :var 'foo/bar'
or something.I think a few of these functions could also live in clj-kondo proper, so you would do something like:
clojure -X clj-kondo.tools/find-var-usage :var 'foo/bar' :lint '...'
but there you would need to pass clj-kondo the (class)paths of the sources to analyze.@vemv Made a POC with commit 6451d5a22bd6bab3098f854d4c50dc704c709f9e
$ clojure -X clj-kondo.tools/find-references :var clojure.core/juxt :lint '["src"]'
{:references
[{:fixed-arities #{1 3 2},
:name-end-col 53,
:name-end-row 301,
:name-row 301,
:name juxt,
:filename "src/clj_kondo/impl/analyzer/namespace.clj",
:from clj-kondo.impl.analyzer.namespace,
:col 49,
:name-col 49,
:from-var analyze-require-clauses,
:arity 2,
:varargs-min-arity 3,
:row 301,
:to clojure.core}
...]}
Looks cool! I'll try to make something like that using the already existing queries on analysis
I think I have a more flexible idea for the command line than building this inside clj-kondo, since everyone is going to want something slightly different anyway. Babashka script to the rescue! https://gist.github.com/borkdude/841d85d5ad04c517337166b3928697bd