Fork me on GitHub
#dev-tooling
<
2023-07-23
>
ericdallo21:07:53

Hey @cfleming! 👋 I'm about to launch https://github.com/clojure-lsp/clojure-lsp-intellij which is a new plugin that allows integration with https://clojure-lsp.io/, and I'd like to know if it's possible to make cursive work together with that plugin, specifically the REPL part.

ericdallo21:07:57

I noticed that both plugins can't be opened together because of the language declared in plugin.xml which is Clojure , but I kind of worked around that making my plugin language be clojure , and then after startup select the extension to be used by clojure-lsp but then the Cursive's REPL doesn't recognize the clojure files anymore, is there a way to make that work?

cfleming22:07:45

So, I’m not sure, but I suspect that would be complicated. There’s a lot of machinery under the hood for the REPL stuff. How would you see the integration working? It seems to me that your plugin would pretty much do what Cursive does anyway, right?

ericdallo22:07:31

Only the static part, no reply as LSP supports only static analysis

ericdallo22:07:08

TBH would be awesome to not even need to declare parser and lexers as clojure-lsp already has all of that , but intellij doesn't like that

cfleming22:07:41

No, you’ll basically have to end up reimplementing large parts of Cursive.

ericdallo22:07:51

Yeah, but the static part is already working, so I was thinking that some users would like to use clojure-lsp-intellij for the static support like code lens, definition, references etc and leave the REPL part for Cursive

cfleming22:07:19

What would this offer over using the existing clj-extras-plugin, which if I understand correctly also can use clojure-lsp for that stuff via clj-kondo?

ericdallo22:07:52

• Code lens • more diagnostics that are not available in kondo like unused public var, clj-depend • code actions from LSP And a bunch more from https://clojure-lsp.io/features/

ericdallo22:07:54

clj-extras uses only clj-kondo, not clojure-lsp, also, it uses only diagnostics features, clojure-lsp has more

cfleming22:07:30

Ok. Well, I suspect that the integration would be tricky. Like I say, there’s a lot of machinery there. You could look for inspiration at the Dart plugin which uses an LSP-like thing, but that still implements a full parser and lexer and does a lot of dancing to make that work with the remote system.

ericdallo22:07:42

Hum, but I think dart doesn't have a repl right? I meant change cursive repl to support work on files from other languages, does that makes sense? Or enough to work with clojure-lsp-intellij

cfleming22:07:18

So… I’m not sure how to put this delicately. I’m not exactly incentivised to do this, because you’re essentially writing a Cursive competitor, and Cursive feeds my family.

👍 2
ericdallo22:07:15

I see, I thought would be ok for you since people would still use Cursive along with clojure-lsp, since cursive is the only plugin that supports REPL support ATM, this way one could choose to use static analysis from cursive or clojure-lsp, but the runtime stuff would still come from Cursive

cfleming22:07:04

Cursive licensing has always basically used an honesty box model, since I’ve always offered non-commercial licences for free. So anyone interested in using Cursive without paying can just get one of those and use it. But I suspect that a lot more people would feel ok about not paying if they think that clojure-lsp is doing the hard bit and Cursive is “just” providing the REPL.

cfleming22:07:44

I don’t know how many users would think like that, but doing something like this is unlikely to get me any more users, and could result in significantly less.

cfleming22:07:15

It’s basically unlimited (potential) downside and no upside.

ericdallo22:07:24

Hum, I do think the REPL editor support is important for intellij and people probably wouldn't use clojure-lsp-intellij without any repl support :/ I'm trying to find a way where both things can work and people don't need to stop using cursive but can leverage clojure-lsp features that are not available in any editor. One example of this is that at Nubank, clojure-lsp linter part (that is another feature that allows using it without the IDE) is used in all hundred of projects, but intellij people doesn't have the feedback in ther IDE like the unused-public-var or the clj-depend integration, clojure-lsp is available in all famous editors but Intellij, so I'm trying to improve that

ericdallo22:07:05

isn't a better experience for Clojure users a upside? in a way that both plugins would still be used

cfleming22:07:00

It’s an upside for Clojure users, but it’s not an upside for me if they stop using Cursive. I don’t know if that’s a real possibility or not, but it’s one I have to consider.

ericdallo22:07:18

Sure, I can see that

cfleming22:07:38

Or at least, stop paying for Cursive even if they still use it, because they think the part they’re using isn’t worth paying for.

ericdallo22:07:07

it's just that I can't see how one that uses intellij would code Clojure without any REPL support, but I understand your concern

cfleming22:07:06

I don’t know, but I can imagine users that might think that “just” that bit isn’t worth paying for, and they would use it without paying for it. Which is trivial right now.

cfleming22:07:35

Wouldn’t Nubank’s case be covered by the clj-kondo integration?

cfleming22:07:43

That does the linting, right?

ericdallo22:07:52

unfortunately, no, because clojure-lsp uses a feature from clj-kondo called custom hooks, which allows to define custom linters like the unused-public-var, also clojure-lsp has other diagnostics integrations besides kondo like the clj-depend project

ericdallo22:07:19

it's pretty common to intellij users at Nubank have a inconssitency editor feedback than vscode/emacs/vim/sublime :/

cfleming22:07:16

Hmm, well possibly we can try to come up with something which scratches that itch without directly competing? I’m not sure what that would look like. It’s getting late here though, I have to go to bed.

ericdallo22:07:53

yeah, that would be great, would love to see intellij users able to use clojure-lsp and not affect Cursive's REPL support which is amazing, I hope we find a solution that works for both! Thanks for your time and good night!

snoe17:07:02

Cursive's static approach was a huge inspiration for clojure-lsp. I always imagined cursive and lsp pushing each other forward. LSP can still learn a lot from Cursive for other editors and I think Cursive could be improved by supporting common config formats that kondo/lsp have leveraged for CI workflows. Personally, I wonder if a way forward for nubank should be to sponsor unused public vars and clj-depend features in Cursive - if that's a possibility.

ericdallo17:07:59

Nubank already sponsors Cursive IIRC, not sure though, even so, my point is that LSP is a standard to have one server for multiple clients and ATM the only client that doesn't have LSP support is Intellij, so I do think it makes sense to launch clojure-lsp-intellij, the issue here is if it can be used with cursive's repl

cfleming09:07:59

Nubank doesn’t sponsor Cursive. I think their thinking is that they already pay for development through license purchases.

cfleming09:07:16

Cursive does already support unused public vars, and something like the depends feature (IIUC), but the second is currently broken by an IntelliJ bug.