Fork me on GitHub
#cider
<
2020-05-28
>
dev-hartmann09:05:17

Hey fellow clojurians, not sure if this is the right place to ask, but I'm having a repl issue and since I use emacs + cider thought this might be the right place

jr0cket10:05:48

The question is arguably better suited for #beginners channel as its not Cider specific.

dev-hartmann12:05:23

sure, thanks for replying anyways thumbsup_all just wasn't sure if it was an issue with the classpath that maybe wasn't available from a cider repl.

jr0cket14:05:39

The root cause is not always obvious 😁

dev-hartmann09:05:46

from within the repl I'm not able to read files from the resoures folder with http://clojure.java.io/resource

dev-hartmann09:05:05

I'm using deps.edn and have added resources to the paths vector

dev-hartmann09:05:52

interestingly io/file works

jr0cket10:05:47

@dev-hartmann file and resource functions read from different starting paths in the project. I believe file is from the root of the project and resource is from resources/ so you will need to adjust the file path accordingly. The following has an example, with the data files saved to the file space in /resources/data-sets/ so the path for resource starts at data-sets/ https://github.com/practicalli/covid19-dashboard/blob/master/src/practicalli/data_gov_uk.clj

dev-hartmann12:05:55

thanks for the pointer! I'm actually doing it exactly like that

dev-hartmann12:05:00

(defn load-config [resource profile]
  (-> resource
      ()
      (read-config)
      (get profile)))

dev-hartmann12:05:20

read-config coming from juxt/aero

dev-hartmann12:05:01

io/resource always returning null

dev-hartmann12:05:13

so I guess I have something misconfigured

dev-hartmann13:05:01

I'll post this to #beginners though, to not clutter up this thread

dominicm14:05:05

Just to expand further. io/resource is relative to any folders setup as class paths. Eg src, resources, test, clojure.jar, etc

jr0cket14:05:23

Ah, I did think that might be the case, thanks for confirming.

d.ian.b11:05:24

heey guys, how I can configure cider to use .nrepl.edn to shadow-cljs nrepl middleware?

bozhidar16:05:56

I haven’t seen any instructions how to use it standalone (without shadow kicking off the nREPL server), so you might have to ask at their issue tracker.

thheller18:05:55

the question is how do you add custom middleware to the nrepl server cider starts?

thheller18:05:02

NOT the one shadow-cljs starts.

bozhidar06:05:56

Yeah, I think that’s the question. Normally you’d do this either via your project config (e.g. project.clj or nrepl.edn).

d.ian.b14:05:02

but how I can jack-in shadow.api/repl from mine cider repl, without jacking in first with shadow-cljs but with clj?

adamfrey14:05:49

has anyone ever tried to get the *cider-test-report* buffer to open in a new emacs frame instead of the current behavior (for me, splitting the current emacs buffer in two)? I imagine you would have to do some overwriting of the functionality here: https://github.com/clojure-emacs/cider/blob/master/cider-test.el#L686

johanatan16:05:16

this is a pretty unfortunate bug: https://github.com/bbatsov/projectile/issues/1534 the only workaround is to switch to native mode (which then takes a long while to index and doesn't ignore .gitignore files, requiring repeating them in .projectile).

johanatan16:05:31

@bozhidar ^^

bozhidar18:05:51

@johanatan I think I’ve commented on this many times, as the ticket has been duplicated through the years - it’s not really a bug, it’s a limitation. If we apply postprocessing to the files returned by an external command (alien mode) we’re killing most of the benefits of using it, as this filtering is very expensive in Emacs Lisp.

bozhidar18:05:51

The native indexing is already slow, so the filtering isn’t that big a deal with it.

bozhidar18:05:02

Btw, did you try hybrid mode as well? I think it was somewhere in the middle. I haven’t had much time for Projectile lately, so I’m starting to forget what i’ve done there.

johanatan18:05:07

And what about native mode failing to respect gitignore?

johanatan18:05:27

Yep I tried hybrid and also see the failure to respect gitignore

bozhidar18:05:29

Well, I can’t see how this can happen - after all it’s simply shelling out to git. 🙂

johanatan18:05:25

What exactly is “alien mode” btw? What’s it shelling out to?

bozhidar18:05:01

Alien mode is shelling out the vcs or to find if the project is not VCS controlled.

bozhidar18:05:18

You can see in the defcustoms what exactly is invoking for each supported VCS.

johanatan18:05:32

So native mode also “shells out to git”?

bozhidar18:05:33

Hybrid is doing the same + some some file post-processing.

bozhidar18:05:56

No, native mode just indexes the project in Emacs Lisp. That’s why it’s native (to Emacs).

johanatan18:05:34

Ok but that’s where I see it fail to respect gitignore. So what did you mean by “I can’t see how that could happen since it just shells out to git”

johanatan18:05:15

I actually reject the premise that post processing on alien would be untenable. Alien presumably returns a short, relevant list and then to apply some additional pruning based on .projectile should be very fast.

johanatan18:05:24

But I guess that’s what “hybrid” is supposed to be. However hybrid isn’t respecting gitignore for me

bozhidar18:05:57

> Ok but that’s where I see it fail to respect gitignore. So what did you mean by “I can’t see how that could happen since it just shells out to git” That’s how the list of files is obtained https://github.com/bbatsov/projectile/blob/master/projectile.el#L624

bozhidar18:05:05

> I actually reject the premise that post processing on alien would be untenable. Alien presumably returns a short, relevant list and then to apply some additional pruning based on .projectile should be very fast. In a small project - sure, in a huge project you might have to check thousands of files against the ignored patterns. In Emacs Lisp that’s anything but fast. 🙂

johanatan20:05:55

i think if you're in the situation where the alien search didn't trim down the result set to something manageable, you're not in a situation to pick the final result yet and are most likely going to hit another key immediately thereafter, killing the first search and kicking off a new one. this process is going to repeat until you actually enter enough characters to begin to actually trim down the list to something manageable at which point a final post-process pass would not be burdensome at all.

johanatan20:05:33

all that you need for this to "feel" fast is the ability to kick off each search asynchronously and to kill earlier searches if keypresses are entered before they complete

johanatan20:05:42

it's an "interplay" between user and machine

johanatan21:05:16

a symbiosis / synergetic emergent phenomenon

johanatan21:05:23

and it would be awesome

johanatan21:05:19

and, sorry, i misspoke earlier, native does not exhibit any bugs (it's just really slow). hybrid and alien both have the same problem of .projectile ignores being ignored.

johanatan21:05:36

i.e., there appears to be no discernible difference between hybrid and alien

johanatan21:05:14

also, btw, SPC / (which uses ag) to search inside every single file is faster than projectile's filename only searching. how is this even possible? with my 100s of MBs of node_modules, we can search inside them faster than searching merely for their names?

johanatan21:05:33

unfortunately for me, there is a much higher chance of collision between filenames in node_modules/ that I don't care about and filenames in my codebase than there is for content in node_modules and content in my codebase.

johanatan21:05:16

and thus SPC / is imminently more usable than my current situation than SPC p f

johanatan21:05:47

and btw yet another bug is making this entire ordeal more painful that one would hope: https://github.com/bbatsov/projectile/issues/1541