Fork me on GitHub
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.


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?


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.


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]
     (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?


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

👍 1

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


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


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


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


This is sweet!!!


Great, glad it’s working well!


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
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)?


ah, i guess i just found the answer to my question:


There’s nothing quite like that. There are REPL commands:


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.


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


@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?


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.


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 ( 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).


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.


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.


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

awesome 2
thanks3 2

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


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


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


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