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.
@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
not sure what you meant with "copy and pasting code between repos"
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.
Its just personal stuff anyway, I was wondering if there was a more elegant way
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
for nbb that's what I've done btw, assume people have bb and it gets the deps from nbb.edn
maybe that's an ok-ish solution after all
That would be nice, or a source map based solution, but that would require a lot of changes in all call graph
source map solution wouldn't get you lsp support
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
it's not that much code: https://github.com/clojure/tools.gitlibs/tree/master
another idea would be to piggie-back on node_modules
this is what I've done with squint.macros: https://github.com/squint-cljs/squint-macros
that is what you could do as well
with your own lib
and then tell clojure-lsp to use squint.edn as the source of deps
And you install normally via npm? https://github.com/nextjournal/clojure-mode/blob/d32d56f9b900c1cfe2c501672562200b54a56194/package.json#L44
yes
Interesting
Not that bad actually, not great to add many libs in this way, but would be very doable for now
indeed, a workaround
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
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?
not currently, but we could make it so, if you publish the squint.edn to your npm package.
Got it, I think is a good approach
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"
Sounds nice
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
Maybe we could declare those in a different place than package.json
Like shadow
and squint would also put those compiled sources into your target directory...
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