squint

rafaeldelboni 2025-11-04T21:25:04.698279Z

Folks when using reagami or eucalypt from squint do you get from lsp any "benefits" of being written in a clojure like language like autocomplete or docstrings? Or it's just normal JavaScript lib interop experience? I'm writing a lib in squint, but I was wondering if there was any way to benefit of those features? For now I'm just copy & pasting the code between repos.

borkdude 2025-11-04T21:40:18.068969Z

@rafaeldelboni you don't get any benefits when using reagami or eucalypt as JS libraries since lsp doesn't have JS analysis. But you do get lsp benefits for all the code you write yourself

borkdude 2025-11-04T21:40:49.244899Z

not sure what you meant with "copy and pasting code between repos"

rafaeldelboni 2025-11-04T21:42:44.030909Z

My "library" instead of creating a npm package, I just copy and paste it in the repos I need, in the src folder :) Not elegant, but I get the lsp stuff in the code, as you said.

rafaeldelboni 2025-11-04T21:43:32.818439Z

Its just personal stuff anyway, I was wondering if there was a more elegant way

borkdude 2025-11-04T21:43:38.427789Z

squint should probably support adding source libraries somehow. not sure yet what would be the best way. perhaps git deps. but I want to avoid having people to use a JVM or bb to get deps

borkdude 2025-11-04T21:44:22.368169Z

for nbb that's what I've done btw, assume people have bb and it gets the deps from nbb.edn

borkdude 2025-11-04T21:44:44.031499Z

maybe that's an ok-ish solution after all

👍 1
rafaeldelboni 2025-11-04T21:45:24.850789Z

That would be nice, or a source map based solution, but that would require a lot of changes in all call graph

borkdude 2025-11-04T21:46:12.863299Z

source map solution wouldn't get you lsp support

borkdude 2025-11-04T21:47:42.584029Z

git deps may be doable if I translate this to CLJS, then I can just run it from node. clojureCLR also only supports git deps

👍 1
borkdude 2025-11-04T21:48:44.703529Z

it's not that much code: https://github.com/clojure/tools.gitlibs/tree/master

borkdude 2025-11-04T21:49:17.266119Z

another idea would be to piggie-back on node_modules

borkdude 2025-11-04T21:50:02.219609Z

this is what I've done with squint.macros: https://github.com/squint-cljs/squint-macros

borkdude 2025-11-04T21:51:32.437789Z

that is what you could do as well

borkdude 2025-11-04T21:51:38.187909Z

with your own lib

borkdude 2025-11-04T21:52:04.539199Z

and then tell clojure-lsp to use squint.edn as the source of deps

rafaeldelboni 2025-11-04T21:53:02.657909Z

And you install normally via npm? https://github.com/nextjournal/clojure-mode/blob/d32d56f9b900c1cfe2c501672562200b54a56194/package.json#L44

borkdude 2025-11-04T21:53:06.775789Z

yes

rafaeldelboni 2025-11-04T21:53:11.434639Z

Interesting

rafaeldelboni 2025-11-04T21:53:57.703079Z

Not that bad actually, not great to add many libs in this way, but would be very doable for now

borkdude 2025-11-04T21:54:08.417159Z

indeed, a workaround

borkdude 2025-11-04T21:54:33.225659Z

but by convention it may work if the library publishes a squint.edn or so as well in the root, then squint could automatically add it to the paths

rafaeldelboni 2025-11-04T21:58:34.429179Z

Cool so if I do something like squint-macros and with a squint.edn in the root install via npm I would be good to go?

borkdude 2025-11-04T21:59:16.244859Z

not currently, but we could make it so, if you publish the squint.edn to your npm package.

👍 1
rafaeldelboni 2025-11-04T21:59:32.468869Z

Got it, I think is a good approach

rafaeldelboni 2025-11-04T22:01:04.836009Z

I think that would allow JS compiled and squint being published in the same release, then you can use from CLJS (via js interop) and in squint "native"

rafaeldelboni 2025-11-04T22:01:21.872409Z

Sounds nice

borkdude 2025-11-04T22:01:40.779889Z

this does require squint to scan the node_modules directory though. and not sure if this works well for transitive deps.... do they appear at the top of the node_modules dir always? it does make squint re-compile all those sources btw which may be a waste if it's already compiled

👍 1
rafaeldelboni 2025-11-04T22:02:17.779799Z

Maybe we could declare those in a different place than package.json

rafaeldelboni 2025-11-04T22:02:24.384419Z

Like shadow

borkdude 2025-11-04T22:02:31.889039Z

and squint would also put those compiled sources into your target directory...

👍 1
borkdude 2025-11-04T22:15:21.589439Z

I guess it's pretty normal to have all compiled deps go into the target folder. This happens with Clojure AOT and CLJS compilation as well. If you then go publish your lib, you only publish the relevant files as an post-compilation step, I guess

👍 1