avli / clojureVSCode

Clojure support for Visual Studio Code
https://avli.github.io/clojureVSCode/
MIT License
204 stars 34 forks source link

Clojure files hang sometimes in UNSAVED state #102

Open avli opened 6 years ago

avli commented 6 years ago

Clojure files hang sometimes in the UNSAVED state event after Cmd+s or File -> Save. Not sure it's an extension issue – need to figure out.

Here is the first mention of the glitch.

paschdan commented 6 years ago

for me this will only happen when clojureVSCode.formatOnSave is set to true

williamlindsay commented 6 years ago

I'm having the same problem. Doesn't seem to happen to every file in my project but definitely most of them although I'm not sure what the difference is which triggers this behavior. Even having a file with just (defn foo [x] x) in it causes this problem. Also, if I make a change that requires a fix from cljfmt, save the file, then close it to discard then unsaved changes, then reopen it, the file will be in the pre-cljfmt-fix state which means that the transformations done by cljfmt are occurring after the save is done. I did a bit of digging on the VS Code documentation and found that the vscode.workspace.onWillSaveTextDocument method allows you to register async work and the formatFile method in clojureFormat.ts looks like it does some async work. So maybe making it async will solve this? I actually created a branch which solves it https://github.com/williamlindsay/clojureVSCode that said I did a bit more work in it since I want to do a few more things.

juusaw commented 6 years ago

Is there any progress on this? I'm also experiencing the problem and a fix would be great.