I have copied the following question from the Elm Slack channel for posterity.
I am having trouble getting the Elm VSCode plugin to format on save. I have set the absolute path to my global install of elm-format
in settings.json
. I have also set format on save for elm:
"[elm]": {
"editor.formatOnSave": true,
},
I am on an Ubuntu machine, and format does not happen on save or with Ctrl-Shift-I
. Does anyone see something that I might be missing?
Install elm-format
Install the extension Elm Language Support for VSCode, which includes syntax and error highlighting
Configure VS code settings.json
:
"[elm]": {
"editor.formatOnSave": true
},
The format on save timeout should not be an issue with VSCode 1.42 (Q1 2020)
See "Better handling of slow save operations":
VS Code allows extensions to change a file's contents when saving files to disk.
Features likeFormat on Save
andFix on Save
are examples.However, saving is a critical operation and extensions doing processing during a save must finish quickly so that the actual save operation can proceed.
"Quickly" used to be enforced by VS Code with timeouts that would make VS Code cancel extension save participation.
That enforcement guaranteed speedy saving but could be frustrating because sometimes expected processing would not happen.With this release, we have given up the timeout-based approach and instead show a progress notification that allows you to cancel extensions participating in save ("
Save Participants
").
The notification lets you know that save operations are running and you can decide if you want to wait for a save participant to finish or not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With