Fork me on GitHub
#cursive
<
2023-02-16
>
onetom06:02:29

im experiencing a strange, automatic jumping of indentation, as shown on the video. 1st jump to the left happens, when i run the Reformat Code action (either via the action menu or with the default Cmd-Opt-L) 2nd jump to the right happens, when i do a commit, with the Amend commit and the Reformat code checkboxes being turned on (and all other checkboxes are off) at this point, the committed code is indented too far to the right, BUT it's indented correctly in the editor buffer and intellij doesn't even think there are any git changes, until i run the reformat again! 3rd jump to the left happens, when i Reformat Code again 4th jump to the right happens, when i Cmd-S save the file explicitly. this seems to be caused by the Settings / Tools / Actions on Save / Reformat code being turned on. however, the Reformat code checkboxes in the commit dialog still seems to trigger the same reformat code-path, even if this Actions on Save / Reformat code is turned OFF. notice how the indentations are all done with spaces, so it's not a tab vs spaces issue. Q1. What controls the formatting rules for the Actions on Save / Reformat code & Commit... / Reformat code? Q2. Why the behaviour of the Reformat Code action is different from those other 2 formatting options?

onetom06:02:59

it happens on both 1. IntelliJ Ultimate EAP #IU-231.6890.12, built on February 9, 2023 + Cursive 1.12.8-eap2-2023.1 2. IntelliJ Ultimate #IU-223.8617.56, built on January 26, 2023 + Cursive 1.12.8-eap2-2022.3

onetom06:02:19

i'd be happy with work arounds, like downgrading cursive, or turning off some intellij options, but i don't want to fall back to commiting from the command line...

thheller09:02:17

Cursive seems to get confused here? The protocol method exists and runs fine in both CLJ and CLJS, but cursive thinks it doesn't exist and offers to create a defn with that name

onetom19:02:48

@cfleming i tried to specify -e (set!,*print-namespace-maps*,false) as Common options / Parameters for a local nREPL run config, but it ends up at the end of the command line, after Cursive's -i form-init.....clj option, eg:

java ... -classpath "..." " clojure.main -i /private/var/folders/4q/fcvqptl53wj8sdb5p1g3w7r40000gn/T/form-init13284348082157382086.clj -e (set!,*print-namespace-maps*,false)
since the form-initXXXX.clj ends with (nrepl.cmdline/-main "--ack" "59666"), which i suppose is blocking, so the -e option will never run. i wonder, if there are any useful clojure.main options, which would still be useful to put after Cursive's -i form-initXXX.clj. if not, would it be more useful to put the value of the Parameters repl run config BEFORE the -i form-initXXX.clj?

onetom19:02:18

i can't put (set! *print-namespace-maps* false) into user.clj, because i get

Exception in thread "main" Syntax error macroexpanding at (user.clj:12:1).
        at clojure.lang.Compiler.load(Compiler.java:7665)
        at clojure.lang.RT.loadResourceScript(RT.java:381)
        at clojure.lang.RT.loadResourceScript(RT.java:368)
        at clojure.lang.RT.maybeLoadResourceScript(RT.java:364)
        at clojure.lang.RT.doInit(RT.java:486)
        at clojure.lang.RT.init(RT.java:467)
        at clojure.main.main(main.java:38)
Caused by: java.lang.IllegalStateException: Can't change/establish root binding of: *print-namespace-maps* with set
        at clojure.lang.Var.set(Var.java:226)
        at user$eval191.invokeStatic(user.clj:12)
        at user$eval191.invoke(user.clj:12)
        at clojure.lang.Compiler.eval(Compiler.java:7194)
        at clojure.lang.Compiler.load(Compiler.java:7653)
        ... 6 more
so maybe a -i init.clj could contain such configurations.

cfleming20:02:34

Yes, something similar got fixed recently for deps: https://github.com/cursive-ide/cursive/issues/2322#issuecomment-1097566491. I think it makes sense to have the parameters before the -i, definitely. I filed https://github.com/cursive-ide/cursive/issues/2774.

❤️ 2