Fork me on GitHub
#cursive
<
2019-09-12
>
cfleming01:09:47

@kenny Simple explanation, libhoney for some reason has the org.slf4j class in its jar:

kenny14:09:00

That is strange. It seems more recent versions do not have that issue.

onetom05:09:30

<sourceFolder url="file://$MODULE_DIR$/../../clojure/test" isTestSource="true" />
this isTestSource setting in my module .iml file is getting reset to false after re-importing my deps.edn. the test support in cursive doesn't seem to work without marking the test directories as such. is there a way to get around this? can i somehow specify in my deps.edn file that my test directory is special?

cfleming07:09:57

@onetom Are you on the dev build, or the old deps integration?

onetom08:09:18

good point... i thought i was on the latest dev version, but im switching between a laptop and a desktop machine and one was on snapshot1 and the other was on snapshot2 i will try to repro the situation later today and report back

cfleming08:09:24

So in the old integration, if it came from an alias containing “test”, then the folder would be marked as a test folder. But I actually think I neglected to add that logic in the new integration - I’ll fix that tomorrow.

cfleming08:09:15

Regrettably deps doesn’t distinguish between source and test, so I’m left with something like that. If you have any other suggestions for how to identify test folders, let me know.

onetom08:09:22

unfortunately im still flying a bit blind regarding tools deps, so no idea how should it work really. i don't even know how can i check what is the combined effect of applying multiple aliases. in the cursive Clojure Deps tool window i see a test (system) alias, but i don't know where is it coming from. it's not in some system deps.edn file, because that doesn't exist. there is a :test alias in my ~/.clojure/deps.edn but that's commented out. sounds like it's something hard-coded, just like the default maven and clojars repos.

onetom08:09:33

so im actually not sure whether should i shadow that system :test alias with mine, because i don't even know what does it contain. then i have no idea how cursive is using it. does the test runner rely on it? what's the effect of turning it out in the Clojure Deps tool window? would it affect my Run with Deps REPL run configurations, which don't have any special options specified?

onetom08:09:11

it's all very fuzzy to me. and i don't really expect answers, i just wanted to give you an idea what an average user like me is pondering over 🙂

cfleming09:09:12

There actually is a system deps file. If you’re on something unixy you can see where it is using -Sdescribe. If you’re on windows, it’s currently bundled with Cursive but is also present in the tools.deps jar, and Cursive will shortly use that one for modern deps versions which contain it.

onetom13:09:50

maybe some metadata extension like this could work and won't collide with future deps.edn keys:

{:paths ^{:cursive/test-paths ["test"]}
        ["src" "test" "../data" "../rules"]
,,,}

onetom13:09:15

similarly :java-source-paths and :resource-paths would be very welcome too. i was missing them on my last project, where i had to use some autogenerated protobuf java sources and the classes folder too

kenny14:09:06

Why does IntelliJ care if a source file is a test file or not?

onetom15:09:29

it's used for the cmd-shift-t (navigate test) feature

kenny15:09:57

Couldn't you determine that by indexing deftests?

onetom16:09:27

it also highlights the test sources in the project directory tree with a different color and the editor tabs if they are open, so you can distinguish them from the sources easier

onetom16:09:57

and i guess cursive uses it for showing the test result indicators in the gutter too?

kenny16:09:24

Seems like that can be done for anything that is a deftest. The highlighting thing is nice, I suppose.

onetom16:09:01

something didn't work when the test sources werent marked as test sources... can't remember what was it but i will report here when i can reproduce it

cfleming21:09:35

Cursive actually doesn’t care, IIRC - if there are things that don’t work it would be interesting to know so I can look at them. It’s possible that the test navigation uses it, in particular for deciding where to create a new test ns if it doesn’t exist.

onetom04:09:33

I just tried to do Cmd-Shift-T to create a test for a new function I just wrote. 1. the Choose test for... popup window appears 2. I can select the sole Create New Test... menu item in it 3. a Choose destination popup appears with a grey No matches found message in the middle of it

onetom04:09:09

but if I mark my test dir to be Test Sources Root, it actually jumps to the corresponding test file and creates a new deftest form for me, which I really like! Great feature, Colin; thanks!

cfleming08:09:36

Ok, thanks, I’ll check that out and see if I can make it work sensibly without test roots, and I’ll also fix the test root import.

stijn07:09:13

is there an option to adhere to the clojure style guide automatically?

stijn07:09:22

I have it almost configured, but have a hard time doing this https://guide.clojure.style/#one-space-indent while still keeping 2 spaces for special forms

cfleming08:09:26

@stijn Do you have Preferences | Editor | Code Style | Clojure | General | One space list indent selected?

stijn08:09:12

ah yes, that works

stijn08:09:18

can you have map values aligned only when they are on the same line as the key?

stijn08:09:37

{:a :b
 :b :c
 :c
 :this}

stijn08:09:17

instead of

{:a :b
 :b :c
 :c
    :this}

stijn09:09:11

ok, turns out that's not needed for the codebase i'm working on 🙂

cfleming09:09:32

@stijn No, but you should be able to 🙂