Fork me on GitHub
#cursive
<
2020-02-13
>
steveb8n03:02:18

Q: some of my projects automatically create modules for deps.edn local roots and others don’t. does anyone know how to force this to happen or to add modules for those that are missing?

cfleming07:02:47

There’s a bit of doc at the end of this bit talking about that: https://cursive-ide.com/userguide/deps.html#working-with-multi-module-projects

cfleming07:02:04

They’ll be automatically added if they’re required using :local/root

gibb05:02:25

If you're a IDEAVIM user this wiki page changed my cursive workflow for the better: https://github.com/cursive-ide/cursive/wiki/Mapping-IdeaVim-actions-to-Cursive-actions

👍 4
Ivan Koz05:02:17

for non IDEAVIM users, there is Actions Tree plugin https://plugins.jetbrains.com/plugin/11076-actions-tree

cfleming10:02:36

Nice, for a simple version of that that doesn’t require a plugin, there’s also Quick Lists: https://www.jetbrains.com/help/idea/customize-actions-menus-and-toolbars.html#

imre11:02:26

Using the latest Cursive EAP and idea 2019.3.3 I'm getting a previously unseen error on deps refresh:

imre11:02:32

2020. 02. 13.
12:19	Errors during project resolution
			The following errors were found during project resolve:
			/Users/redacted/path/deps.edn:
			Destination path "alsoredacted" already exists and is not an empty directory

imre11:02:51

and also

imre11:02:13

12:24	Errors during project resolution
			The following errors were found during project resolve:
			/Users/redacted/path/deps.edn:
			unable to find valid certification path to requested target

imre11:02:31

Invalidate caches/restart was the solution

tanzoniteblack19:02:41

I have a multimodule project that relies on using tools-deps's local paths from the "top" module. When I use Load File in REPL from a clojure file in the src directory of one of the sub-modules, everything works fine, but if I attempt to do the same from a file in the test directory of a sub-module, I get an error that cursive can't load the file because it's not in scope for the module used to start the repl. How can I make it so I can work on tests for submodules via only loading a single repl for the topmost module?

cfleming20:02:34

Hmm, this is tricky. With Deps, test code isn’t transitive, because aliases aren’t.

cfleming20:02:46

So Cursive is technically doing the right thing, because that code wouldn’t be available to your project running outside of Cursive either. Whether that’s a useful thing to enforce is another question.

cfleming20:02:48

The best solution I can think of would be to have a test-support module containing the shared test code in a src directory, and then depend on that from both modules. You could ask over in #tools-deps if there are any better solutions.

tanzoniteblack20:02:01

is there any reason why adding the code to extra-paths shouldn't work?

cfleming20:02:16

Don’t you get an error when doing that that modules can’t share source paths?

tanzoniteblack20:02:35

I do get an error about that when I try to do it via intellij's module editor, yeah

cfleming20:02:40

I’m pretty sure you should, because they can’t 🙂

cfleming20:02:59

Are you refreshing your project after updating your deps.edn?

tanzoniteblack20:02:09

I was adding that into my deps.edn from the top level project, so that the module actually does include that source path in it

tanzoniteblack20:02:31

yep, I'm refreshing my project after updating the deps.edn

cfleming20:02:56

Hmm. IntelliJ should complain about that, because I’m pretty sure that’s not allowed.

cfleming20:02:11

I’m not sure what the best solution is here, honestly. It’s a deps limitation (can’t easily share test code) mixed with an IntelliJ one (can’t have the same source in two modules). Is factoring the shared test code out into a third module an option?

tanzoniteblack20:02:21

file structure here: API (deps.edn): - src - test - project1 (deps.edn) - src - test - project2 (deps.edn) the entire project here, our monolithic API, is a single project. Some components of it are used in other projects as libraries, which is why it's broken out

tanzoniteblack20:02:19

realistically, the tests in all of the subprojects are just parts of the entire main project. I'd be perfectly happy to have the entire thing treated as a single project in intellij, but we do have the dependencies defined throughout the various subprojects

tanzoniteblack20:02:53

so "shared test code" in this case just means tests in various sub-folders...which happen to have their own deps.edn

tanzoniteblack20:02:37

I suppose that we can break out the tests into only the top level, instead of keeping them organized with the libraries, but it's going to annoy the rest of my team that we're restructuring our folder to workaround limitations in intellij/cursive, when they don't have these issues in emacs/cider. Also, I'm fairly confident that I had worked around this bug previously using the :extra-paths hack I mentioned earlier. But, that might've broken when upgrading intellij at some point?

tanzoniteblack20:02:36

granted, just highlighting the whole file and sending that whole thing to the repl is also a valid work around

tanzoniteblack20:02:20

which might be a "fix" that could be implemented in cursive? When a file isn't part of the module the repl was created in, just send the entire contents of the file to the repl instead?

tanzoniteblack20:02:12

doesn't fix the test integration though 😞

cfleming00:02:03

> When a file isn’t part of the module the repl was created in, just send the entire contents of the file to the repl instead? The problem with that is that this is the actually useful validation. I often have multiple REPLs open serving different functions, and I’ve been saved from loading code into the wrong REPL multiple times by that check.

tanzoniteblack23:02:46

@U0567Q30W, I figured out why my original approach (just manually adding the test folder explicitly under :extra-paths in an alias) wasn't working. Despite having the global setting Aliases to enable by default set to dev,test, dev wasn't being loaded as an alias for the project. I manually checked the box for dev in the aliases in the Clojure deps pane for the project and now I can load code & run tests in subproject just fine.

tanzoniteblack23:02:33

I've no idea why it stopped loading that alias for my project. Doesn't seem to be loading dev alias for any of my projects by default, now that I'm looking at it closer

cfleming00:02:41

@U236LQYB0 Oh interesting, thanks for that. I’m still not sure why IntelliJ doesn’t complain about the duplicated content roots, but I’m glad it works!

cfleming02:02:18

The not selecting dev thing is weird though, I’ll take a look and see if I can see anything going on there.

tanzoniteblack19:02:54

I thought I had fixed this at one point by explicitly adding the test directories in the :extra-paths of the :dev alias for my top deps.edn, but that doesn't seem to be working anymore