Calva: Calva no longer formats properly after REPL usage

Created on 13 Dec 2020  路  6Comments  路  Source: BetterThanTomorrow/calva

I'm just starting out with Clojure/Calva/REPL-based-dev. I've managed to connect to the REPL and evaluate forms. However, after connecting to the REPL, my code is no longer formatted as I type, whereas it was being formatted before connecting. I've tried both the Jack-In option and starting my own REPL and connecting to the port, both with the same result. I'm not seeing any errors in the outputs. I'm not sure where to go from here, any help would be appreciated!

edit: I am now also getting an error pop up "Running the contributed command: 'calva-fmt.formatCurrentForm' failed." when I try to tab-indent a section of code, which I believe was not the case before I started experimenting with the REPL. The auto-formatting while coding is also less sophisticated than it was before I started experimenting with the REPL (even when not connected to a REPL now). It seems the experiments have broken something in my configuration, even though I don't think I explicitly changed any settings. I've tried reinstalling Calva and rebooting, to no avail.

VS code info:

Version: 1.51.1
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-12T10:54:25.653Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Linux x64 5.9.11-3-MANJARO

Calva version: v2.0.134

bug formatting

All 6 comments

Hello fellow Manjaro user :smiley:. This sounds really strange. Have you changed any formatting settings? (https://calva.io/formatting/#configuration). The only other thing off the top of my head that can be affecting it is other extensions. Have you tried disabling all other extensions (clj-kondo is fine to leave enabled), and then seeing if it behaves the same?

Hi, thanks for your help!

AFAIK I haven't changed any formatting settings. I don't have any .edn files in this project. I also checked the VS settings and the only relevant setting there is "calva.paredit.defaultKeyMap": "strict".

I tried disabling all extensions except Calva, or Calva and clj-kondo, but there is no change in the behavior.

Here's another thing I found: if I try to run the command 'Calva Format: Format Current Form', or a similar command, I also get the pop-up error "Running the contributed command: 'calva-fmt.formatCurrentForm' failed." or equivalent.

Very strange! Does it help to make click between some different clojure files? Thinking that maybe Calva gets confused about what is the active window, when the output window is activated....

Thanks for the input! I've tried opening multiple Clojure files, opening a single Clojure file, having VS Code's Output window opened or closed, but none of it made a difference in the behavior.

I will experiment some more later when I have time, and try to gather more data about the problem.

@MareinK If you can give code that the issue happens with, all the code in the file (can make a small sample file to make it simpler to analyze), maybe we can see if something in the code is tripping up the formatter.

@bpringe Thanks! I've currently shifted my experiments with Clojure/Calva to the browser with ClojureScript and shadow-cljs, so I haven't been in a situation where the REPL problem popped up. However, I will take some time soon to look into the problem again and try to produce a minimal example.

Was this page helpful?
0 / 5 - 0 ratings