Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format on save doesn't work #89

Open
tkalmi opened this issue Jan 29, 2018 · 3 comments
Open

Format on save doesn't work #89

tkalmi opened this issue Jan 29, 2018 · 3 comments

Comments

@tkalmi
Copy link

tkalmi commented Jan 29, 2018

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
@avli
Copy link
Owner

avli commented Feb 9, 2018

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?

@papisz
Copy link

papisz commented Feb 11, 2018

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

@paul-alekseev
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants