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

Does not work IcedDocumentOpen with shadow-cljs #135

Closed
liquidz opened this issue Aug 5, 2019 · 27 comments
Closed

Does not work IcedDocumentOpen with shadow-cljs #135

liquidz opened this issue Aug 5, 2019 · 27 comments
Labels
bug Something isn't working

Comments

@liquidz
Copy link
Owner

liquidz commented Aug 5, 2019

Branched from #126 (comment)

@liquidz liquidz added the bug Something isn't working label Aug 5, 2019
@liquidz
Copy link
Owner Author

liquidz commented Aug 5, 2019

It works :IcedDocumentOpen for cljs.core/defn and cljs.core/println with shadow-cljs.
So this may be a problem in cider-nrepl(orchard) or shadow-cljs.

@liquidz
Copy link
Owner Author

liquidz commented Aug 6, 2019

spacemacs + shadow-cljs works well for user defined functions..
hmm..

@liquidz
Copy link
Owner Author

liquidz commented Aug 7, 2019

I got it! iced#nrepl#ns#eval is the cause.
In shadow-cljs, evaluating only (ns foo.core ...) form will clear all vars evaluated before.

@liquidz
Copy link
Owner Author

liquidz commented Aug 7, 2019

@knubie I fixed :IcedDocumentOpen to work with shadow-cljs.
Could you try dev branch?

@knubie
Copy link
Contributor

knubie commented Aug 7, 2019

@liquidz It works now!

@knubie
Copy link
Contributor

knubie commented Aug 7, 2019

I'm seeing a similar issue with :IcedClojureDocsOpen any? returns "Note found."

nvim 0.3.8
iced-nrepl 0.6.0
cider/cider-nrepl 0.22.0-beta9

@liquidz
Copy link
Owner Author

liquidz commented Aug 7, 2019

@knubie Are you sure that you executed :IcedClojureDocsOpen in cljs file?
clojuredocs.org has no documents about cljs.core, so cljs.core/any? will not be found.

@knubie
Copy link
Contributor

knubie commented Aug 7, 2019

@liquidz Does :IcedClojureDocsOpen only work in clj files?

I tried :IcedClojureDocsOpen clojure.core/any? as well, and got the same result.

@liquidz
Copy link
Owner Author

liquidz commented Aug 7, 2019

@knubie

Does :IcedClojureDocsOpen only work in clj files?

Currently, yes.
It will work in cljs file if clojuredocs supports cljs core libraries.

I tried :IcedClojureDocsOpen clojure.core/any? as well, and got the same result.

Oh sorry!
:IcedClojureDocsOpen command does not support qualified symbol yet.
So you need to execute :IcedClojureDocsOpen any? in clj session.

I'll fix to support qualified symbol for :IcedClojureDocsOpen command.

@liquidz
Copy link
Owner Author

liquidz commented Aug 8, 2019

@knubie I fixed :IcedClojureDocsOpen command to work with qualified symbol in dev branch.

@knubie
Copy link
Contributor

knubie commented Aug 20, 2019

@liquidz Sorry for the late reply. Just tried :IcedClojureDocsOpen clojure.core/any? in dev and got the following error:

