oakmac / standard-clojure-style-js

Standard Clojure Style in JavaScript
ISC License
80 stars 1 forks source link

Remove blank behaviour in different cases #156

Open velios opened 2 weeks ago

velios commented 2 weeks ago

Hi, just watched your conj talk, this is cool - your efforts are appreciated.

Came across two different cases in different editors Pic instead code block because it shows blankspaces.

In first case, which by default in my vscode setup

image

will be formatted to

(cond
  :cond-1
  :do-1
  :cond-2
  :do-2
  :cond-3
  :do-)

but(which default in my cursive setup)

image

will be formatted with respect to blank lines to

(cond
  :cond-1
  :do-1

  :cond-2
  :do-2

  :cond-3
  :do-)

I would personally prefer to respect empty lines, but I wonder which behavior is considered preferable and whether the formatter behaves correctly in both cases?

oakmac commented 2 weeks ago

Hi, just watched your conj talk, this is cool - your efforts are appreciated.

Thank you! :grin:


I tested this as input and the formatter returned it unchanged (which is correct behavior):

(cond
  some-condition
  12

  another-condition
  13

  :else
  nil)

Can share the file exactly? What version of Standard Clojure Style are you using?

Another hunch: are you on Windows and does this file use CRLF line endings? The formatter should be able to handle that, but there was another bug that looked similar to this and I wonder if this is somehow related (Issue #102 and Issue #103).

velios commented 2 weeks ago

Of course, my fault. Example https://github.com/velios/standart-clojure-style-issue I'm on mac, compile my-standart-clj-binary to standalone binary like you show on video from 8a0588c19325033c63ead2e1acb40a606717dc6a

oakmac commented 2 weeks ago

Thank you sharing that!

Adding this here for my debugging efforts. I do see a difference between with_spaces.clj and without_spaces.clj when viewing with a hex editor.

Screenshot 2024-11-11 at 9 38 49 AM