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

Cursive & Specter not playing nicely #1973

Closed
LispEngineer opened this issue Apr 7, 2018 · 13 comments
Closed

Cursive & Specter not playing nicely #1973

LispEngineer opened this issue Apr 7, 2018 · 13 comments
Labels
changed Marks issues describing changes to existing features released Marks issues which have had the fixes released in a stable build released-eap Marks issues which have had the fixes released in an EAP build
Milestone

Comments

@LispEngineer
Copy link

LispEngineer commented Apr 7, 2018

Using [com.rpl/specter "1.0.2"] in an IntelliJ 2018.1 with Cursive 1.7.0-eap1-2018.1 on macOS 10.12 with Clojure 1.8.0 and Lein 2.7.1:

Cursive and Specter seem to have some issues. It can't resolve some of the referred things. Here is a minimal .clj source file with a few examples:

(ns cursive-specter
  (:require  [com.rpl.specter :as specter
              :refer-macros [transform]
              :refer [transform MAP-VALS ALL FIRST LAST collect-one must]]))

(transform [:monsters ALL] str {:monsters [1 2 3]})

(transform [:quests ALL (collect-one FIRST) LAST]
           (fn [k val] (assoc val :quest-tag k))
           {:quests {:quest1 {:a :b :c :d} :quest2 {:e :f :g :h}}})

In my IDE, ALL and collect-one are highlighted as "cannot resolve."

I'm going to imagine that it's related to how Specter makes its own macros for defining things, such as: (from com.rpl.specter namespace)

(defnav
  ^{:doc "Navigate to every element of the collection. For maps navigates to
          a vector of `[key value]`."}
  ALL
  []
  (select* [this structure next-fn]
    (n/all-select structure next-fn))
  (transform* [this structure next-fn]
    (n/all-transform structure next-fn)))

Mind you, Cursive also cannot resolve defnav when looking at Specter source code.

Looks like it's a situation where Cursive needs more semantic insight into things that aren't simple (def ...) forms?

@tanya-coding
Copy link

I have the same issue and in addition to unresolved symbols, anywhere I use specter's END I get suggestions to import com.sun.nio.zipfs ZipFileSystem$END

@JustinSpedding
Copy link

I am still having the same issue with [com.rpl/specter "1.1.2"] and Cursive 1.8.2-2019-2. There are some other libraries that I use for which Cursive can create shims. Can we do the same thing with specter?

@jdhollis
Copy link

jdhollis commented May 20, 2023

I'm running into this as well. Perhaps #2767 would resolve many of the issues?

("Resolve … as…" + "specify" works great for defprotocolpath and extend-protocolpath, though.)

@mortenschioler
Copy link

Mitigated this problem by "resolving as..." on the following:

com.rpl.specter/defcollector clojure.core/defn
com.rpl.specter/defdynamicnav clojure.core/defn
com.rpl.specter/defmacroalias clojure.core/def
com.rpl.specter/defnav clojure.core/defn
com.rpl.specter/defrichnav clojure.core/defn

@jdhollis
Copy link

Mitigated this problem by "resolving as..." on the following:

com.rpl.specter/defcollector clojure.core/defn
com.rpl.specter/defdynamicnav clojure.core/defn
com.rpl.specter/defmacroalias clojure.core/def
com.rpl.specter/defnav clojure.core/defn
com.rpl.specter/defrichnav clojure.core/defn

This solved the problem for me. I guess I should have spent more time digging into the library…

Thanks!

@cursive-ide
Copy link
Owner

This is fixed as #2767.

@cursive-ide cursive-ide modified the milestones: 1.13.1, 1.13.1-eap9 Nov 27, 2023
@cursive-ide cursive-ide added the changed Marks issues describing changes to existing features label Nov 27, 2023
@cursive-ide
Copy link
Owner

Fix released in 1.13.1-eap9 on 2023-11-27.

@cursive-ide cursive-ide added the released-eap Marks issues which have had the fixes released in an EAP build label Nov 27, 2023
@AndyCorlin
Copy link

@cursive-ide should this now be working out of the box? Or do you need to manually set "resolve as"?

I'm on IntelliJ IDEA 2023.2.5 / Windows and just upgraded to EAP9, but it still doesn't resolve.

image

@cursive-ide
Copy link
Owner

@AndyCorlin You should have received a popup suggesting that you generate stubs - did you do that?

@cursive-ide
Copy link
Owner

Fix released in 1.13.1 on 2023-12-07.

@cursive-ide cursive-ide added the released Marks issues which have had the fixes released in a stable build label Dec 7, 2023
@AndyCorlin
Copy link

@AndyCorlin You should have received a popup suggesting that you generate stubs - did you do that?

Aha - I have seen that message over the years, but no idea what for and where it came from.

Now that I tried it I get:

Cursive Stub generation
com.intellij.execution.process.ProcessNotCreatedException Cannot run program "C:\Users\AndersCorlin\.jdks\corretto-1.8.0_392\bin\java.exe" (in directory "C:\BB\Gimli1\deeds-api"): CreateProcess error=206, The filename or extension is too long

Windows has a limitation of path names of 256 characters .There is registry setting where you can enable "long path names", which I have set, but the application must also be compiled with a manifest that it supports it.

For the normal REPL I have a similar problem, but that can be fixed by using "Shorten command line" = "JAR manifest".

@cursive-ide, does this give you any clues of how to fix it?

@mortenschioler
Copy link

@AndyCorlin try perusing #2021

@AndyCorlin
Copy link

Thanks @mortenschioler! I had to go through all modules and set it one by one, but then it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changed Marks issues describing changes to existing features released Marks issues which have had the fixes released in a stable build released-eap Marks issues which have had the fixes released in an EAP build
Projects
None yet
Development

No branches or pull requests

7 participants