Fork me on GitHub
#lsp
<
2024-01-14
>
hifumi12309:01:47

Does clojure-lsp have a linter like :consistent-alias that works across a project? I want to be able to use clojure-lsp to analyze all of the Clojure files in a project and ensure that they consistently alias a namespace (if they require it)

ericdallo14:01:54

clojure-lsp uses clj-kondo under the hood, so you could just configure your linter in the clj-kondo settings and clojure-lsp when limiting your project will already consider it

Lemonski09:01:29

Hello, everone i am using lsp-mode in Emacs with clojure-lsp which as far as i know use clj-kondo under the hood. But for some reason i dont know why UIX is not recognized and gives unresolved symbols etc. I've already use the clj-kondo --lint "$(clojure -Spath)" --copy-configs --skip-lint command to import the clj-kondo, but i still see these

lassemaatta10:01:32

just to double check: does your project/.clj-kondo/ contain the copied config files from uix (https://github.com/pitch-io/uix/blob/master/core/resources/clj-kondo.exports/com.pitch/uix.core/config.edn)?

borkdude10:01:48

maybe restart lsp?

borkdude10:01:04

lsp will import the configs automatically btw

borkdude10:01:12

lsp-workspace-restart

Lemonski10:01:19

@U0178V2SLAY I got the this config.edn in project/.clj-kondo and in home .clj-kondo imported but still doesnt work @U04V15CAJ i tried restart lsp-workspace but did not helped. I got no fancy setup just hookup lsp on clojurescript and clojure mode thats it, lsp mode itself seems to work fine. clojure-lsp and clj-kondo is installed.

borkdude10:01:22

can you try linting the file from the command line with clj-kondo?

Lemonski10:01:30

I guess then something with my clj-kondo is wrong? clojure-lsp --version is --- clojure-lsp 2023.10.30-16.25.41 clj-kondo 2023.10.21-SNAPSHOT

borkdude10:01:34

Did you double check what @U0178V2SLAY said?

borkdude10:01:01

you don't need to have clj-kondo installed for clojure-lsp since it bundles its own copy of it, the version difference doesn't matter here I think

borkdude10:01:28

can you show the output of:

ls -la .clj-kondo

Lemonski10:01:06

In Home directory (i thought that would be enough to have it here. And the second screenshot is from project directory.

Lemonski10:01:13

From project directory

borkdude10:01:49

this is not in the home directory, it should be in your project directory

borkdude10:01:26

in fact

~/.clj-kondo
isn't used at all, the global config directory is ~/.config/clj-kondo

borkdude10:01:19

if you have uix in your deps.edn, then lsp will copy those configs on startup (at least, it should)

Lemonski10:01:02

It is in the deps.edn, but if i remove the .clj-kondo folder which i added by hand and restart everything, there gets no .clj-kondo folder added to the project folder. well i guess something is wrong configured which does not have anything to do with the lsp my best guess 😮 - Thx for the fast answers! 🙂

borkdude10:01:21

you should not remove the .clj-kondo directory, the .clj-kondo is a sign for clj-kondo where the project root it

borkdude10:01:10

just do as follows in your project:

mkdir -p .clj-kondo
clj-kondo --lint "$(clojure -Spath)" --copy-configs --dependencies --skip-lint

borkdude10:01:10

and then lint your core.cljs file

Lemonski10:01:38

Same result, in the .clj-kondo now it is a com.pitch folder with config.edn inside

borkdude10:01:18

and when you lint your core.cljs file now on the command line?

borkdude10:01:44

can you push this project, including .clj-kondo directory (without .cache ) to github? then I will have a look

Lemonski11:01:49

I aprreciate your time, but i guess i already wasted to much time 😮 for my starter project i used the command stated here https://github.com/pitch-io/uix-starter/tree/main npx create-uix-app@latest my-app # bare-bones project BUT if i just cloned the git repo the project itself, it seems to work, i guess i just have to compare those now

borkdude11:01:12

ok, I'll try - don't worry, we'll figure it out ;)

borkdude11:01:11

After doing the npx thing:

$ clj-kondo --lint src/app/core.cljs
linting took 65ms, errors: 0, warnings: 0

borkdude11:01:25

borkdude@m1 /tmp/dude/my-app $ clj-kondo --lint "$(clojure -Spath)" --copy-configs --skip-lint
Downloading: com/pitch/uix.core/1.0.1/uix.core-1.0.1.pom from clojars
Downloading: com/pitch/uix.dom/1.0.1/uix.dom-1.0.1.pom from clojars
Downloading: com/pitch/uix.dom/1.0.1/uix.dom-1.0.1.jar from clojars
Downloading: com/pitch/uix.core/1.0.1/uix.core-1.0.1.jar from clojars
Configs copied:
- .clj-kondo/com.pitch/uix.core
linting took 73ms, errors: 0, warnings: 0
borkdude@m1 /tmp/dude/my-app $ clj-kondo --lint src/app/core.cljs
linting took 51ms, errors: 0, warnings: 0

Lemonski11:01:51

I just pushed to gitlab - https://gitlab.com/ThomasFuston/first It was just to test uix i just try to find why it is not linting

borkdude11:01:18

$ clj-kondo --lint src/app/core.cljs
src/app/core.cljs:7:4: error: Unresolved symbol: $

borkdude11:01:45

but that one is expected, since you need to refer $ as well

borkdude11:01:51

do you see some other output?

borkdude11:01:19

This is with your cloned repo

Lemonski11:01:51

Hmm, i linted from within the sub directory, if i lint from base directory, i do have same output like you

borkdude11:01:37

that is expected, don't lint from the sub directory :)

borkdude11:01:39

in clojure-lsp, one thing that might be wrong still is the project root. you can try to do `lsp-workspace-remove-folders

Lemonski11:01:01

Now it is working as expected after lsp-workspace remove

Lemonski11:01:44

uff, thx for your time again ❤️, it is only a minor thing, but i like to have lsp support 🙂 Thx alot!

ericdallo14:01:03

Most of LSP issues are usually related with wrong project roots :)

😂 1