Skip to content

[DRAFT] Issue #193 - rule 3 alignment edge cases #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

oakmac
Copy link
Owner

@oakmac oakmac commented Apr 8, 2025

Issue #193

@oakmac oakmac changed the title [DRAFT] Issue #193 - rule 3 alignment to prefixed elements [DRAFT] Issue #193 - rule 3 alignment special cases Apr 8, 2025
@@ -2336,3 +2336,135 @@ com.example.my-app)
:ccc
:ddd}
--Expected

# GitHub Issue #193 - rule 3 alignment for unquote
Copy link

@yuhan0 yuhan0 Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to add test cases for all the expression prefixes individually -

'quote
`syntax-quote
~unquote
~@unquote-splicing
@deref

Copy link

@yuhan0 yuhan0 Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, missed one case:

#'var

There are also symbolic constants, namespaced map syntax , tagged literals and conditional read forms if you really want to cover all edge cases:

##NaN
## NaN
#:user{:a 1}
#:user {:a 1}
#::u{:a 1}
#::u {:a 1}
#::{:a 1}
#:: {:a 1}
#inst "2014-05-19T19:12:37.925-00:00"
#js{:onClick (fn [e] (js/console.log e))}
#?(:clj true :cljs false}
#? (:clj true :cljs false}
#?@(:clj [:a :b :c])
#?@ (:clj [:a :b :c])

Note that Rule 3 is currently triggered incorrectly for the above cases when there is whitespace between the dispatch character(s) and form, which standard-clojure-style preserves (although maybe it shouldn't? will open a separate issue)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and the obscure reader eval macro which isn't even documented on https://clojure.org/guides/weird_characters

#=(* 2 3)
#= (* 2 3)

I think this one is really unlikely to show up in source files

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this @yuhan0! I created Issue #198 for discussion around whether Standard Clojure Style should remove or persist whitespace for these cases.

@oakmac oakmac changed the title [DRAFT] Issue #193 - rule 3 alignment special cases [DRAFT] Issue #193 - rule 3 alignment edge cases Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants