Fork me on GitHub
#lsp
<
2023-12-29
>
Takis_18:12:25

hello : ) i don't now how hard or easy it is, but having node.js modules auto-complete is so important for me. With Clojure there is cursive if we add type annotations, but with Clojurescript we dont have a way.Do you know if there are plans to add this sometime?

ericdallo18:12:20

That would be something nice indeed for cljs projects, but it's not trivial, the first step to achei e that would be have analysis of the node modules in clojure-lsp, for all clj things we have clj-kondo that return these analysis, we would need to check if we could improve kondo for that or use another tool

🙂 1
ericdallo18:12:56

@U04V15CAJ is there any issue or plans to add support for node modules analysis in clj-kondo?

borkdude18:12:24

This can be accomplished by using a Node.js REPL like nbb, or shadow-cljs Node.js repl ;)

ericdallo18:12:28

You mean use the reply to workaround this or you mean use that in clj-kondo or something like that?

ericdallo18:12:39

I mean, clj-kondo already have all the analysis API

ericdallo18:12:46

Would be nice to keep using that

borkdude18:12:48

I think a REPL is more powerful for JS auto-complete

ericdallo18:12:28

Yeah, I was thinking if we could do something like we did for clj-easy/stub, that starts a process collect all that and we use it

ericdallo18:12:03

That'd be a start of improving static analysis with repl data which is something interesting

borkdude18:12:26

JS is far more dynamic and therefore more complicated to get auto-complete right I think, even harder because of clj-kondo/lsp being implemened in JVM instead of Node.js. From Node.js you can probe and evaluate things. The REPL can tackle such dynamic queries. Stuff like what is on the global object (js/...) can't be answered by scannning node_modules, but depends on your runtime

borkdude18:12:15

Also there is the whole CJS/ESM horror story: just looking at the source won't tell you exactly what is exported where, it also depends on package.json etc

borkdude18:12:36

So if you really want to try something, maybe write an experimental dump tool like you suggested, maybe a Node.js program that is ran over node_modules and js/.. once. Or maybe stuff that uses jsdoc or so, I don't know

ericdallo18:12:17

Yeah, makes sense

borkdude18:12:07

Perhaps VSCode already has some indexing stuff, perhaps for their lsp server

snoe19:01:35

It would be interesting if users have an lsp js server installed, if we can just talk to that

snoe19:01:49

would be helpful for clr too.