This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-26
Channels
- # asami (2)
- # babashka (1)
- # beginners (31)
- # calva (11)
- # clj-together (3)
- # clojure (43)
- # clojure-europe (6)
- # clojure-norway (1)
- # clojurescript (14)
- # core-async (3)
- # core-logic (24)
- # cryogen (6)
- # datascript (2)
- # datomic (3)
- # fulcro (35)
- # honeysql (2)
- # hyperfiddle (12)
- # kaocha (3)
- # lsp (11)
- # off-topic (10)
- # pathom (2)
- # reagent (14)
- # releases (1)
- # sci (11)
- # shadow-cljs (27)
- # tools-deps (7)
hi all, im looking for a way to automatically create test ns for current ns with emacs if it doesn’t exist yet, i’m using cider, clojure-lsp, projectile and sometimes cljr. Usual to open test ns I use projectile-toggle-between-implementation-and-test and want to create new test ns if it doesn’t exists. It feels like pretty common use case and I believe there is a ready to use fn to do so, but I can’t find one.
I can't remember the var name but try to toggle and look in the message area it'll tell you the name to set to t so it will automatically create one
thanks, don’t know how I could miss it, maybe I have to stop working in early morning (: the variable is projectile-create-missing-test-files
There is a clojure-lsp code action to create a teds for the current fn, creating the test ns and the function to be tested
yes, i saw such fn in clojure-lsp, but somehow it does nothing when i call it from emacs lsp-mode, either nothing appears both in lsp-log and messages buffers, even if the test ns already exists, maybe you know, where should I look also?
I believe clojure-lsp cannot recognise my tests because on lsp-clojure-show-test-tree it outputs No Clojure test tree data found. I’ve already added test to source paths (without alias) after i’ve tried to change classpath-cmd in lsp config.
This works well for me : https://github.com/rags/toggle-test
Less magic, easier to figure out if it doesn't work
@UJ1UZGJ75 if you have a simple repro, feel free to open a issue on clojure-lsp
Thanks, I should get rid of additional stuff in my config and try to reproduce it a in clean env.
I figured out the problem, lsp-mode incorrectly detected project root and started lsp in my projects directory, not in the directory of the project, where i do tests. It was fixed enabling lsp-auto-guess-option. thank you all for your help
I use cider
, and I remember that I was able to follow a definition from my code to a library I depend on, make some changes there, evaluate it, and have the new behavior in my code. I don't seem to be able to do that anymore. Did anything change in that respect recently?
Just so answer your question, the files are opened as read only by default, so toggle that mode
thanks @UK0810AQ2, I did that, made the change, but nothing seems to happen when I evaluate that file (the behavior doesn't change)
Do you use Leiningen? Did you access the library via a symlink in the "checkouts" directory?
Yikes. So, in a collection scenario, I innocently conj
ed a value onto nil and got a list, and so subsequent collections kept adding to the front of the list. Now I know.
So this could be a performance-sensitive deal. I recall vaguely things about Clojure vectors being faster because of the underlying Java.
Is that recollection correct? Should I start off with [] so my collector creates a vector, or is a list as fast?
Processing wise, I do expect to be wanting to read these sequentially encountering later items first.
I believe what makes vectors faster is that the values are colocated in memory (vectors store values in chunks, for each of which the underlying storage is an array). I think it's OK to start with an empty vector. In my experience, the vector is the go to data type for sequential data and I only use lists rarely
If you need more performance, you can look into transients and transducers
As an alternative to passing the empty vector as the initial value you could also (fnil conj [])
It would very much depend on your planned pattern of access. Vectors are optimized for adding & removing items at the end -- and have indexed access (as well as sequential). Lists are optimized for adding & removing items at the front -- and for sequential access.
(there's also a persistent queue if you need that kind of construction/access pattern)
Thx, all! Much more, compute intensive processing will be done on the results than in collecting them, so colocation souds good. I'll go with vectors for a start.
Anybody know what the successor to the Friend library (https://github.com/cemerick/friend) is these days? I'm unhappy with my current permissions model and reckon there's got to be a standard, de-fact or otherwise, for modelling authorization.
Looks like Buddy is also "in maintenance mode" unless I'm looking in the wrong place.
Checked there. The buddy-auth user guide also describes itself as "in a maintenance mode." https://funcool.github.io/buddy-auth/latest/user-guide.html
If people are out there using it I won't turn my nose up at it. Not everything has to have a commit in the last month. But gives one pause when starting a new project when a major dependency isn't being actively worked on.
People are using it. :) It's not described as deprecated. While the project is looking for a maintainer, the amount of open issues is small and "maintenance mode" means (at least to me) that its API is complete.
Just looking now. Seems like Keycloak is more an SSO service. I'm looking for something reasonably light that can handle "is user X allowed to do Y."
How is user X abilities encoded/stored/retrieved? Is using JWTs and the https://www.rfc-editor.org/rfc/rfc7519#section-4.1.3 an option? Edit: Some people (including me) wrote https://github.com/sikt-no/clj-jwt, a small wrapper over buddy, for unsigning JWTs and fetching keys easily.
I’m biased, but you might want to consider decoupling authorization :) https://github.com/anderseknert/clj-opa