lsp

Harold 2025-12-10T23:01:50.237629Z

We have, um, a lot, of 'unused bindings' from code like this:

Mateusz Mazurczak 2025-12-20T10:21:48.651329Z

This warning helps with variable shadowing

2025-12-11T08:17:16.077829Z

I like my linter to warn me about things that are likely to be an actual problem when running the code and unused bindings don’t cross that threshold for meInteresting, I understand this reasoning, but personally I think it does cross that threshold. Like if you have foo and bar and you are supposed to use them both, but you made a copy-paste mistake and used bar in two places, foo is then unused and linter warns about that, and that definitely is a bug in the code

👍 1
cjohansen 2025-12-11T08:23:38.880749Z

I agree. I love being warned about unused bindings.

ericdallo 2025-12-11T12:26:21.450459Z

Yes, I can think on multiple cases where the linter saves you from bugs like that, it's not a silver bullet tho, but it's worth it for sure

rolt 2025-12-11T13:05:37.199939Z

> What do people do about these? For reagent components I use with-let

2025-12-11T16:12:37.318109Z

+1 for preferring prefix underscore. no information/readability lost, the variable name is still there, and you also signal to a human reader that it is intentionally unused. lsp-rename is very necessary to my workflow and removes any pain from things like this

Harold 2025-12-10T23:02:48.453789Z

What do people do about these? I know I could throw underscores all over the place, but I'm wondering if that's the best idea, or if there's something better.

mkvlr 2025-12-10T23:07:10.295239Z

I turn them off on my projects, not a fan of adding and removing underscores

mkvlr 2025-12-10T23:09:47.477759Z

I feel a warning is too strong for this. I especially don’t like it when folks replace a name with just an underscore so you don’t know what arg you’re getting anymore. I believe cursive just greys out the unused locals, I feel that’s the best solution for this as it’s communicating the info without the need to touch the code. Would love that in emacs as well.

➕ 1
Harold 2025-12-10T23:14:53.300539Z

You just turn off 'unused binding' everywhere?

seancorfield 2025-12-10T23:28:28.070049Z

You don't like adding an _ prefix? _baz? Then you still get the name, but with no warning.

👍 2
cjohansen 2025-12-10T23:29:01.192219Z

+1 to adding a leading underscore

mkvlr 2025-12-10T23:29:07.390439Z

no, because then I need to touch two places when I want to use it again

➕ 1
mkvlr 2025-12-10T23:29:57.020159Z

and in cljc code with reader conditionals it gets even more silly I think, then you start introducing reader conditionals if you’re only using it in one branch

mkvlr 2025-12-10T23:31:40.524569Z

I like my linter to warn me about things that are likely to be an actual problem when running the code and unused bindings don’t cross that threshold for me

Harold 2025-12-10T23:31:48.662829Z

leading underscore seems a lot better than replacing the whole name with underscore, but still not ideal.

Harold 2025-12-10T23:32:33.437169Z

I'm not super excited to turn off 'unused binding' because I think it's really helpful when refactoring - finding out a function doesn't use an input anymore is great.

mkvlr 2025-12-10T23:33:44.026999Z

greying out the name would be ideal I think

mkvlr 2025-12-10T23:35:56.694599Z

guess it’s not too different from the reference count

ericdallo 2025-12-11T01:34:41.093719Z

> no, because then I need to touch two places when I want to use it again No, you can rename via lsp and you do it once

ericdallo 2025-12-11T01:34:56.413389Z

I'm totally into prefixing with _

ericdallo 2025-12-11T01:35:14.299469Z

and you can quickly do lsp-rename add _ and done

☝️ 4
Harold 2025-12-11T02:31:20.347009Z

👍