WebStorm:如何配置HTML插值表达式{{}}内的空格格式化规则?
Fixing Space Formatting for Interpolation Expressions in WebStorm HTML Templates
Got it, I know exactly where to adjust this setting since the TypeScript one only applies to .ts files. Here's how to get your HTML template interpolations formatted with spaces inside {{}}:
- Open WebStorm's settings:
- On Windows/Linux: Use
Ctrl+Alt+S, or go to File > Settings - On Mac: Use
Cmd+,, or go to WebStorm > Preferences
- On Windows/Linux: Use
- Navigate to Editor > Code Style > HTML
- Switch to the Other tab (it's near the top right of the settings panel)
- Scroll down to the Handlebars/Mustache section—this covers most framework interpolation syntaxes like Vue, Angular, or Handlebars itself
- Check the box labeled Add space inside handlebars expressions (the exact wording might vary slightly across WebStorm versions, but it'll clearly reference adding spaces inside
{{}}) - Click Apply then OK to save the changes
Now when you hit Ctrl+Alt+L to format your HTML files, any interpolation like {{userName}} will automatically become {{ userName }} with spaces inside the curly braces.
内容的提问来源于stack exchange,提问作者Platon Efimov
相关产品推荐
相关产品推荐

