They tie data to code. Copy pasting code does not work. Renaming a namespace breaks all keywords (bad if that data went into a DB).
I've started to think of them as an anti-pattern.
It's really hard to move away from it when autocomplete so strongly wants me to use them, haha.
Interesting. I’m actually planning to fix the copy paste issue, for keywords and also for symbols referring to vars. In the case of data, systems wouldn’t store them as aliased anyway normally, would they? I’d assume they’d be using a semantic kw object with ns and name parts. The alias thing is really just a reader shortcut, and doesn’t exist in e.g. EDN.
It is recommended for all data stored in Datomic to be qualified keywords. Data is inputted and outputted in keywords.
Sure, but what I mean is that Datomic won’t store it with the alias, it’ll store it with the full ns/name combo, right?
Oh, haha. Yes - that is correct. The reader always expands first.
It still seems to be mixing my data with my code. I have no need to require a namespace simply to refer to my data (I'm assuming that's the thought on how to fix it). I only want to work with the data.
I’m not proposing a solution, just trying to understand the problem better. Is there a case where the aliasing causes a problem? I get the copy/paste issue. Renaming namespaces shouldn’t be a problem, renaming aliases might if Cursive doesn’t handle that properly.
One way perhaps could be that paths that are in aliases/test/extra-paths and also under aliases/somethingelse/extra-paths could be handled per point 2. Approaching another way: only paths that only appear in the test alias would be automarked as test source roots
Of course this could break another edge case
Makes sense to only mark paths that are exclusively in :test alias as test source. Test classpath needs, by nature, to include source under test, and tools-deps doesn’t provide a way to inherit paths from other aliases, only from the top level :paths. If I include src/clj in the top level :paths it will also be part of the ClojureScript part of our build, which I am trying to avoid.
Of course there is the possibility to invoke test with more aliases to combine the needed classpath, something like clj -A:clj-src:test
, but there is something nice about expecting all projects to run tests with the simple clj -A:test
@cfleming
> 2. If you have other source roots (either from `:paths` or some `:extra-paths`), if you have manually marked those as a test root then Cursive will continue to respect that.
This is great, indeed works!
Can it be done also for “Resources root”? Right now if I put the “resources” folder under :path
it override-marks it with “Source root”, and if I put in :extra-paths
it just clears my marking.
Yeah, I’m not sure about making that change, since it’s very hard to predict what it might break. I guess the effect would be limited to the IDE (i.e. it won’t break anything for deps itself), and the workaround would just be to manually mark those cases as tests.
> Can it be done also for “Resources root”? Right now if I put the “resources” folder under :path it override-marks it with “Source root”, and if I put in :extra-paths it just clears my marking.
In :extra-paths
it will also mark as a source root if the alias is selected to be synced as described in the doc link above. Cursive doesn’t support resource paths for deps, because deps itself doesn’t support them - it only has the concept of “things which are on the classpath”. I wouldn’t even worry about the test marking (since deps doesn’t support that concept either), except that some things in IntelliJ rely on it.
Are there any clj-kondo users that can help @jtlocsei?
Heh, I am happy I was able to help anyway. 😀
@kari.marttila Take care!
I will! Thanks!
He just let me know that it works using the LSP plugin
@jtlocsei I use clj-kondo with Cursive (using LSP) and it should just work. Do you see the little green ball in bottom right info area saying that connection to LSP server is established? Are you sure the path to your clj-kondo standalone jar is correct? Are you sure you are using stanalone version? I could have a screen sharing session with you but unfortunately I was suddenly hospitalized last weekend and now mostly laying in bed without my gallbladder and a huge incision carve in my belly and cannot sit. 😀
Ah... I missed that he already got it working with LSP.
@kari.marttila I appreciate your offer of help! I got it working before I saw your comment but your comment was still useful because I hadn't noticed the green ball with the connection info. Occasionally the LSP fails to load so it's handy to be able to restart it from the green ball. Good luck with the recovery from your surgery! It sounds like a big surgery.