Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve dependencies off package.json directly (better shadow-cljs support) #2333

Open
binarykitchen opened this issue Mar 5, 2020 · 6 comments

Comments

@binarykitchen
Copy link

Has anyone ever managed to resolve npm dependencies installed by shadow-cljs in cursive?

Cursive always displays these as

“x cannot be resolved”.

This because the npm dependencies are in package.json but not project.clj - Cursive seems to only scan those in project.clj. Thoughts?

PS: shadow-cljs pom and importing this via Maven didn't work

@thheller
Copy link

thheller commented Mar 6, 2020

Note that package.json is completely irrelevant when it comes to resolving stuff. shadow-cljs never looks at it for the regular project. Only the contents of the node_modules folder are considered and not how they got there.

@conan
Copy link

conan commented Mar 30, 2020

npm deps don't seem to resolve, and it would be really useful if they did - I get a lot of "cannot be resolved" false positives for things required using shadow's syntax:

["@material-ui/icons/Stars" :default Stars]
["@material-ui/icons" :as mui-icons]
["@material-ui/pickers" :refer [KeyboardDatePicker]]

In this example, cursive can resolve neither Stars, mui-icons/Stars nor KeyboardDatePicker, but they are all valid require syntax (although they will only resolve after an npm install or whatever the yarn equivalent is)

@Wegi
Copy link

Wegi commented Aug 18, 2020

Yes, especially when working with react-bundling apps like reagent / re-frame / om.next / fulcro this is an Issue often encountered. Our team would really appreciate a feature, that takes this into account.

@devurandom
Copy link

IntelliJ has a NodeJS plugin. Is it somehow possible for Cursive to hook into that?

@cursive-ide
Copy link
Owner

It's possible to hook into it's package.json support, yes, but that doesn't supply the exports from those packages. That is provided by the JS support, and that is very hard to integrate with. I've made several attempts, but it relies on the source looking very much like JS, unfortunately.

@ulisesmac
Copy link

ulisesmac commented Jan 9, 2024

@cursive-ide
Maybe not actually resolved if it's so hard, but what about an option to treat them as defined symbols for the current file?

e.g.

["react" :as react]

Would be the same as:

(def react nil) ;; nil or whatever

and similar for

["@mui/material" :refer [CardActionArea]]

So that we don't get those annoying warnings.

This could be an option that can be toggled, I personally work a lot using ClojureScript, and it'd be really good to not mark them as warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants