Fork me on GitHub
#cursive
<
2021-08-31
>
Oliver George02:08:43

Is it just me or have we lost the ability to reformat code across a project? Code cleanup runs but it doesn't do any indentation/whitespaces changes. Reports "Code inspection did not find anything to report. 593 files processed..."

Oliver George02:08:16

Ah, I think the LSP plugin was at fault. Worked after I disabled it.

helios07:08:54

Sometimes IntelliJ fails to recognize a function as never used. Is there a way that i can see all unused functions and force it to recalculate it?

cfleming10:08:38

For some reason the global unused symbol inspection doesn’t work with Clojure code. I need to investigate why that is, but haven’t yet.

helios07:08:51

I have another question for the Cursive hive mind: at work we're often aliasing namespace (without requiring) to use the aliases for namespaces keywords. We have this macro

(defmacro ns-alias
  "Set up a custom alias for use with namespace keywords.
  (ns-alias com.example.application.system sys)"
  [ns as]
  `(do
     (create-ns '~ns)
     (alias '~as '~ns)))
So that enables us in destructuring to do things like {::sys/keys [config]}, etc. But intelliJ isn't happy about the usage of ns-alias as the new alias sys can't be resolved. Any hint?

cfleming09:08:35

If you reverse the arguments in your macro, then you could just resolve it as alias, and that should work.

👍 1
Schpaa08:08:27

Can I have a babashka repl in cursive “natively”, or do I still need to use the tubular workaround?

borkdude08:08:22

@schpaencoder There is an EAP which has built-in babashka features now

Schpaa08:08:51

I’m gonna try this as soon as the intellij-beachball settles

Schpaa08:08:35

Regarding this facet-thing, is there a writeup about what I need to do to add a Babashka facet for my module?

Schpaa08:08:48

This is sweet!!!

cfleming10:08:16

Great, glad it’s working well!

salam19:08:34

in Conjure (a Clojure plug-in for Neovim), you can mark a frequently-used form and evaluate it later using a keyboard shortcut:

<localleader>em[mark]    Evaluate the form under the cursor at the given
                         |mark|. Set a regular Neovim mark on a form using
                         `mF` for example in any file, then jump to another
                         file. You can evaluate that form at any time with
                         `<localleader>emF`.
how would one go about achieving a similar goal with Cursive? are bookmarks in IntelliJ IDEA line-level (i.e., they don't store column numbers)?

salam19:08:50

ah, i guess i just found the answer to my question: https://youtrack.jetbrains.com/issue/IDEA-98780

cfleming21:08:19

There’s nothing quite like that. There are REPL commands: https://cursive-ide.com/userguide/repl.html#repl-commands

kennytilton22:08:33

I have been known to create clojure.test entries to achieve this, along with setting up some keychord to dispatch "run last test". Then I just have to "run test under ????" to make it the last test and I am able to rerun form anywhere.

cfleming23:08:45

Would an easier way of creating REPL commands (something like “Create REPL command from form under caret”) make that easier?

cfleming23:08:02

@U0PUGPSFR If you’re going to those lengths, why not just create a REPL command? Is it because the test is easier to update or something?

kennytilton23:08:34

What?! A REPL command?! makes not to explore such a beast But yeah, with my set up I point the autorun last test at a different test at will with a second key chord dedicated to "run test under cursor". Or edit a test if I want to do that. Mind you, this is quite rare. Normally I am content to have a comment block with all sorts of code snippets a "send to repl" away. But when the OP asked about navigating about and still being able to fire off the code, I thought of my test hack.

salam00:09:56

it would but i was thinking of a more flexible and “lighter-weight” approach that works with the existing (almost powerful) bookmarks feature of IntelliJ IDEA (https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html#use_bookmarks). i should be able to evaluate a bookmarked form by invoking an action (via a keyboard shortcut, of course) such as "Send form at bookmark <a bookmark mnemonic (i.e., a digit or letter)>". (see the image below) but, again, without the column numbers available in bookmarks, this would be impossible to implement (i think).

cfleming00:09:29

Right, I could implement something like that by just essentially copying the bookmarks and adding support for columns. I’d probably need convincing that it was much of an improvement over REPL commands, though.

salam00:09:20

i could use REPL commands to achieve the same goal but it just doesn't feel as "lighter-weight" as the feature i proposed: i need to create REPL commands (most of them have a very short TTL) using the editor first and then i need to find keyboard shortcuts to them (for quick access.) this is a challenging task as you're already aware how difficult it is to find an ergonomic, easy-to-remember keyboard shortcut in IntelliJ IDEA these days... with the "Evaluate Form at Bookmark..." approach, i just have to remember one keyboard shortcut that works with the existing bookmarks actions.

cfleming00:09:50

Fair enough, that all sounds reasonable. I’ll investigate what would be involved.

awesome 2
thanks3 2
salam00:09:53

let me know if you need me to create a GitHub issue for it.

cfleming00:09:12

That’s probably a good idea, in case I get distracted in the meantime.

imre05:09:36

There's the also the current command which re-rends the last form (or repl command) to the repl

imre06:09:59

Perhaps a similar one could be added which sends the last marked form. Of course one would need a mark form command with it