3

I'm on Ubuntu. Pushing Ctrl + Shift + i in VS Code auto formats the file.

I was editing a solidity contract and pushed Ctrl + Shift + i, VS Code didn't have a formatter configured so it asked me to pick one - I accidentally chose my JS prettifier extension instead of the solidity one. This badgered up my code by trying to use single quotes instead of double quotes (not allowed in solidity) and some other non-solidity friendly changes.

Pushing Ctrl + Shift + i now just auto formats with the wrong formatter with no option to pick a different one.

How can I change which linter/formatter is associated to which file types in VS Code?

1 Answer 1

5

Solution A:

Press Ctrl+Shift+P

Then type Format Document With...

At the end of the list click on Configure Default Formatter...

Now you can choose your favorite beautifier from the list.

Solution B:

go to file -> preferences -> settings search for format, on the left side, click on Text Editor, the very first item on the right side is Editor: Default Formatter from the dropdown you can pick any document formatter which you installed before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.