The Crystal Programming Language Forum

VSCode formatter not working

I cannot format *.cr files in VSCode after Cmd+Shift+P + Format Document. I have installed Crystal Language 0.8.1 extension. I am using macOS Big Sur 11.2.3 and VSCode v1.55.0.

I’m using Visual Studio Code on Mac too and you could always just do this: Terminal > New Terminal then crystal tool format. That’s what I do since I always have terminal open anyway for sentry.

Formatting works for me with this in my settings.json:

"[crystal]": {
  "editor.formatOnSave": true,
  "editor.defaultFormatter":"crystal-lang-tools.crystal-lang"
}

I assume you may not want the format on save, but I wouldn’t expect that to work unless manual formatting also worked.