Closed mars0i closed 2 years ago
@mars0i Thanks for your reporting! I'll have a look later. If you have a minimal project to reproduce, please let me know.
Thanks @liquidz .
Here is an example project that is not very minimal, but it illustrate the problem--if the problem shows up on your system. (It's so strange that I will not be surprised if you can't reproduce it easily.)
The attached zip file contains a tar file with a Leiningen repo. You won't be able to run the source files under src/clj, but that's not necessary to see the problem. (I can give you the full repo if you want.)
There are two source files, walks.clj and fileio.clj.
When I go to the bottom of fileio.clj and type K
or <Leader>hs
on the name spit-csv
, I get documentation and source, respectively. This works on the other function names in this file.
In walks.clj, if I go to the bottom and type K
or <Leader>hs
on path-with-food
or walk-stops
(both defined earlier in the file), I get the "Not found." error. However, if I type K
or <Leader>hs
on conj
or any other clojure.core function, they work.
I forgot to say that now the problem's occurring consistently in the same way (i.e. in walks.clj) whether I use --instant
or not. Except that in the original repo, if I start the repl with IcedJackIn
, sometimes the problem occurs in fileio.clj. I don't know. It is weird.
(I found two timeout variables in the vim-iced help file. At one point I tried increasing both of them to 10000 to see if that made a difference, but it didn't.)
@mars0i Sorry for late reply.
In my environment, [mason "20"]
in project.clj could not be found, and I failed to run iced repl
Could not find artifact mason:mason:jar:20 in central (https://repo1.maven.org/maven2/)
Could not find artifact mason:mason:jar:20 in clojars (https://repo.clojars.org/)
If successful, walks.clj
requires utils.math
and utils.random
these are not contained to attached file, so I can't evaluate the file.
When I removed [mason "20"]
, utils.math
and utils.random
to force to run iced repl
, I can get documentation like follows.
iced repl
vim src/clj/fileio.clj
:IcedConnect
spit-csv
:e src/clj/walks.clj
IcedRequire
to evaluate current buffer.walk-stops
Sorry about the MASON dependency. I should have removed that. And I didn't realize that you had to be able to evaluate the source files--I was trying not to burden you by sending a whole repo. But now I understand ....
OK! So what I didn't realize is that each file has to be require
d by IcedRequire
before vim-iced will know about the definitions. That is also why I thought I could give you a partial repo in which files were missing dependencies. (But I should have realized, regardless, that you wouldn't be able to start a repl with that project file with the MASON reference.)
And now it works! I'm happy. This is great. Thank you.
Part of what confused me is that I guess that the file that I'm in when I connect to the repl will automatically get require
d, so its definitions are available automatically. I was seeing that those definitions in the first file were available without me doing anything further, and the clojure.core definitions were available without doing anything further, but I didn't understand that I had to to run IcedRequire
so that vim-iced could find the other definitions. This also explains why sometimes I got definitions in one file and not the other, and sometimes it was the other way around: it depended on which file I was in when I connected to the repl.
I can see now that it makes sense that one has to tell the repl about each file using IcedRequire
(or <Leader>eb
): how else will it know about the definitions? But there's a lot that vim-iced does that just seems like magic to me anyway, so I just figured it was more magic. :-)
Again--thanks. I'm very happy about this.
I'm experiencing a strange error, and I can't report it properly because I can't localize the problem yet. I can point to specific files that illustrate the problem in the repo I'm working on, but I don't know what is different about them. I'm reporting the issue now because maybe you will have some suggestions about experiments to perform. Thank you!
The problem seems to be this:
When I run
iced repl
with no arguments, and then connect from Vim, in some of my source filesIcedDocumentPopupOpen
,IcedDocumentPopupShow
, andIcedDocumentShow
only work on functions in clojure.core. For other functions, including those defined in my source files and files in Clojure contrib libraries, I get the message "Not found."But when I run
iced repl --instant
and connect, those vim-iced functions work on all function references in the files mentioned above. However, now there are other source files in whichIcedDocumentPopupOpen
,IcedDocumentPopupShow
, andIcedDocumentShow
only work on functions in clojure.core.Summary: No matter what, I get "Not found." for some function references in some of my source files--but not other source files--but whether I include
--instant
or not withiced repl
changes which files have the problem.(One theory I have is that there's some kind of race condition, and whether
--instant
is used speeds up or slows down processing of source files.)