Stream: beginners

Topic: Roc format on save (VS Code)


view this post on Zulip Shawn (Feb 01 2024 at 04:36):

How can I setup format on save with VS Code?

view this post on Zulip Artur Domurad (Feb 01 2024 at 13:26):

If you use the unofficial vscode extension (https://github.com/ivan-demchenko/roc-vscode-unofficial) with LSP configured then something like this works for me:

{
  "roc-lang.language-server.exe": "/path/to/roc_ls",
  "editor.formatOnSave": true,
  "editor.formatOnSaveMode": "file"
}

view this post on Zulip Shawn (Feb 01 2024 at 16:11):

image.png

view this post on Zulip Shawn (Feb 01 2024 at 16:12):

I tried this, and I believe the LSP is working because I'm getting warnings in my code, but it's still not formatting on save

view this post on Zulip Shawn (Feb 01 2024 at 16:13):

I also have the Roc (Unofficial) extension installed by Ivan

view this post on Zulip Artur Domurad (Feb 01 2024 at 16:44):

Does the formatting work at all?
Can you manually format a roc file?
E.g. when you run "command pallete (ctrl/cmd + shift + p)" -> "Format Document"

view this post on Zulip Shawn (Feb 01 2024 at 16:48):

Thanks, I had prettier set as my formatter, changed it to Roc and now it works :)


Last updated: Jul 06 2025 at 12:14 UTC