Skip to content
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

namespaces - comments for individual symbols #143

Open
oakmac opened this issue Oct 27, 2024 · 0 comments
Open

namespaces - comments for individual symbols #143

oakmac opened this issue Oct 27, 2024 · 0 comments
Labels
namespace related to ns form parsing or printing

Comments

@oakmac
Copy link
Owner

oakmac commented Oct 27, 2024

In some cases, comments for individual symbols inside the ns form are not supported. Example:

(ns com.example.my-app
  ;; comment 1
  (:refer-clojure
    :exclude [some-> ;; comment 2
              get    ;; comment 3
              ])     ;; comment 4
  )

This is a perfectly valid namespace, but it is not clear how Standard Clojure Style should handle the comments here. After pretty-printing the ns with Standard Clojure Style, it will look like the following:

(ns com.example.my-app
  ;; comment 1
  (:refer-clojure :exclude [get some->])) ;; what to put here?

This is probably a "not possible to fix completely" scenario, and I think the best user experience might be to warn or error if we detect this case.

Presumably, if the user desires to format their codebase using Standard Clojure Style then they are ok with "losing" these comments after the formatting process, but I do not love the fact that we are "throwing away" some of their code here. There is also the #_ :standard-clj/ignore escape hatch for special cases.

Related to Issue #140

@oakmac oakmac added the namespace related to ns form parsing or printing label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
namespace related to ns form parsing or printing
Projects
None yet
Development

No branches or pull requests

1 participant