Fork me on GitHub
#cursive
<
2020-09-17
>
emccue03:09:20

Is there a button i can push to alphabetize my requires?

AJ Jaro15:09:32

@U3JH98J4R I put this plugin together to help address that problem. It’s super basic so I’m open to PRs to it as well on GitHub https://plugins.jetbrains.com/plugin/13222-clojure-namespace-sort

👍 3
dpsutton03:09:57

my cursive coworkers will add a new line before the final closing paren, highlight all the imports and then hit sort lines. would be nice for this to be automated

Jim Newton08:09:53

Hi, I am not a cursive user. rather I'm a cider user. However, some of my students ARE NOT emacs users. It is a good idea for me to recommend to them to use cursive?

Jim Newton08:09:11

especially if they are already using intelliJ for Scala development?

Jim Newton08:09:18

I welcome advice.

cfleming09:09:55

@jimka.issy Obviously I’m biased, but I would say yes. Generally I recommend that new Clojure users use whatever they’re used to, so if that’s IntelliJ then sticking to that will make things easier for them. If they’re not either IntelliJ nor Emacs users I’d generally still recommend IntelliJ since it works in a more similar way to other apps they’re used to, but things like VSCode or Atom are also good options for that these days.

cfleming09:09:58

Students don’t have to pay for Cursive, there’s a free non-commercial licence covering that use case, among others.

Jim Newton09:09:24

and professors as well, I suppose. I will try it out to have a vague idea what it's like.

Jim Newton09:09:55

is there a danger of using cursive to edit a project which I otherwise develop using cider?

cfleming09:09:17

Ok, the userguide is here: https://cursive-ide.com/userguide/. Let me know if you or others have questions or issues.

Jim Newton09:09:19

do I risk destroying some of the meta-files if it try to edit the project with two different ides?

cfleming09:09:28

Yes - you may not want to go back to Emacs 🙂

cfleming09:09:33

Other than that you should be fine.

cfleming09:09:04

No, IntelliJ will create its project files in a .idea directory and it will all be self-contained in there.

Jim Newton09:09:06

being multi-lingual can only be good.

cfleming09:09:12

Definitely.

Jim Newton09:09:49

is that the wrong installation instructions? I see you recommended a different link.

cfleming09:09:54

No, if you follow the link from the homepage to the installation instructions you’ll end up at the userguide.

Jim Newton09:09:41

great. BTW, where is Settings->Plugins. I don't see it in my IntelliJ menu. "IntelliJ Ultimate" not "IntelliJ Community"

Jim Newton09:09:48

Ahh, I see it is in Preferences, not Settings.

cfleming09:09:03

If you’re on a Mac, it will… yes, that’s right. That differs by platform, unfortunately.

Jim Newton09:09:31

Do I need to both download cursive AND install the plugin?

cfleming09:09:00

You need to download and install IntelliJ, and then install the plugin (Cursive) from within the IDE.

Jim Newton09:09:13

I already have intelliJ installed.

Jim Newton09:09:24

I downloaded the license and the plugin/Cursive.

Jim Newton09:09:41

then I restarted intelliJ and opened up a clojure project, it looks sweet.

Jim Newton09:09:53

However, it never asked me to accept a license.

Jim Newton09:09:57

is that a bug?

cfleming09:09:04

It should have popped up a notification in the bottom right corner. That will go away in a while if you don’t do anything about it, you can either find it in the event log or just not worry about it. Cursive is generally non-intrusive with respect to licensing, so if you don’t do it now it will gently nag you at some future point.

cfleming09:09:52

But everything will work, Cursive never disables anything due to lack of a licence.

Jim Newton09:09:19

that's polite and nonintrusive.

Jim Newton09:09:30

OK, the first curious thing I notice. When I'm editing a scala project, and I view one of my test cases files, I see these little green triangles. I can click one of them to run a single test.

Jim Newton09:09:54

but i see no such green triangle in the clojure file. Does that mean something is not installed correctly?

cfleming09:09:15

No, Cursive’s test integration works differently to most IntelliJ plugins because it’s REPL-based. I also need a standard test runner, but that’s not there yet. Here’s how the testing works in Cursive: https://cursive-ide.com/userguide/testing.html

Jim Newton09:09:25

OK, I have a strange problem which seems to differ from the documentation https://cursive-ide.com/userguide/first-repl.html

Jim Newton09:09:53

the section Import Existing Project

Jim Newton09:09:37

I have imported the clojure cmd line tools. brew install clojure/tools/clojure

Jim Newton10:09:44

I see the dialog

Jim Newton10:09:19

When I press Next I see the following

Jim Newton10:09:03

and when I press Next here I see the following:

cfleming10:09:19

Is there a deps.edn file in that directory?

Jim Newton10:09:49

no. should there be?

Jim Newton10:09:15

can I check whether "deps" is installed properly?

cfleming10:09:31

Yes, that flow is for importing an existing project. If you want to create a new project you should use “new project”.

Jim Newton10:09:52

no, I have a project which was already created months ago with leiningen

cfleming10:09:16

Oh, so there’s a project.clj in that directory?

cfleming10:09:13

So did you start this from the splash screen, or did you use File→New→Project from Existing Sources....?

Jim Newton10:09:27

File→New→Project from Existing Sources.

cfleming10:09:02

So I think there’s a step before your first screenshot, which is “Import project from external model”. If your project is a Leiningen one, you have to specify Leiningen there, not Deps.

