Fork me on GitHub
#lsp
<
2022-10-23
>
borkdude09:10:51

I think there is an opportunity for #CPABC1H61 to fix these automatically:

☝️ 1
ericdallo12:10:55

Don't we suggest a code action to require that?

ericdallo12:10:49

Yeah, it require the alias and change that place to use the alias

borkdude12:10:31

but the require was already there

ericdallo13:10:52

Hum, I see, is this linter new? Also what are the code actions available on that line?

borkdude13:10:02

yes, it's new and optional (off by default)

ericdallo13:10:00

I see, that could be a code action or part of clean-ns, not sure if would be good touch the rest of the code on clean-ns, but a code action to fix that line is convenient indeed

ericdallo13:10:24

Do you intend to in the future change the level to something else than off ?

borkdude13:10:03

I will only enable linters that can detect serious problems or where the compiler may also warn, from now on

👍 1
🙌 1
ericdallo13:10:55

Feel free to create a issue about a code action to fix it

ericdallo13:10:55

Cool right? :)

Noah Bogart13:10:23

Love this action

walterl15:10:11

I use this often in RCFs ❤️

borkdude15:10:47

@UJY23QLS1 Also check out :config-in-comment in which you can tweak linters for RFCs

wow 1
walterl15:10:23

That's super cool! Along with the other :config-in-* keys. While my usages of the above action isn't as global, I'm very happy to learn about those. clj-kondo

clj-kondo 2
lukasz17:10:53

Crossposting from #emacs - maybe someone knows the answer here (I couldn't find anything via Google searches) https://clojurians.slack.com/archives/C099W16KZ/p1666466293640729

ericdallo17:10:08

Other code actions are available?

ericdallo17:10:15

What's the server version?

lukasz17:10:38

I'm on

clojure-lsp 2022.06.22-14.09.50
clj-kondo 2022.06.22
and yeah - other code actions are indeed available

lukasz17:10:52

maybe it's something with the project I'm working on - let me try a couple more

ericdallo17:10:06

Also I suggest update your server to latest

lukasz17:10:55

oh yeah, for sure

lukasz17:10:34

so odd - it works in other projects but not in the one I've been working on so far, I'll dig into it

ericdallo17:10:22

Maybe a exception from server

ericdallo17:10:25

Check server logs

lukasz17:10:09

I think I found it - the require option doesn't show up until I open the file with that namespace in other buffer, until then Emacs is not aware if that namespace exists so it only suggests creating it

lukasz17:10:28

must be the classpath configuration for that project that breaks namespace lookups

ericdallo17:10:52

Certainly is the classpath issue

ericdallo17:10:30

It's weird because at least lsp-mode handles and shows a message that server sent when the classpath fails

ericdallo17:10:39

In a recent server version at least

lukasz17:10:51

yeah, I'll upgrade first and see if that resolves the issue

ericdallo17:10:22

I doubt it will solve, but will say what command didn't return a classpath

lukasz17:10:35

ah neat, that will def help!

lukasz18:10:02

Same thing after upgrading - I have to open a buffer in emacs for the 'add require' option to show up and work, very weird.

ericdallo18:10:50

And what about the server logs? Any mention to classpath ?

lukasz18:10:42

any tips how to see them? eglot's log buffers just show json-rpc responses

lukasz18:10:45

thank you 🙏

lukasz19:10:11

hm, nothing suspicious in clojure-lsp logs - as in no errors etc

ericdallo19:10:58

Any mention to classpath? It should mention the found classpath

lukasz19:10:56

Nothing so far, I'll resume tomorrow and test with other projects

lukasz15:11:33

Ok, found the reason - Eglot uses project.el under wraps, and that sometimes fails to detect correct project root (I work in a mono repo)

mkvlr19:10:23

@borkdude have you tried it?

borkdude19:10:59

no, but some people in this channel have

lukasz19:10:01

It feels faster than clojure-lsp for sure, sometimes things don't work exactly the same but it might be due to how some of my projects are setup

ericdallo19:10:53

clojure-lsp is the server which is the same, so probably you meant lsp-mode

lukasz19:10:17

ah yes, sorry - I'm debugging all 3 right now hence the confusion facepalm

walterl20:10:55

I'd like to add functionality to my vim setup (with Conjure) that replaces the bindings in a let-block with a sequence of defs. Would clojure-lsp be the place to add that? Alternatively I can build on Conjure's useful tools.

ericdallo20:10:15

Clojure-lsp has a extract to def code action, isn't that enough already?

walterl20:10:03

It's serviceable for one-offs, but quite tedious in big lets. But that was actually just an example for the broader question: is clojure-lsp the place to add that type of functionality?

ericdallo20:10:47

I see, so for common refactors we could code a code action for that, but if your question is: Can I code my own refactorings, the answer ATM is no

borkdude20:10:01

Why not actually? Perhaps a similar thing as clj-kondo hooks could be made

borkdude20:10:21

But of course, one could also do their own thing with a babashka script and rewrite-clj

ericdallo20:10:44

Yeah, would be a nice feature, but seems complex similar to hooks

walterl20:10:30

A vim macro would probably be a much simpler solution in this case anyway neovim

walterl20:10:19

Also looking to use/create something to load a stacktrace's locations into the vim location list

ericdallo21:10:05

I cretaed this issue to discuss and think more about this possible feature: https://github.com/clojure-lsp/clojure-lsp/issues/1333

👍 1