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

practicalli-johnny10: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.

practicalli-johnny14: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

practicalli-johnny10: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

practicalli-johnny14:05:23

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

Ian Fernandez11: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).

Ian Fernandez14: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).

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