jsyrjala10:09:48

It seems that recent cursive versions have issues with importing java classess:

jsyrjala10:09:50

It shows some java classes as unused even when they are used in the same file

jsyrjala10:09:19

better image

jsyrjala10:09:33

this applies only to some java classes:

jsyrjala10:09:35

I think this started in last 1-2 weeks

jsyrjala10:09:24

Hovering on classes says that “Instant cannot be resolved” etc

cfleming10:09:38

I’ll try to reproduce that tomorrow, thanks for the examples.

jsyrjala10:09:48

The latter example switched changed to this for some reason when i saved/modified whitespace

jsyrjala10:09:02

everything else seems to work as expected, it is only the coloring is wrong

Jim Newton10:09:32

I know that sometimes using Scala and the Scala plugin, from time to time intellij gets confused and I have to re-import from source.

Jim Newton10:09:26

seems to work. super

Jim Newton10:09:27

I selected Leiningen rather than Deps and with works great.

Jim Newton10:09:51

I don't understand "Load File in REPL". is this supposed to load the file which is displayed in the editor?

Jim Newton10:09:09

I don't see that it has any effect.

Jim Newton10:09:11

Is there a hidden repl which is being loaded into?

Jim Newton10:09:46

I don't get the function rte-run-all-test defined in the repl.

Jim Newton11:09:57

at the documentation link https://cursive-ide.com/userguide/repl.html#interaction-with-the-editor there is an animated graphic. https://cursive-ide.com/userguide/images/repl/editor-interaction.png , what is the user pressing to deliver those commands to the repl?

Jim Newton11:09:56

There is an intelliJ bug about keyboard shortcuts with the mac.

Jim Newton11:09:51

What is the keystroke for sending the current sexpr to the repl?

Jim Newton11:09:07

here is what I see on the menu indicating the shortcut, but that does not seem to be correct.

Jim Newton13:09:08

Does anyone know if there is a way to register the Cursive license when using IntelliJ Ultimate edition? The instructions in the email is to use Help -> Register Cursive. But that does not seem to exist in my IntelliJ

manutter5113:09:56

I have IntelliJ “Ultimate” on Mac OS, and it’s there, at the bottom. Maybe check under Preferences -> Plugins and make sure Cursive is active? If it’s not active, you won’t get the Register menu option.

Jim Newton13:09:11

@manutter51 how do I know whether it is active ?

manutter5113:09:58

There should be a checked checkbox to the right of the plugin name

manutter5113:09:39

Oh, click on the Installed tab in that window, the Marketplace tab is showing you available plugins.

Jim Newton13:09:47

hm.... seems to be clicked. right?

manutter5113:09:10

Yeah, that looks right

manutter5113:09:32

It’s not asking you to restart, so it should be there :thinking_face:

manutter5113:09:13

Do you have other plugins installed besides the ones that come standard with IntelliJ?

Jim Newton13:09:01

could be a restart issue perhaps.

Jim Newton13:09:16

I found the menu item in the mean time. not sure whether it magically appeared, or whether I was blind before.

Jim Newton13:09:37

Yes I have other plugins, the scala plugin is the main one.

manutter5113:09:22

Ah, ok, sounds like you’re back in business at least.

Jim Newton13:09:54

cool. BTW what keys do I need to press to reload a file into the repl, or to re-eval the current top-level form?

manutter5113:09:38

I could never remember the default keys, so I went into Preferences -> Keymap and defined my own (Cmd-Shift-L for “Load file in REPL” and Cmd-Shift-Enter for “Load form before cursor”)

manutter5113:09:33

Also if you look at the top in the KeyMap prefs pane, there’s a dropdown menu with a list of common key bindings for those who are used to other editors, might be something there you’d like.

Jim Newton13:09:09

yes I took a look at that but I don't really understand how to use it. For example I see "Load File in Repl" is C-c C-k. However, when I press C-c C-k, it does not load the file but rather shows me the dependency list in a huge pink popup

Jim Newton13:09:26

however, C-c C-c does seem to load the current form into the repl. That's a big help.

manutter5113:09:38

Sounds like a key mapping conflict. I’d try changing it to something else, and then changing it back. The IDE will tell you if you specify a key mapping that conflicts with something else, and I believe it tells you what the conflicting command(s) would be

Jim Newton13:09:15

good advice, thanks.

👍 3
Jim Newton13:09:57

in slime (common lisp) and also in cider C-c C-k compiles and loads the current file. That at least that's intuitive

manutter5113:09:36

Yeah, if you’re already used to that might as well keep it, assuming you can resolve the conflict.

Jim Newton17:09:03

turns out it wasn't a key mapping issue. But rather cursive thinks there is a conflict and refuses to load the file.

Jim Newton17:09:22

just a little bug. probably easy to fix.

Jim Newton13:09:49

I ran the menu item REPL-&gt;Type Check Current NS and it gives some innocuous wrong information. Where's the best place to report this?

manutter5113:09:46

Hmm, maybe ping cfleming here. He’s on New Zealand time, so he may not see it right away if you’re posting from a US timezone.

manutter5113:09:10

You can also get his email from the plugin page on the IntelliJ site.

manutter5113:09:38

Or you could sign up for the mailing list at cursive (at-sign)

Jim Newton13:09:34

not sure what's the best way to make a MWE (minimum working example) because a single file doesn't suffice. eventually you need an entire project directory structure.