Fork me on GitHub
#clj-kondo
<
2022-09-21
>
Adam Helins07:09:23

Hey 👋 I must have changed something in my env but no idea what! In all Clojure files, Neovim now shows a warning about the namespace not matching the file name. I tried reinstalling Clj-kondo, purging the cache, ... can't seem to find the cure. This is purely an editor problem. Linting from the terminal doesn't output any warnings.

borkdude07:09:40

Version and repro?

Adam Helins07:09:36

Latest v2022.09.08 Impossible to repro I'm afraid 😅

borkdude07:09:55

Perhaps @U7ERLH6JX could also check as he is also using nvim

borkdude07:09:48

As a workaround you can disable that linter for now

Adam Helins07:09:07

It must be an env thing because I didn't update Clj-kondo meanwhile. At first I thought it was maybe somehow due to installing clojure-lsp but uninstalling it didn't help neither.

Adam Helins07:09:58

Even tried re-installing nvim... baffles me!

borkdude07:09:23

@UCFG3SDFV I think I know what it is

borkdude07:09:49

your nvim plugin likely lints via a temporary file or so and doesn't pass --filename

💡 1
borkdude07:09:01

so then clj-kondo thinks the filename is entirely different from your real file

lispyclouds07:09:34

What’s your linting setup @UCFG3SDFV ? You use something like null ls or nvim lint?

lispyclouds07:09:37

On a side note, simply using lsp and clojure-lsp works for me for any file, don’t have a need for calling clj-kondo directly

borkdude07:09:21

check the ale implementation

lispyclouds07:09:26

Probably an issue in ALE. Trying to take a look

Adam Helins07:09:53

I did try re-installing the plugin. I sense installing clojure-lsp must have triggered some interference?

Adam Helins07:09:02

(although it is removed now)

lispyclouds07:09:40

If you have both lsp and clj kondo they could interfere I guess

borkdude07:09:10

I run both in emacs

borkdude07:09:24

but I've disabled diagnostics from clojure-lsp an purely rely on the installed clj-kondo

borkdude07:09:35

since I usually have a local development version

lispyclouds07:09:02

@UCFG3SDFV do you still have the same error running with just lsp?

Adam Helins07:09:44

In any case lsp is now uninstalled, I purged the neovim/nvim-lspconfig plugin, re-installed Ale, and still the same 😕

Adam Helins07:09:00

(I'm afraid to reinstall lsp now)

lispyclouds07:09:26

Yeah that’s what I was gonna say

Adam Helins07:09:42

But why was it working perfectly fine before?!

borkdude07:09:05

Because the namespace linter is a recent (few months ago) addition probably?

borkdude07:09:20

And I don't know for sure if this is the issue

borkdude07:09:25

I also don't know if ale uses a temp file or not

borkdude07:09:33

flycheck has a flycheck-compile command which you can use to diagnose

borkdude07:09:36

perhaps ale has a similar thing

lispyclouds07:09:05

im not using ALE for quite a while now, quite hard to debug too

lispyclouds07:09:33

but its quite old too

lispyclouds07:09:40

yeah i think this is the issue ^

lispyclouds07:09:18

this PR being unmerged is whats keeping it from working as expected

Adam Helins08:09:23

@U04V15CAJ I guess you must be right, that looks like a very plausible explanation and maybe I wasn't as up-to-date as I thought

lispyclouds08:09:07

@UCFG3SDFV maybe the workaround could be not using the ALE for clojure and using lsp? not sure when they could address the issue in ALE.

borkdude08:09:25

or just disable the namespace linter

1
👍 1
borkdude08:09:39

I think it would be good to have ale work correctly

borkdude08:09:44

since many people use it

Adam Helins08:09:22

@U7ERLH6JX Yes, I thought the issue might have been caused by lsp but it turns out it's the opposite (ale) Thanks to both of you, that was really helpful!

👍 1
1
lispyclouds13:09:28

@UCFG3SDFV just to close this off, https://github.com/mfussenegger/nvim-lint/blob/master/lua/lint/linters/clj-kondo.lua#L16 is how it should work. this is the bit i contributed to the plugin too and then switching to just using lsp :rolling_on_the_floor_laughing:

👍 2
Adam Helins14:09:00

Well I followed your path eventually and everything is perfect now!

lispyclouds15:09:28

nice! just as a side note, if its not too much work to move and since youre on nvim, i could recommend using https://github.com/mfussenegger/nvim-lint or https://github.com/jose-elias-alvarez/null-ls.nvim if you need something more than what the lsp can do. they are easier to debug and augment the built-in lsp mechanism nvim has, working with nvim-lspconfig

👀 1