venantius / vim-cljfmt

A Vim plugin for cljfmt, the Clojure formatting tool.
152 stars 22 forks source link

Error detected while processing function cljfmt#Format[13] #51

Open BenQuigley opened 2 years ago

BenQuigley commented 2 years ago

I'm having the following issue while running :Cljfmt from vim. This is happening on both my Linux machine and my OS X machine - this version information is from OS X - so I take it it must be something I'm doing wrong (I'm kind of new to lein), but lein cljfmt fix runs from the CLI, and fireplace is working because Eval works from vi.

Error detected while processing function cljfmt#Format[13]..function cljfmt#Format:                                                                                                            
line   12:                                                                                                                                                                                     
Cljfmt: Failed to format file, likely due to a syntax error.                                                                                                                                   

Versions: Vim 9.0.472 REPL-y 0.5.1, nREPL 0.9.0 Clojure 1.11.1 OpenJDK 64-Bit Server VM 19.0.1

This happens to me even in a bare project created with lein new test, with the following project.clj:

(defproject test "0.1.0-SNAPSHOT"                                                                                                                                                              
  :description "FIXME: write description"                                                                                                                                                      
  :url "http://example.com/FIXME"                                                                                                                                                              
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"                                                                                                                   
            :url "https://www.eclipse.org/legal/epl-2.0/"}                                                                                                                                     
  :dependencies [[org.clojure/clojure "1.11.1"]]                                                                                                                                               
  :repl-options {:init-ns test.core}                                                                                                                                                           
  :plugins [[cider/cider-nrepl "0.28.5"] [lein-cljfmt "0.9.0"] [cljfmt "0.9.0"]])                                                                                                              

I had added [cljfmt "0.9.0"] to plugins because I was reading this issue; but adding it did not change the result. The following plugins config also did not work: :plugins [[cider/cider-nrepl "0.28.5"] [cljfmt "0.5.1"]]. Also appears similar to this.

The file that I'm running it on is the unchanged src/test/core.clj created by lein:

(ns test.core)                                                                                                                                                                                 

(defn foo                                                                                                                                                                                      
  "I don't do a whole lot."                                                                                                                                                                    
  [x]                                                                                                                                                                                          
  (println x "Hello, World!"))

Clojure section of ~/.vimrc:

135 Plug 'tpope/vim-fireplace'                                                                                                                                                                 
136 "Plug 'tpope/vim-salve'                                                                                                                                                                    
137 "Plug 'guns/vim-clojure-static'                                                                                                                                                            
138 Plug 'venantius/vim-cljfmt'                                                                                                                                                                
139 Plug 'guns/vim-clojure-highlight'