This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-14
Channels
- # announcements (3)
- # babashka (189)
- # beginners (157)
- # calva (5)
- # cider (5)
- # clj-kondo (7)
- # cljdoc (34)
- # clojure (61)
- # clojure-dev (2)
- # clojure-europe (42)
- # clojure-nl (15)
- # clojure-poland (1)
- # clojure-spec (5)
- # clojure-uk (6)
- # clojured (2)
- # clojurescript (31)
- # clojureverse-ops (8)
- # component (2)
- # cursive (41)
- # datomic (15)
- # depstar (44)
- # figwheel-main (9)
- # fulcro (14)
- # holy-lambda (1)
- # inf-clojure (13)
- # introduce-yourself (1)
- # jobs (1)
- # lsp (98)
- # malli (12)
- # off-topic (12)
- # pedestal (1)
- # polylith (3)
- # re-frame (51)
- # reitit (4)
- # releases (1)
- # reveal (5)
- # shadow-cljs (3)
- # tools-deps (56)
- # vim (12)
- # xtdb (36)
@ericdallo heh, no problem mate. I had the opportunity to learn how to create/upgrade packages in NixOS, which I've been using for a while now. How awesome is that!
What is the situation with PR in NixOS? If I update nixpkgs with the latest version of clojure-lsp
can I push it to GH, or will it get lost in the clutter of hundreds of other PRs and you won't even notice it?
Usually there is no PR conflicts with the same package, but it's a good idea search for the PR before you open it
I've recently learned about tool to track which channel contains specific PR https://nixpk.gs/pr-tracker.html?pr=130038
Hello guys, I am using calva in VS Code and I am trying to get all references of a function, inside our project. The problem is that it seems that not all projects are evaluated, my reasoning behind it is that when I use the shortcut shift + f12
I don't get all of the calls of the function. When I evaluate a different project then I get a list of the function references. The project I am working on is like a pomegranate, its a project with multiple smaller projects inside. ( I haven't worked on any other projects, so I don't know if this is the classical project)
I never heard of pomegranate but I suppose it's a kind of monorepo project right? Similar to polylith and lein-monolilth?
You should probably import the mono-repo root as the project root, which means open the project root with Calva/VSCode instead of the subprojects
Also, if you could do a mini-repro I could test to check if clojure-lsp works nice with that pomegranate
The whole project is a collection of subprojects so a mono repo is partly correct. Each subproject is small enough that it doesn't need a separate repo. I attempted to do what you told me. It solved some of my problems, but it seems that some namespaces are not included, which is interesting, but still thanks the non included namespaces are not that important
I minimal repro would help a lot understand the project structure and the deps between them, but in general: If a subproject depends on another subproject/you want to go from one to another you probably want to open the project that contain the subprojects as root, but you would need a deps.edn or project.clj with all the subproject deps
otherwise, opening each subproject as a single project would work as well, but you would not be able to go from one prject to another using LSP features
for example, in a lot of dev
namespaces, there are functions that aren't referenced at all
but you don't care if the function is used or not, but you would like to exclude them on a case-by-case basis
perhaps supporting/honouring/variant of the same ignore thing that clj-kondo does, but for clojure-lsp would be neato?
and instead of it being in a config.edn file, it can be done when editing the code and inserting an ignore
it's very similar to how intellij works with java/kotlin in allowing you to ignore certain lines in the file, whilst in the file - no external config.
or perhaps the linter could be moved to clj-kondo and you can just use the clj-kondo comment
that would work 🙂 then there is only one place where the linting goes on and thus only one way of ignoring things 🙂
the lsp linter is based on data from clj-kondo anyway. the only problem is that clj-kondo hasn't got an idea of "project", the scanning of the project is done by lsp by invoking clj-kondo, so it behaves like a lower level tool
if you lint with --dependencies
clj-kondo could be fairly sure it's seen the entire project after that
is it hard to add comment maps like the kondo one to clojure-lsp? I suppose it just uses rewrite-clj?
perhaps some metadata like ^:export
to mark vars as always used could also work :thinking_face:
clj-kondo also has a more fine grained one #_{:clj-kondo/ignore [:unused-binding]}
but I think most people use the "global" one
A good start indeed 🙂 I would like, at some point, in a future iteration to support a vector of unused things, for perhaps there are things I do want to ignore, but not others. A future iteration for sure! 🙂
yes, so user can use the global one to suppress the unused public var, but if there is some unused arity lint, it'll keep returning the diagnostic
the global one seems a good start, I'll open an issue on clojure-lsp to support the #_:linter/ignore
one, does that pattern makes sense for clj-kondo as well @U04V15CAJ?
I have a user
namespace in dev/user.clj
and I've changed the signatures of 2 functions from zero args to 1 arg. lsp / clj-kondo is reporting invalid-arity warnings.
My assumption is that some kind of cached version of these functions are being referenced. If so, how do I update lsp / clj-kondo ?
there is a flag to enable update the diagnostics on the references of a changed function, but it's not enabled by default for performance issues
Would this issue be because I dont have dev/
directory in the class path?
:notify-references-on-file-change
the setting I mentioned, but not sure is that your problem
Nope.. adding dev/
directory didn't resolve the issue (but I needed to do that anyway for other things).
How do I clean the cache ? Happy to do this destructively 🙂
Well rm -rf .lsp
I guess 🙂
My code isnt quite bad enough yet to delete it all :rolling_on_the_floor_laughing:
Ah, I had old definitions of those functions in a (comment ,,,)
block at the bottom of the file that were being picked up.
I assume there is some key to instruct lsp / clj-kondo to ignore the contents of a comment block - obviously not the :redefined-var
key I was using
clojure-lsp consider the latest definition of a var like clojure, but it doesn't consider if the var is inside a comment block, it'd not be that easy to implement that
😭 Oh, I use a lot of comment blocks, so I will keep this in mind. Thanks for your help
I see there is a :skip-comments false
configuration, I'll try that in my global clj-kondo config (assuming I have one)