问题
Does anyone know if there's a way to auto format ColdFusion documents
on VSCode the way it does for HTML files
?
回答1:
In VS Code, click on Extensions on the left side. Or View >> Extensions (or CTRL-SHIFT-X on Windows). Enter "CFML" in the Search box, and choose KamasamaK's extension (kamasamak.vscode-cfml). It is an excellent extension. There are also others, if you're interested.
Or https://marketplace.visualstudio.com/items?itemName=KamasamaK.vscode-cfml
回答2:
Auto format HTML, JS & CSS within CFM/CFML files?
If you want, you can install the Beautify and then add cfc, cfm, & cfml as languages in the settings.json file. After that, you can use "Beautify Selection" or "Beautify File" to modify code. If the plugin can't decide what type of code you are formatting, it will prompt you for "HTML, JS or CSS". (I've assigned a shortcut so I don't have to press CTRL+SHIFT+P to search for the the beautify option.)
SETTINGS.JSON
"beautify.config" : {
"beautify.language": {
"js": ["js","json","cfc"],
"css": ["css", "scss"],
"html": ["htm", "html", "cfml", "cfm"]
},
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "cfm", "cfml"]
}
}
来源:https://stackoverflow.com/questions/54837342/auto-format-on-visual-studio-code-for-cfm-files