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

bug: formatter deletes file contents if ns form is unclosed #150

Open
alexandercampbell opened this issue Nov 7, 2024 · 1 comment
Open
Labels
bug Something isn't working v1 blocker Required for a v1.0.0 release

Comments

@alexandercampbell
Copy link

This came up when I was editing imports in a namespace and deleted the closing paren by mistake.

Example input:

(ns example
  (:require
   [clojure.math :as math])

(doseq [i (range 100)]
  (println {:a i}))

Formatter output:

(ns example
  (:require
   [clojure.math :as math]))

From what I can tell, this bug will happily delete thousands of lines of source code.

This occurred on version v0.12.0 of the formatter.

@oakmac
Copy link
Owner

oakmac commented Nov 8, 2024

Thank you for the report: this is definitely not great behavior or user experience. Similar to Issue #59, I think the tool should throw an error and communicate to the user that it encountered invalid code in cases like this.

@oakmac oakmac added bug Something isn't working v1 blocker Required for a v1.0.0 release labels Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1 blocker Required for a v1.0.0 release
Projects
None yet
Development

No branches or pull requests

2 participants