venantius / vim-cljfmt

A Vim plugin for cljfmt, the Clojure formatting tool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Peristent error after formatting & saving an invalid code

ravicious opened this issue · comments

So basically if I add an extra paren and run :Cljfmt, the whole buffer contents get deleted. From then if I try to save the file I get the following error. After fixing the error and saving the file, I get the same error over and over again; I have to restart vim for it to disappear.

Error detected while processing function <SNR>47_BufWritePostHook..<SNR>47_UpdateErrors..<SNR>47_CacheErrors..37..36..SyntaxCheckers_clojure_eastwood_GetLocList:
line    5:
E121: Undefined variable: l:cljfmt_output
Error detected while processing function <SNR>47_BufWritePostHook..<SNR>47_UpdateErrors..<SNR>47_CacheErrors:
line   34:
E170: Missing :endfor
Error detected while processing function <SNR>47_BufWritePostHook..<SNR>47_UpdateErrors:
line   13:
E171: Missing :endif

I use both vim-eastwood and vim-cljfmt on mvim. My ~/.lein/profiles.clj looks like this:

{:user {:plugins [[cider/cider-nrepl "0.8.2"]
                  [lein-cljfmt "0.1.7"]
                  [jonase/eastwood "0.2.1"]
                  ]
        :dependencies [
                       [lein-cljfmt "0.1.7"]
                       [jonase/eastwood "0.2.1"]
                       ]}}

I believe this should be fixed as of 50e47e0. Please update and let me know if you're still experiencing the issue.

The error is gone, but now autoformatting on save just stops working silently. :Cljfmt still works, though.

The first time I ran :Cljfmt after a failed autoformat, it took a little longer for vim-cljfmt to format the file, so I guess it had to reconnect to repl or something.

Also, after formatting invalid code with :Cljfmt, the content of the buffer gets deleted.

Wow, I'm so dumb. I totally forgot that yesterday I turned off autoformatting in my vimrc, everything's fine now.

Anyway, formatting invalid code still yields an empty buffer, but I guess I should create a separate issue for that? You've fixed this one after all. ;)

Haha, awesome. Well, the latter's still definitely a bug that I'd like to iron out, so I'm going to leave this open until I've fixed that as well.

@ravicious I think this should be fixed with the latest commit (3576072). At the very least, I've tested it with the extra-parens situation you've described and it works. Let me know if this actually works :P

Since there haven't been any updates on this front, I'm closing this issue.