clojureVSCode
clojureVSCode copied to clipboard
Format on save doesn't work
I can't get the formatOnSave
feature to work. I've enabled "clojureVSCode.formatOnSave": true
in user settings as well as in workspace settings. Explicitly calling Clojure: Format file or selection
command works, so there's no problem with the actual formatter. However, nothing seems to happen on save, even the Developer Tool console is silent. I tried rebooting the computer and reinstalling the extension, but it made no difference.
It would be awesome if you could help with this, thank you in advance!
My specs:
- macOS High Sierra 10.13.2
- VS Code version 1.19.3
- Leiningen 2.8.1 on Java 1.8.0_152
Since the version 0.9.5 there is the nREPL output channel (ctrl-` -> output -> nREPL) that shows any errors that come from nREPL. Could you try again and post the errors here?
I've tried two configs to make this work:
-
I've got exactly the same problem and symptoms when I set
"clojureVSCode.formatOnSave": true,
. Manual formatting works (by choosingClojure: Format file or selection
), but format on save doesn't. File is saved and the formatting isn't applied. The nREPL output channel doesn't show any errors, just this:nREPL server started on port 40622 on host 127.0.0.1 - nrepl://127.0.0.1:40622
-
I've also tried to set both
"editor.formatOnSave": true
and"clojureVSCode.formatOnSave": true,
. This caused autoformatting to start to work. Unfortunately there is a very unpleasant side effect - the code is formatted beautifully, but somehow VS code doesn't see the file as saved. Which means that the "save dot" at the top (pictured below) doesn't go away even if the file was saved (I checked on disk and the content was saved).
My specs:
- Ubuntu 16.04
- VS Code 1.20.0
- Leiningen 2.8.1 on Java 1.8.0_151
My user settings for both cases: 1.
{
"editor.fontFamily": "'DejaVu Sans Mono'",
"editor.renderWhitespace": "none",
"workbench.colorTheme": "Default Light+",
"workbench.iconTheme": "vscode-icons",
"window.zoomLevel": 0,
"[clojure]": {
"clojureVSCode.formatOnSave": true,
"clojureVSCode.autoStartNRepl": true,
}
}
{
"editor.fontFamily": "'DejaVu Sans Mono'",
"editor.renderWhitespace": "none",
"workbench.colorTheme": "Default Light+",
"workbench.iconTheme": "vscode-icons",
"window.zoomLevel": 0,
"editor.formatOnSave": true,
"[clojure]": {
"clojureVSCode.formatOnSave": true,
"clojureVSCode.autoStartNRepl": true,
}
}
Is there any solution in the bug with saving on the second config? That "save dot" is annoying 🙄