Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Eval-on-save requires two eval-entire-file commands #4

Open
kenny-evitt opened this issue Nov 10, 2015 · 1 comment
Open

Eval-on-save requires two eval-entire-file commands #4

kenny-evitt opened this issue Nov 10, 2015 · 1 comment

Comments

@kenny-evitt
Copy link

This was originally reported in LightTable/LightTable#2000.

I was able to reproduce this with a source build (since the 0.8.0-alpha release) on a Windows 7 computer. The steps to reproduce:

  1. Open LT.
  2. I opened my main HTML file.
  3. I eval-ed the entire HTML file. A browser tab opened with the web page.
  4. I made a change to the HTML file and saved it – the browser tab was not affected.
  5. I eval-ed the entire HTML file – the browser tab was refreshed.
  6. I made another change to the HTML file and saved it – this time the browser tab was refreshed.

I'm using the file web.html from this repo.

@kenny-evitt
Copy link
Author

@cldwalker I modified the eval-on-save behavior in my local copy of the HTML plugin to this:

(behavior ::eval-on-save
          :triggers #{:save}
          :reaction (fn [editor]
                      (let [editor-default-client (-> @editor :client :default)]
                        (lt.objs.console/log (if editor-default-client "if" "not-if"))
                        (when (and editor-default-client
                                 (not (clients/placeholder? editor-default-client)))
                        (object/raise html-lang :eval! {:origin editor
                                                        :info (assoc (@editor :info)
                                                                :code (ed/->val (:ed @editor)))})))))

I'm getting not-if logged in the console when I save the HTML file (when I follow steps 1-4 above).

Incidentally, is there a better way to inspect this behavior than what I did? I added a watch to the @editor expression but it logs a stack overflow exception.

If I add the same code to the CSS plugin, I get if logged in the console when I save the CSS file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant