Fork me on GitHub
#cursive
<
2019-11-28
>
steveb8n06:11:06

Q: I’ve just started playing with clj-cdk and it’s style of importing interop deps doesn’t play well with Cursive.

cfleming07:11:58

That’s a little strange. Unfortunately there’s no good way to handle that apart from adding explicit support to Cursive. What is that import actually doing?

steveb8n22:11:21

It is an interesting combo but super useful. It’s jvm clojure importing some kind of Typescript bridging libs (called jsii in the docs)

steveb8n22:11:05

The import is pulling in support for constructor fns for various parts of the AWS CDK api. there’s a conj talk about it if you want a better understanding

steveb8n22:11:33

might be best for @UGM2P65B7 to comment on this

steveb8n06:11:12

Are there any tricks for working with these kinds of imports? My workaround will be to isolate them in another namespace but it hinders the exploratory experience so I thought I’d ask

dmarjenburgh09:11:44

I’m not sure why they chose that particular syntax for imports. The equivalent typescript is, I believe:

import { Stack } from '@aws-cdk/core';
import { Bucket } from '@aws-cdk/aws-s3';
Not sure what would be lost if the syntax were something like:
(cdk/require '[aws-cdk/core :refer [Stack]])
(cdk/require '[aws-cdk/aws-s3 :refer [Bucket]])
Then maybe by resolving cdk/require as clojure.core/require, cursive could resolve the symbols? I guess you could try writing such a require macro and see if it works.

cfleming10:11:07

I don’t speak Typescript (or NPM above a very basic level), but what is that import doing that the standard nodejs requires in CLJS don’t?

dmarjenburgh11:11:15

If the typescript compilation target is nodejs (commonJS), then its identical to var mod_1 = require('@aws-cdk/core'); var Stack = mod_1.Stack;

jeremys17:11:26

Hey guys, I was wondering if there is a way to configure the repls I start (using deps) to eval automatically (set! *warn-on-reflection* true) ?

cfleming08:11:42

@U0FR867U1 You should be able to do that using a user.clj, which is not Cursive-specific. I have plans to allow some startup commands to be added to a particular run config, but that’s not possible yet.

jeremys09:11:37

Hi @U0567Q30W do you mean create a user.clj namespace? Relying on the fact that it should be loading automatically? That’s clever I didn’t think of that at all. Thanks Colin.

cfleming10:11:05

Yes, that’s right. Stuart Sierra has a blog post on it IIRC.

imre09:12:46

I tried this but it didn't work for some reason. I only did a tiny bit of investigation into it and it appears that (set! *warn-on-reflection* true) only applies to the thread it's run on. Repl startup seems to be happening on a different thread than stuff like 'send form to repl'

cfleming10:12:40

Hmm, yes, that’s possible. I’ll see about adding that field to the run configs.

imre10:12:37

For the record IIRC I also tried it with cli repls, and I think it didn't work there either, but I'd have to verify that. It could be a lot of places where this gets decided, including the type of repl you use, whether it's local or remote etc. Another thing I'm unsure about is how this behaves when you start new threads in your code, either manually or by relying on futures, pmap, core.async etc.

imre14:12:18

I created a repo to demonstrate the issue(?)

danielcompton22:11:11

What's the "safest" version of IntelliJ to be on at the moment? I'm currently on 2019.1.4 and am wondering whether to update, or maybe downgrade back to 2018 series?

cfleming22:11:36

Actually, I should mail the list about this. AFAIK 2019.3 with 1.9.0 should be fine now.

👍 4
cfleming22:11:54

I’m using that with no problems.

danielcompton22:11:56

Great, thanks!