Fork me on GitHub
#cursive
<
2020-02-27
>
serioga09:02:10

Hello @cfleming Does an option exists somewhere to keep spaces in manually aligned code when I do Reformat Code ? For example I wrote

[a   b   c]
[aaa bbb ccc]
and want it to be kept intact on reformat?

cfleming09:02:52

No, there isn’t. And there’s really no good way that could work except for an annotation like “Never reformat this form” - at the end of the day, reformatting is only moving spaces around.

cfleming09:02:12

So it would have to be manually annotated in the code somehow.

serioga09:02:48

Maybe more general way to specify what should be aligned vertically?

cfleming10:02:32

Is that inside any form that a general rule could be made for?

cfleming10:02:32

I’m thinking of something like clojure.test/are where you might want to consistently align the columns.

serioga15:02:24

@cfleming “Is that inside any form that a general rule could be made for?” I would not say that :thinking_face:

serioga15:02:40

(my-form a b c) (my-form aaaa bbbb cccc)

serioga15:02:37

Generally for me it would be fine to have checkboxes Don't touch multiple non-trailing spaces , Don't remove newlines so that Cursive only align code and insert missing space between words

cfleming21:02:21

Well, Cursive doesn’t remove newlines when reformatting at the moment.

cfleming21:02:37

I’m not sure how Cursive would determine “multiple non-trailing spaces” - basically, that would mean that Cursive wouldn’t reformat at all, as far as I can tell.

serioga10:02:41

@cfleming «Cursive doesn’t remove newlines when reformatting at the moment.» Not in this case

(xxx)
, (yyy)
leading comma force second line to be collapsed

serioga11:02:32

@cfleming «I’m not sure how Cursive would determine “multiple non-trailing spaces”» I've meant not leading and trailing spaces.

cfleming21:02:37

Ah, IntelliJ has an action for that, “Auto-Indent lines”, which just adjusts the initial indent. Is that what you’re looking for?

serioga08:02:38

Well, I've tested “Auto-Indent lines”, it's not exactly the what I want. My use-case (using parinfer): • there is a code formatted with “Default to only indent” disabled • I enable “Default to only indent” and want to update indentation • in this case “Auto-Indent lines” does not change indentation in forms but “Reformat Code” does. But “Reformat Code” also breaks all manual alignment Generally I would like to try various ideas to make code more readable but automatic code formatting makes it almost impossible.

katox14:02:59

It looks like the cursive error reporting endpoint is down.

cursive.exception.GithubException: 500 Internal Server Error 
	at cursive.exception.ClojureErrorReportSubmitterKt.create(ClojureErrorReportSubmitter.kt:158)

tanzoniteblack18:02:26

Is there a way to rename a namespace and updates all of the requires to it i.e. change hash-map-util to yummly.utils.hash-map-util and update all of the (require [hash-map-util]) to (require [yummly.utils.hash-map-util :as hash-map-util])

imre18:02:35

Standard intellij rename refactoring is what I use

tanzoniteblack18:02:20

when I tried rename, it complained that yummly.utils.hash-map-util wasn't a valid identifier

imre18:02:40

Interesting

imre18:02:59

Perhaps the problem is with the folder depth change?

cfleming00:02:18

Yes, that’s the problem. Currently Cursive only allows renaming the last namespace segment, because otherwise files have to be moved. I’m planning to fix this soon.

cfleming00:02:35

Sorry, I realise this isn’t very useful.

serioga07:02:37

Generally I search/replace old name -> new name and then use Cursive's “move file to correct location”. https://clojurians.slack.com/archives/C0744GXCJ/p1582827806029600

katox08:02:03

Moving the file (within the IDE) doesn't change the namespace either. It would be nice if it did. I search and replace the ns text as a workaround.

cfleming09:02:43

Yes, I definitely want to support that too.

tanzoniteblack15:02:41

@U0HJNJWJH, that's what I ended up doing. I was just hoping there might've been a more reliable way to use the refactoring capabilities of cursive/intellij