clojureVSCode icon indicating copy to clipboard operation
clojureVSCode copied to clipboard

Format on save doesn't work

Open tkalmi opened this issue 6 years ago • 3 comments

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

tkalmi avatar Jan 29 '18 20:01 tkalmi

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?

avli avatar Feb 09 '18 15:02 avli

I've tried two configs to make this work:

  1. I've got exactly the same problem and symptoms when I set "clojureVSCode.formatOnSave": true,. Manual formatting works (by choosing Clojure: 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

  2. 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).

zrzut ekranu z 2018-02-11 11-33-49

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,
    }
}

papisz avatar Feb 11 '18 10:02 papisz

Is there any solution in the bug with saving on the second config? That "save dot" is annoying 🙄

paul-alekseev avatar Oct 10 '19 07:10 paul-alekseev