This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-24
Channels
- # announcements (3)
- # aws (5)
- # babashka (10)
- # beginners (61)
- # calva (22)
- # clara (9)
- # clj-kondo (8)
- # cljdoc (8)
- # cljsrn (15)
- # clojure (44)
- # clojure-australia (2)
- # clojure-europe (31)
- # clojure-hungary (20)
- # clojure-nl (5)
- # clojure-uk (3)
- # core-logic (2)
- # cursive (2)
- # data-science (2)
- # datalevin (4)
- # datascript (6)
- # datomic (17)
- # defnpodcast (1)
- # figwheel-main (1)
- # fulcro (18)
- # graalvm (2)
- # introduce-yourself (2)
- # jobs (1)
- # jobs-discuss (59)
- # lsp (44)
- # music (1)
- # nrepl (2)
- # off-topic (26)
- # pedestal (2)
- # re-frame (12)
- # reagent (27)
- # releases (1)
- # remote-jobs (4)
- # rewrite-clj (2)
- # sci (12)
- # shadow-cljs (12)
- # sql (10)
- # uncomplicate (6)
- # vim (12)
- # xtdb (2)
Error: clojure-lsp-native: /usr/local/Homebrew/Library/Taps/clojure-lsp/homebrew-brew/clojure-lsp-native.rb:4: syntax error, unexpected <<, expecting end
<<<<<<< HEAD
^~
/usr/local/Homebrew/Library/Taps/clojure-lsp/homebrew-brew/clojure-lsp-native.rb:13: syntax error, unexpected ===, expecting end
=======
^~~
/usr/local/Homebrew/Library/Taps/clojure-lsp/homebrew-brew/clojure-lsp-native.rb:22: syntax error, unexpected >>, expecting end
>>>>>>> 420687c (Bump to versio...
^~
...
tried brew upgrading clojure-lsp-native, it seems there's some git conflicts... is this a problem on my end?
brew upgrade clojure-lsp-native
Running `brew update --preinstall`...
error: could not apply 420687c... Bump to version: 2022.01.20-14.12.43
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 420687c... Bump to version: 2022.01.20-14.12.43
I had to uninstall, untap and then reinstall with the tap. apparently brew is all confused with the recent release changes
Hey, is there a way to disable :clojure-lsp/unused-public-var
linter for all projects at once?
I don't like committing user specific config to project repos.
Try putting your config in ~/.lsp/config.edn
This needs to be put into Clj-kondo config file.
But aha, ~/.config/clj-kondo/config.edn
works. For some reason I had previously tried to use ~/.clj-kondo/config.edn
as the global kondo config but that was wrong path.
Oh yea whoops, I conflated the two
IMHO if a project makes the decision to ignore certain lint warning its good to have that in the project config. That way all contributors know it’s an actual design decision + its easier to throw a lint pass into CI at a later date.
Yeah but in this case the linter isn't part of clj-kondo so CI doesn't even run it. Or other users.
I already have CI setup to run kondo on pretty much all projects, and most without any warnings, so getting new errors on the editor which aren't part of kondo setup run by CI is inconvenient. Especially as this linter seems to give lots of false positives.
ah sorry, didn’t even check which linter you are disabling 😅
@juhoteperi I'm always trying to improve that linter false positives, like not warn on Potemkin apis etc, LMK if there is a case that makes sense to not warn
One case I see is protocol method is marked unused though there are reify calls implementing that method: https://github.com/metosin/reitit/blob/master/modules/reitit-core/src/reitit/coercion.cljc#L14 But might be also that it is only used in other Reitit modules and those are maybe not registered as uses properly?
In some cases the warnings might be real, but the functions are part of public API but there isn't test case for those because they are just calling another function which is the one that is tested.
yes, it seems clojure-lsp is not "seeing" that submodule, make sure you configure it properly with :source-aliases
and :source-paths
https://clojure-lsp.io/settings/#source-paths-discovery
I'm running clojure_lsp on the Reitit root, which contains all the source paths: Client: clojure_lsp (id: 1, pid: 1221649, bufnr: [1, 14, 11, 41, 37, 35, 48, 44, 38, 40, 36]) filetypes: clojure, edn autostart: true root directory: /home/juho/Source/metosin/reitit cmd: clojure-lsp
could you check if clojure-lsp found the correct source-paths? you can check that via the https://clojure-lsp.io/troubleshooting/#server-log
2022-01-24T12:58:29.417Z INFO [clojure-lsp.source-paths:192] - Automatically resolved source-paths from project.clj: #{"modules/reitit-ring/src" "test/clj" "modules/reitit-middleware/src" "modules/reitit-core/src" "modules/reitit-swagger-ui/src" "modules/reitit-frontend/src" "src" "src/main/clojure" "modules/reitit-malli/src" "modules/reitit-http/src" "modules/reitit-swagger/src" "modules/reitit-interceptors/src" "modules/reitit/src" "modules/reitit-dev/src" "modules/reitit-sieppari/src" "test/cljc" "modules/reitit-schema/src" "modules/reitit-pedestal/src" "modules/reitit-spec/src"}
But I guess clj-kondo is still being run for each module separately
Is there good way to configure clojure-lsp to work with "multimodule projects" (like Reitit) where you have n+1 modules with project.clj (or such) for publishing, but for development you want to always run against root project (this is also one from where the REPL is started)?
Like Reitit has root project.clj and modules/reitit-core/project.clj. I start REPL from the root folder and I'd like to have all dev config there. If I understand correctly, the LSP client will control which folder to start lsp servers for?
I already have nvim configured with a custom function to find the project, so it will ignore folders with project file if the file is contained in a directory under "modules" folder. This is quite inconvenient and doesn't work for other folders names, but I guess there aren't many such projects. With this setup I get one Lsp server for Reitit, instead of 15 processes. Or maybe there is a better solution?
Another problem with Reitit is that even with this setup, looks like clj-kondo is always looking for the config file in the module directory, instead of the root project folder. I think without Lsp clj-kondo used the root config because that is the first .clj-kondo/config.edn
found, but maybe clojure-lsp is setting the folder for clj-kondo?
@juhoteperi clojure-lsp works with the concept of a project root. this root is almost always the same directory as where your deps.edn
etc lives and this is also where .clj-kondo/config.edn
should live.
having said this, you can make a shared clj-kondo configuration for all your project by putting those in a separate directory and then adding that directory to :config-paths
in .clj-kondo/config.edn
in all your projects in the repo
Yeah, project root is what I have configured in nvim. Both modules/reitit-core/src/reitit/core.cljc and modules/reitit-http/src/reitit/http.cljc use "root" project.clj and root lsp server, but neither use root .clj-kondo/config.edn. modules/reitit-core/.clj-kondo/config.edn would be used, if I create that.
you can refer to other configs using :config-paths
, that works relative to the "current" config.edn
, it also supports ../../foo/bar
etc. I think you could make it work using that.
Okay. Seems like I can reproduce this with just calling clj-kondo from terminal. Maybe the vim plugin I previously used always called clj-kondo on the Reitit root folder (vim working directory), instead of the first folder with a project file, so I didn't notice this.
yeah, similar to the flycheck plugin perhaps. flycheck sets the cwd to the parent of the file being edited and then the behavior is: the first .clj-kondo directory encountered towards the root
@ericdallo I have a repo that always results in 100% CPU usage by lsp
I generally never have problems, but as soon as I open this file, the laptop wants to fly away
also try to lint with clj-kondo only:
clj-kondo --lint $(clojure -Spath) --dependencies --parallel --copy-configs
@ericdallo nothing has changed in this matter