Fork me on GitHub
#lsp
<
2022-01-24
>
tatut08:01:18

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?

all-clear 1
tatut08:01:44

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

lispyclouds09:01:06

I had to uninstall, untap and then reinstall with the tap. apparently brew is all confused with the recent release changes

tatut09:01:11

yeah, that worked

juhoteperi09:01:49

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.

1
anonimitoraf09:01:47

Try putting your config in ~/.lsp/config.edn

juhoteperi09:01:26

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.

anonimitoraf09:01:33

Oh yea whoops, I conflated the two

Lukas Domagala09:01:05

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.

juhoteperi09:01:47

Yeah but in this case the linter isn't part of clj-kondo so CI doesn't even run it. Or other users.

juhoteperi09:01:10

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.

Lukas Domagala09:01:43

ah sorry, didn’t even check which linter you are disabling 😅

ericdallo12:01:47

@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

juhoteperi12:01:55

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?

juhoteperi12:01:59

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.

ericdallo12:01:54

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

juhoteperi12:01:03

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

ericdallo12:01:23

could you check if clojure-lsp found the correct source-paths? you can check that via the https://clojure-lsp.io/troubleshooting/#server-log

juhoteperi12:01:08

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"}

juhoteperi12:01:36

But I guess clj-kondo is still being run for each module separately

juhoteperi09:01:44

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?

borkdude09:01:41

@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.

borkdude09:01:24

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

juhoteperi09:01:25

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.

borkdude10:01:23

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.

juhoteperi10:01:16

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.

borkdude10:01:43

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

ribelo14:01:32

@ericdallo I have a repo that always results in 100% CPU usage by lsp

ribelo14:01:50

maybe you are curious and would like to take a look

ribelo14:01:34

I generally never have problems, but as soon as I open this file, the laptop wants to fly away

ribelo14:01:16

:server-version "2021.11.02-15.24.47",
 :clj-kondo-version "2021.10.20-SNAPSHOT",

ribelo14:01:35

I see I have an old version of lsp 😕

ribelo14:01:45

but it may be useful anyway

ericdallo14:01:57

yeah, it'd be nice to try with recent clojure-lsp

borkdude14:01:42

also try to lint with clj-kondo only:

clj-kondo --lint $(clojure -Spath) --dependencies --parallel --copy-configs

ribelo14:01:56

clj-kondo only is almost instant

borkdude14:01:25

with those arguments?

ribelo14:01:29

I will update lsp and come back if nothing changes

ribelo00:03:26

@ericdallo nothing has changed in this matter

ericdallo00:03:13

You mean you are still seeing 100%cpu? What's the output of clojure-lsp --version?