Vscode-yaml: Feature request: formatter

Created on 9 Feb 2018  路  15Comments  路  Source: redhat-developer/vscode-yaml

Hello,
if I select "Format document", vscode pops up "Sorry, but there is no formatter for 'yaml'-files installed."
It would be nice if this extension supported formatting :-)

Most helpful comment

The parser does not support comments so when formatting it it just removed it. I鈥檓 switching formatters soon and that will fix the problem.

All 15 comments

The formatter should be available in our latest update! The code was in it server side for a while I just didn't update some vscode extension dependencies so it wasn't showing up

Thanks!

Hey I'm on 0.0.9 and seeing the same message

Same here. No formatter in 0.0.9

Have you turned on the formatter in the yaml settings? It鈥檚 not enabled by default. After it鈥檚 enabled it requires a restart.

I see. Yes, it is working with the settings enabled.

I've enabled the formatter and restarted VS Code, yet I still get the message that there is no formatter. I'm on version 0.0.11. Tried uninstalling and re-installing the extension, too.

It seems to work fine for me on latest version. Are you accidentally using https://marketplace.visualstudio.com/items?itemName=adamvoss.yaml instead of https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml or do you have any other yaml extensions activated?

The only other extensions I have installed besides this one are a Python extension and an ESLint extension. I've enabled "yaml.format.enable": true in my user settings. I'm assuming I can format code by highlighting what I want to format and pressing cmd-K-F like I can for JavaScript. Is that correct, or am I misunderstanding?

Currently it just formats the entire document. If you right click on a yaml file is the format document option there? Which version of vscode are you using?

I'm on VS Code version 1.22.2. When the file is open in the file explorer this is my menu when I right click. Right clicking on a closed file has a menu with less options.
menu

No, I mean when you have a yaml file open and you right click inside the text editor. This is what I see.
screenshot from 2018-05-02 10-39-24

Ah yes, I see it. When I click the menu option it works. Thank you very much!

Any reason why the format removes comments?(Statements starting with a hash #)

The parser does not support comments so when formatting it it just removed it. I鈥檓 switching formatters soon and that will fix the problem.

Was this page helpful?
0 / 5 - 0 ratings