intellij-ideaclojure

Cannot type single bracket or parentheses in IntelliJ


I have this code:

    (defn ^:dev/after-load mount-root []
      (re-frame/clear-subscription-cache!)
      (reagent/render [views/main-panel]
                      (.getElementById js/document "app")))

and in IntelliJ I want to duplicate the third line and then change it. Duplication works but the code won't compile because I need to add an additional single closing parentheses to the end of the code block:

    (defn ^:dev/after-load mount-root []
      (re-frame/clear-subscription-cache!)
      (reagent/render [views/main-panel]
      (reagent/render [views/second-panel] ;; duplicated line
                      (.getElementById js/document "app"))) ;; now missing closing parentheses

In IntelliJ, you can't add single brackets or parentheses to code so how can I duplicate the line and update the code so it doesn't throw a linting error / compiles?


Solution

  • I found the answer in this question.

    Set Use Structural Editing to None.

    IntelliJ→Preferences→Editor→General→Smart Keys→Clojure