lsp

karol.adamiec 2024-10-01T09:14:17.296359Z

hi all, Is there a way to make lsp find references to usage of forms in rich comment blocks? some of my code looks like dead and unused from LSP point of view, while in reality it is used in rich comments...

✅ 1
borkdude 2024-10-01T09:18:28.697029Z

should work, evidence in screenshot, unless you have configured clj-kondo to "skip comments"

karol.adamiec 2024-10-01T09:19:03.785059Z

duh facepalm Thank You!

borkdude 2024-10-01T09:22:26.843489Z

you can make both work, by not using :skip-comments, but by doing this in clj-kondo instead:

{:config-in-call {clojure.core/comment {:ignore true}}}

👍 1
borkdude 2024-10-01T09:22:44.647559Z

also you need to configure cljs.core/comment as well

karol.adamiec 2024-10-01T09:36:26.570129Z

and is this visible in call-heriarchy? like a Comment common parent? i guess not...

borkdude 2024-10-01T09:37:08.620369Z

not sure what you're referring to, here ends my clj-kondo + lsp integration knowledge, I'll happily defer the rest to @ericdallo

🙌 1
karol.adamiec 2024-10-01T09:37:53.676129Z

yeah, thanks a lot. i am not really sure about that too. rather new space for me 🙂

ericdallo 2024-10-01T12:37:06.606349Z

@borkdude what that does?

{:config-in-call {clojure.core/comment {:ignore true}}}

ericdallo 2024-10-01T12:37:13.122029Z

I only knew the skip-comments

ericdallo 2024-10-01T12:38:29.586069Z

@karol.adamiec you mean show in the call hierarchy tree lsp feature the comment ? or in find references?

borkdude 2024-10-01T12:40:28.404359Z

:ignore true means the same as turning all linters off

borkdude 2024-10-01T12:40:43.705859Z

skip-comments true means: don't even look at (analyze) this

ericdallo 2024-10-01T12:41:53.480239Z

ahh makes sense, so LSP features will keep working with the ignore true

ericdallo 2024-10-01T12:42:03.368669Z

good to know, will change nubank to use that

🎉 1
ericdallo 2024-10-01T12:42:14.048999Z

sounds like a better move indeed

karol.adamiec 2024-10-01T13:07:20.815299Z

you mean show in the call hierarchy tree lsp feature the comment ? exactly that.

ericdallo 2024-10-01T13:32:43.053909Z

yeah, that's not supported because I never thought about it 😅 but sounds convenient, feel free to create a issue about it, also would be best if you provide code or even images of what you want to make the issue clear

karol.adamiec 2024-10-01T14:19:39.246489Z

ok, thanks. I am not sure myself how useful that is. artificial call site like comment, this came up in team discussion...

Ovi Stoica 2024-10-01T13:19:01.956429Z

Did anybody else experience this issue with clojure-lsp and lsp-mode in emacs? The lsp diagnostics don’t refresh in the buffer after changes were made. An example: • I have a diagnostic saying variable is not used, if I move that variable to another line, the diagnostic squiggly underline will still be shone at the previous line and I have to hit lsp-restart-workspace to trigger a refresh for LSP This happens only with clojure-lsp. Has this been reported before?

Ovi Stoica 2024-10-02T15:31:13.677619Z

This was the final tipping point, and I declared emacs bankruptcy. I just finished remaking my config. It works now. It uses the same clojure-lsp binary I had before, so it’s clearly not an issue with clojure-lsp itself. My assumption is that it was because I had lsp-enable-file-watchers set to false. From the docs: If non-nil lsp-mode will watch the files in the workspace if the server has requested that. It works now. Thank you guys for the support!

ericdallo 2024-10-02T15:32:34.978099Z

glad it's working, but I don't think it was related to file watchers, that's a feature only for, for example, if you switch git branchs (you changed code not via editor), so lsp-mode knows about it and ask server to re-analyze those file changes.

Ovi Stoica 2024-10-02T15:33:26.787169Z

Ah, I see. Good to know. Then, I don’t know what caused the issue

🤷‍♂️ 2
borkdude 2024-10-01T13:23:34.677519Z

I've had issues like this with flycheck as well, outside of lsp. Only happens once in a while and then I have to just close and re-open the file

Ovi Stoica 2024-10-01T13:30:02.994539Z

For me it is a persistent issue. It’s like the LSP doesn’t update the latest version of the file. Here’s a video of this scenario, note the symbol highlight when cursor is over button component. LSP will highlight 2 positions where it knows the occurences of the button are, but they are way down

Ovi Stoica 2024-10-01T13:31:31.133979Z

Curious if anybody has experienced this issue where LSP doesn’t update its context related to the open buffer

ericdallo 2024-10-01T14:46:54.904179Z

@ovidiu.stoica1094 from your video, does lsp-mode receive the publishDiagostics notification from server?

Ovi Stoica 2024-10-12T07:20:09.556049Z

Coming back to this, this was happening because I also had tailwindcss as an addon LSP provider in the same buffer. It started happening again now that I added it back, and it behaves correctly again if I only have clojure-lsp active in the buffer https://github.com/merrickluo/lsp-tailwindcss misbehaves in some situations (providing completions where it shouldn’t), so I’ll just disable it for now. Happy to add this to a list of things people should watch out for if there is one