Fork me on GitHub
#cursive
<
2022-07-28
>
Ovidiu Stoica08:07:17

Hello, first of all thank you for this amazing tool. I come from a js background and I am curious what it would take for cursive/intellij to do static analysis on the JS dependencies in clojurescript since it seems to do that already in the java code. • Example 1: Go to definition works on Java (maybe IntelliJ and not cursive?) But when importing something from an NPM module, you cannot go to the definition of that file • Example 2: Autocomplete on JS objects. I played around with emacs and I saw that when you start a REPL with cider, you get autocomplete on keys from javascript objects and so on but this is not the case in Cursive since all the completion relies on static analysis if i’m not mistaken. IntelliJ already provides static analysis for JS dependencies/files. What would we need to use that functionality inside ClojureScript files to benefit from completion, documentation and go to definitions?

Ovidiu Stoica08:07:45

As a side node, I think this is the only thing missing for me to make this the best ClojureScript editor experience and have more JS devs migrate I tried emacs just to get better completion but I just couldn’t get away from using cursive because it is way too good. Only after not using it, did I realize how good it actually was 😄

imre09:07:39

Not trying to drive you away from Cursive (I have been a happy and constant user since 2014) but have you had a look at VS Code + Calva? While I haven’t been doing ClojureScript for years now, for some reason I think it currently might have an edge over Cursive in modern cljs support. I’m not certain though, just asking whether you tried it.

Ovidiu Stoica09:07:54

Yes, I tried Calva + VS Code. VS Code has been my editor for 4-5 years. Couldn’t go back after switching to Cursive + IntelliJ, even for pure JS projects. Main issue (for me) is that it does not support vim which is a deal breaker for me. I think you are right, since it uses cider underneath, it should have the same functionality as Emacs. Still, I find the best experience is in Cursive and since this is important to JS devs, I figured to open the discussion

cfleming01:07:19

I’ve been unwilling to add support to Cursive relying on IntelliJ’s JS support, because that support would only be available on paid versions of IntelliJ. However, the sad fact is I’m not getting around to a better solution on my own because of the enormous nature of the task. So I’m reconsidering this at the moment.

👍 3
Ovidiu Stoica04:07:28

I’m already on the paid version, so for me it would be perfect. Indeed, I see what you mean that even if you include it, it would be limited to paid users, which I’m not sure the % of cursive users who are. If you put a survey on wether to include intelliJ’s JS support on the paid version I would say yes 😄

2
cfleming04:07:44

Hehe, for sure. Originally (which is going back a long time now) I was quite resistant to the idea. But I’ve toyed with it from time to time, I think I’ll try a PoC to see how much better it works and how much work is involved.

cfleming04:07:59

Basically the alternative is a huge amount of work. One thing I was considering was to use TypeScript types for IDE functionality, I think they’re available for almost everything these days. But that still doesn’t work properly for e.g. navigation to source.

Ovidiu Stoica06:07:33

I see. Yes indeed. Other IDEs from what I know use LSP for all of that, but it would tax performance quite a bit. Here’s the scenario for a JS dev that also does clojure (which means semi dabling in java source from time to time) You either pay for intellij or buy webstorm. However intellij paid already has all of webstorm installed so you get a better deal with intellij at a cheaper price. This is why I didnt buy webstorm after my student license expired. What I’m trying to say with this is that people that work in the jet brains ecosystem, if they do clojurescript, most likely already have the paid intelliJ. Disclaimer: This is a conclusion from my individual experience and may not apply to others

1
Ovidiu Stoica06:07:01

Regarding to the PoC, I will gladly test it out for feedback if you like!!

surferHalo23:07:42

@cfleming https://tscrowley.dev/#/posts/2020-20-07-boonmee?id=boonmee Check this, Please make it happen. IntelliJ has best Java Interop experience, If Cursive make ClojureScript intellisense of Javascript/Typescript .d.ts in npm package, I will definitely switched from vscode to cursive and being a paid user. As @ovidiu.stoica1094 said and with my experience, the dynamic nature of LSP is not smooth as IntelliJ’s.

💯 1
🚀 1
salam02:07:28

i, for one, would want proper JS support even if it means it’s only available on the paid edition.

💪 1
💯 3
steveb8n11:07:10

I'm interested in this. I have a typescript react UI layer in a reframe app using interop. If exported types were useful it would definitely be a DX upgrade

💪 1
💯 1
Ertugrul Cetin13:07:28

Hi 👋:skin-tone-2:, I'm using Cursive and I set aliases to dev, when I run the REPL it does not load the namespace that defined in deps configuration file

:aliases {:dev {:main-opts ["--init" "src/my/server/core.clj"
                             "--eval" "(my.server.core/-main)"]}}
Here is my https://stackoverflow.com/questions/62193057/what-is-equivalent-of-leiningen-repl-options-init-ns-user-for-tools-deps-in Also there is https://old.reddit.com/r/Clojure/comments/fzjyw8/depsedn_how_to_declare_init_ns_and_init_fn_for_a/ I guess Cursive is using -R on aliases rather than -A ?

cfleming01:07:18

So there’s a recent issue which is similar to this, I commented on it here: https://github.com/cursive-ide/cursive/issues/2322#issuecomment-1097566491

cfleming01:07:28

However that doesn’t look exactly like your case.

cfleming01:07:41

Just checking, is your dev profile enabled in your REPL run config?

Ertugrul Cetin07:07:11

Yes, it is enabled (I'm able to run dev-specific fn in REPL). I think this looks like my problem. I need :repl-options 's :init and :init-ns functionality like leiningen has.