-
Notifications
You must be signed in to change notification settings - Fork 13
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
function definition not render as kind/code #151
Comments
Hi, Would you like to elaborate on what you mean by "Clay outputs the ns part, but the add function is not rendered as kind/code"? Thanks. |
thank you for looking into this, I made a reproducible repo https://github.com/schneiderlin/clay-151. |
Nice! Will see if I can reproduce it using your repo.
…On Tue, Sep 24, 2024 at 07:49 Lin ZiHao ***@***.***> wrote:
thank you for looking into this, I made a reproducible repo
https://github.com/schneiderlin/clay-151.
2 branches in this repo, both 2-beta15 and 2-beta16 can reproduce.
—
Reply to this email directly, view it on GitHub
<#151 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKVIOQNJWKF46L27PRB2XLZYCSJHAVCNFSM6AAAAABN6NAAXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZG44TIMJXGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@schneiderlin @whatacold I tried the demo and could not reproduce the problem: @schneiderlin, let us look into this next time we meet? |
I can't reproduce it either. P.S. Maybe we should have some logging mechanism to see what's happening while generating docs. |
Since we can't reproduce it, we can do little. @schneiderlin Maybe you can set a breakpoint on |
here is what I found, let me elaborate on this clay/src/scicloj/clay/v2/read.clj Line 41 in 7e1fb9d
but in my environment, (def code "(ns macro1\r\n (:require \r\n [scicloj.kindly.v4.kind :as kind]))\r\n\r\n\r\n(defn add [x y]\r\n (+ x y))\r\n")
(def forms (read-forms code))
(def form1 (first (read-forms code))) ;; ns form
(def form2 (second (read-forms code))) ;; defn add form
(meta form1) ;; => {:source "(ns macro1\n (:require \n [scicloj.kindly.v4.kind :as kind]))" :line 1 :column 1 :end-line 3 :end-column 39}
(meta form2) ;; => {:line 6 :column 1 :end-line 7 :end-column 11} |
why can't reproduceWhenever a form prefix with problemClay use the following example shows the difference between (let [reader (clojure.tools.reader.reader-types/source-logging-push-back-reader "\r\n(+ x y)")
_ (read-char reader) ;; consume the first \r
p-ch (peek-char reader) ;; peek will return \n
r-ch (read-char reader) ;; but when read return \n, it will read again, return \(
]
(= p-ch r-ch)) ;; => false this is also reported in tools.reader bug tracker And reader use possible fixs
what would you think? @daslu |
@schneiderlin, thanks for this investigation and detailed explanation. I will use your preprocessing advice. Soon, we will have a better fix through #61. |
When I have a namespace like this:
Clay outputs the ns part, but the
add
function is not rendered as kind/codetools.reader seems to drop the :source field of the second form
The text was updated successfully, but these errors were encountered: