Sasanidas / Rail

A generic NREPL client for Emacs, based on monroe
8 stars 7 forks source link

Rail and guile-nrepl integration #6

Open abcdw opened 1 year ago

abcdw commented 1 year ago

Making a separate issue for tracking a progress on guile-nrepl and rail integration.

There are no proper session management in guile-nrepl for now and many other features are missing, but we got it evaluating code: https://fosstodon.org/@abcdw/110546496818499923

For now it doesn't show the prompt after evaluation result returned, will need some time to figure out why.

Sasanidas commented 1 year ago

Ok, maybe it's because you are not sending the ns attribute?

Like in the example:


(cl-defmethod rail-test-eval ((type (eql :python)))
  (with-current-buffer (get-buffer-create (concat "*rail: " "localhost:7888" "*"))
    (sit-for 0.5)
    (let ((sum (rail-send-sync-request `(("op" . "eval")
                     ("session" . ,(rail-current-session))
                     ("code" . "3")
                     ("ns" . "user"))))
      (cgi-name (and (rail-send-sync-request `(("op" . "eval")
                           ("session" . ,(rail-current-session))
                           ("code" . "import cgi")))
             (rail-send-sync-request `(("op" . "eval")
                           ("session" . ,(rail-current-session))
                           ("code" . "cgi.__name__"))))))

      (should (string= "3" (cl-getf sum :value)))
      (should (string= "cgi" (cl-getf cgi-name :value))))))
abcdw commented 1 year ago

Have it hardcoded: https://git.sr.ht/~abcdw/guile-nrepl/tree/f5f55cd9ffff42bf1bf40a2742fd77cd10480c18/src/nrepl/server.scm#L101

Current message exchange with rail looks like this:

input: (("code" . "1") ("id" . "3") ("op" . "eval") ("session" . "1"))
response: (("status" . #("done")) ("session" . "1") ("ns" . "user") ("value" . "1") ("id" . "3"))
Sasanidas commented 1 year ago

I see, then I'm not sure what's happening :thinking:

abcdw commented 1 year ago

On 2023-06-15 09:10, Fermin MF wrote:

I see, then I'm not sure what's happening :thinking:

Sometimes it works, sometimes it doesn't, looks like some concurrency problem, will let you know if I find the cause.

-- Best regards, Andrew Tropin

abcdw commented 11 months ago

I've reproduced the problem. Used clojure nrepl as a server. BTW, Monroe losing the prompt too.

image

Steps to reproduce:

  1. Call cider-jack-in-clj.
  2. Connect with rail.
  3. Type (+ 1 2) expression.

I still not explored the rail source code, but today I cloned the repo, so at least I made it closer to me :smile:

Gavinok commented 10 months ago

It may have something to with this block of code https://github.com/Sasanidas/Rail/blob/master/rail.el#L266-L268

It seems like the request is still thought to be awaiting processing even though a response has been received.

abcdw commented 9 months ago

On 2023-11-06 19:11, Gavinok wrote:

It may have something to with this block of code https://github.com/Sasanidas/Rail/blob/master/rail.el#L266-L268

It seems like the request is still thought to be awaiting processing even though a response has been received.

Yep, it's very likely the cause. I think it's incorrect logic, you can have a lot of pending requests like completion/info/etc, while evaluation is finished and a prompt should be displayed.

-- Best regards, Andrew Tropin