Fork me on GitHub
#lsp
<
2021-11-21
>
mynomoto11:11:44

I did a refactor where I changed positional parameters to a map and I was wondering if lsp could do it for me, as in changing the function signature and call sites. My functions generally start positional and are changed to receiving a map after getting a couple of parameters. Not really sure if this is something more people do, or if it is a common pattern.

ericdallo11:11:56

lsp could do it, but sounds too specific to me

ericdallo11:11:42

maybe a code action when you are inside function arguments like Convert function arity to map

mynomoto11:11:27

That would be cool

ericdallo12:11:49

Feel free to create a issue, not a priority I'd say, there are other code actions I want to include it first

mynomoto12:11:37

Sure, thanks.

anonimitoraf12:11:40

Not meaning to hijack this thread but, @UKFSJSM38 which code actions are you prioritizing?

ericdallo12:11:40

This one I always wanted to have, it seems someone thought the same: https://github.com/clojure-lsp/clojure-lsp/issues/646

👌 1
mynomoto12:11:32

Another thing I tried do refactor was extracting an anonymous function that I was using as an argument to map but extract to function was extracting the whole map form. Is this expected or did I do something wrong?

ericdallo12:11:32

it's a bug, I think we need to improve the use of extract-function on threads and non directly calls like (map my-func coll)

ericdallo12:11:54

please open a issue

👍 1
Noah Bogart21:11:03

Here’s an interesting article about the trouble of handling macros in LSPs, focused on rust but seems like it could be interesting/apply to us as well: https://rust-analyzer.github.io/blog/2021/11/21/ides-and-macros.html

ericdallo00:11:22

Yeah, that's so true, I know him and he is a really good LSP-rust maintainer..

ericdallo00:11:52

But I think most of the macro trouble was/is already solved on clj-kondo

ericdallo00:11:18

Clj-kondo does a really good work handling and supporting macros :)

Noah Bogart00:11:47

Oh yeah that's true haha. Thanks, @U04V15CAJ !