Fork me on GitHub
#cursive
<
2017-07-10
>
bfabry01:07:35

I wish I had some sort of hybrid between the repl input pane and a scratch buffer

bfabry01:07:31

like, I want to be able to scroll up and down, build up forms piece by piece, edit etc, but I want option+enter to send a require to the repl, not add stuff to an ns form

cfleming01:07:27

@bfabry Busy right now but will write more later, I have some ideas around that.

onetom06:07:14

@bfabry +1 for the idea...

Oliver George07:07:36

Quick sanity check. Is there a way to get the core.match/match macro to syntax highlight correctly? The binding variables in particular don't get picked up.

Oliver George07:07:17

Just checking that there isn't a workaround

cfleming09:07:35

@olivergeorge No, no workaround sorry.

Oliver George10:07:30

cfleming: No worries. Thanks for confirming.

shidima_09:07:38

I'm using Intellij with cursive, but it seems to be unable to resolve some of my code (like (db/add-message). I have been watching a video by @yogthos and it seems he has the same problem in the screen cast. So I'm assuming it is normal?

cfleming10:07:02

@shidima_ What is db/add-message? Which lib does it come from?

shidima_10:07:32

I started a new projcet with lein new luminus guestbook +sqlite +swagger +cljs and import the db namespace as require guestbook.db.core :as db

cfleming10:07:29

If you look in that namespace (you can Ctrl/Cmd-click on the ns name), what does the definition of add-message look like?

shidima_10:07:03

(ns guestbook.db.core
  (:require
    [conman.core :as conman]
    [mount.core :refer [defstate]]
    [guestbook.config :refer [env]]))

(defstate ^:dynamic *db*
          :start (conman/connect!
                   {:datasource
                    (doto (org.sqlite.SQLiteDataSource.)
                          (.setUrl (env :database-url)))})
          :stop (conman/disconnect! *db*))

(conman/bind-connection *db* "sql/queries.sql")

cfleming10:07:34

Ok, it looks like it’s dynamically creating vars from that sql file.

cfleming10:07:43

Cursive will have problems with that, yes.

shidima_10:07:09

Alright, expected behavior then 🙂

cfleming10:07:35

Not desired, but sadly expected, yes 🙂

shidima_10:07:16

Sometimes its a bit hard to know if I'm doing something wrong or if its part of the tool chain

shidima_10:07:34

Thanks for making it clear

cfleming10:07:01

No problem, definitely not your fault this time.

onetom13:07:16

@shidima_ would u mind sharing which video were u watching. pls? btw, what's the goal with combining mount and dynamic vars? sounds a bit odd to me

onetom21:07:47

@shidima_ i've tracked down where did this (defstate ^:dynamic *db* ...) come from. it was introduced when mount was integrated into the luminus template: https://clojars.org/luminus/lein-template/versions/2.9.8.64 at that time (2015-11-18) it used mount:0.1.2 (https://clojars.org/mount/versions/0.1.2) which came from this commit: https://github.com/tolitius/mount/commit/a7770968dbfa4d010ed3827ce0108db5d0e27741 if you check that out, it does not mention ^:dynamic anywhere in the source code, so i think the luminus template just carried it around with itself in the hope of maintaining some kind of a backward compatibility, however i think it was simply a breaking change, since they fundamentally changed how *db* should work and what should it mean. current luminus docs doesn't show any ^:dynamic *db* stuff either: http://www.luminusweb.net/docs/components.md intrestingly there is an article from 2015-12-05 from yoghtos where he says: > Conclusion > ... > While it's possible to formalize the handling of stateful resources, using libraries such as component, I personally have not found this to be necessary in my applications. — https://yogthos.net/posts/2015-12-05-LuminusComponents.html

onetom21:07:56

so in my conclusion, it should just be (defstate db :start ... :stop ...) i will bring it up on #luminus