Unexpected error: {'throwpoint': 'function <SNR>113__publish[19]..<SNR>113__invoke_callback[6]..<lambda>36[1]..<SNR>132_show_doc, line 2', 'exception
': 'Vim(let):E716: Key not present in Dictionary: clojuredocs'}

@liquidz
Copy link
Owner Author

liquidz commented Aug 20, 2019

@knubie Oh sorry! Could you pull latest dev branch and execute IcedClojureDocsRefresh command?
https://vim-iced-nightly.netlify.com/vim-iced.html#%3AIcedClojureDocsRefresh

We tweaked data structure.
clojure-emacs/cider#2663 (comment)

@knubie
Copy link
Contributor

knubie commented Aug 21, 2019

@liquidz Tried refreshing the docs, but got the same error with command :IcedClojureDocsOpen clojure.core/any?.

Auto connecting...
Connected.
CLJS repl has started.
Start to refresh ClojureDocs...
Finish to refresh ClojureDocs.
Fetching...
Unexpected error: {'throwpoint': 'function <SNR>113__publish[19]..<SNR>113__invoke_callback[6]..<lambda>41[1]..<SNR>132_show_doc, line 2', 'exception
': 'Vim(let):E716: Key not present in Dictionary: clojuredocs'}

@liquidz
Copy link
Owner Author

liquidz commented Aug 21, 2019

@knubie OK. I could reproduce the problem.
I guess your shadow-cljs.edn contains [cider/cider-nrepl "0.21.1"].

Current dev branch requires [cider/cider-nrepl "0.22.0-beta11"] and some additional middlewares.
Could you update your shadow-cljs.edn like the following?
https://vim-iced-nightly.netlify.com/vim-iced.html#vim-iced-manual-shadow-cljs

@knubie
Copy link
Contributor

knubie commented Aug 21, 2019

Thanks @liquidz it works now!

I updated

[cider/cider-nrepl] 0.21.10.22.0-beta11
[iced-nrepl] 0.4.10.6.0

and added cider.nrepl/wrap-clojuredocs to [:nrepl :middleware] list in shadow-cljs.edn.

Is it possible for vim-iced to detect missing dependencies, or mismatched dependency versions? That would make it easier to debug in the future.


Another suggestion;

When executing something like :IcedClojureDocsOpen any? (unqualified symbol) in a cljs file, we could return a message like:

Could not find `cljs.core/any?` on clojuredocs.org

(Showing the fully qualified symbol)

Or maybe detect if the ns has cljs and return a canned response like:

Tried searching for `cljs.core/any?`, but clojuredocs.org does not have docs for `cljs.core`.

@liquidz
Copy link
Owner Author

liquidz commented Aug 22, 2019

@knubie Great!

Is it possible for vim-iced to detect missing dependencies, or mismatched dependency versions? That would make it easier to debug in the future.

It seems good to me too.
I'll try to do it!

Another suggestion;
(Showing the fully qualified symbol)

Currently vim-iced shows fully qualified symbol like follows. (c.f. 838d0d7)
Not found "cljs.core/any?" in ClojureDocs.
Your dev branch in your computer may not be latest.

Tried searching for cljs.core/any?, but clojuredocs.org does not have docs for cljs.core.

This message is kind and nice!
I'll update to detect cljs namespace!

@liquidz
Copy link
Owner Author

liquidz commented Aug 23, 2019

@knubie

Tried searching for cljs.core/any?, but clojuredocs.org does not have docs for cljs.core.

This message is kind and nice!
I'll update to detect cljs namespace!

I updated in #136
And detecting missing dependencies and middlewares in shadow-cljs.edn will support in #140

@liquidz liquidz closed this as completed Aug 23, 2019
@knubie
Copy link
Contributor

knubie commented Sep 18, 2019

Hi @liquidz I'm seeing a regression with :IcedDocumentOpen where I'm getting "Not found." for a symbol in my project.

Just checkout out the latest master branch of vim-iced and updated my dependencies cider-nrepl and iced-nrepl to 0.22.3 and 0.6.4

@liquidz
Copy link
Owner Author

liquidz commented Sep 18, 2019

@knubie
Thanks for your reporting.
I'll have a look later.

BTW I saw this cider's issue.
clojure-emacs/cider#2713 (comment)

According to this issue, there seems to be a problem with latest shadow-cljs, so could you try shadow-cljs 2.8.40?

@knubie
Copy link
Contributor

knubie commented Sep 18, 2019

Thanks for the quick reply @liquidz , just tried downgrading shadow-cljs to 2.8.40, but still getting the same result.

@liquidz
Copy link
Owner Author

liquidz commented Sep 18, 2019

Oh it may be a regression, sorry.
I'll have a look it.

@knubie
Copy link
Contributor

knubie commented Sep 18, 2019

No problem! Just noticed it because I was testing the new floating windows in neovim 0.4.0 and saw that it was no longer working.

@liquidz
Copy link
Owner Author

liquidz commented Sep 18, 2019

@knubie I could reproduce the problem.
But when I switched shadow-cljs version to 2.8.40, it works for me.

Could you confirm your shadow-cljs's version is exactly 2.8.40 ?
Following is my output when I ran shadow-cljs watch app.

shadow-cljs - config: /home/uochan/opt/foo/shadowtest/shadow-cljs.edn  cli version: 2.8.40  node: v9.11.2                                                                                                                                                                              shadow-cljs - updating dependencies                                                                                                        
Retrieving thheller/shadow-cljs/2.8.40/shadow-cljs-2.8.40.pom from https://clojars.org/repo/                                               
Retrieving thheller/shadow-cljs/2.8.40/shadow-cljs-2.8.40-aot.jar from https://clojars.org/repo/                                          
shadow-cljs - dependencies updated                                                                                                         
shadow-cljs - HTTP server available at http://localhost:8700                                                                               
shadow-cljs - server version: 2.8.40 running at http://localhost:9630

@knubie
Copy link
Contributor

knubie commented Sep 18, 2019

@liquidz

🤦‍♂ I accidentally changed package.json to ^2.8.40, so it was still using 2.8.52.

But after I downgrade for real this time. I'm still getting the "Not found." ☹️

$ /.../node_modules/.bin/shadow-cljs watch memo
shadow-cljs - config: /Users/matt/Code/mochi/shadow-cljs.edn  cli version: 2.8.40  node: v10.13.0

Should I use a specific version of cider-nrepl and iced-nrepl?

Is there a debug flag I can enable to help you figure out the issue?

@liquidz
Copy link
Owner Author

liquidz commented Sep 18, 2019

@knubie

Should I use a specific version of cider-nrepl and iced-nrepl?

No. I'm using cider-nrepl 0.22.3 and iced-nrepl 0.6.4 too.

Is there a debug flag I can enable to help you figure out the issue?

Could you execute :let g:iced#debug = v:true after nREPL connection?
Then executing :IcedDocumentOpen will output debug messages, so please copy&paste the result of :messages command.

@knubie
Copy link
Contributor

knubie commented Sep 19, 2019

@liquidz

I know what the issue is now. I forgot to run :IcedStartCljsRepl ... first. 🤦‍♂️

Thanks for helping me work through the issue. Sorry for being a little slow.

Maybe :IcedDocumentOpen (and other commands that rely on a repl) should check if one is running first, and return a message like: Please start a cljs repl first. :IcedStartCljsRepl? Might help people that run into a similar issue in the future.

@liquidz
Copy link
Owner Author

liquidz commented Sep 19, 2019

@knubie No problem!

Maybe :IcedDocumentOpen (and other commands that rely on a repl) should check if one is running first, and return a message like: Please start a cljs repl first. :IcedStartCljsRepl? Might help people that run into a similar issue in the future.

OK! I already have a function to check session validity.
https:/liquidz/vim-iced/blob/0.12.2/autoload/iced/nrepl.vim#L100-L110
So I'll fix to use this in :IcedDocumentOpen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants