Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>CFML Auto FormatterNew to Visual Studio Code? Get it now.
CFML Auto Formatter

CFML Auto Formatter

hri

|
92 installs
| (3) | Free
CFML Indent Formatter / CFML インデント整形
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

🐧🎈ᓚᘏᗢ CFML Auto Formatter

🏈 English

CFML Code Auto-Formatting Extension for VS Code. This extension is specialized in automatic tag wrapping and indent formatting, without making unnecessary code style changes.


Features

  • CFML (.cfc) automatic indent formatting (stable operation)
  • Automatic tag wrapping
  • Partial formatting by block tags
  • Preserves original code style
  • Supports manual execution & automatic formatting on save

Usage

  1. Install the extension.
  2. Open a CFML file (.cfm or .cfc).
  3. Right-click and select Format CFML (satt).
  4. Choose from the available formatting options:
    • CFTag Syntax: Formats CFML tags (e.g., <cfquery xxx>XXX</cfquery>). If no content is selected, formats the entire CFC file.
    • Script Syntax: Formats content within <cfscript> blocks. Can also format embedded JavaScript.
    • HTML Syntax: Formats HTML tag content within .cfm files.
    • CSS Syntax: Formats CSS content within .cfm files.

Notes

  • .cfc file formatting operates stably
  • .cfm files may have formatting issues → planned to improve in the future
  • SQL statements should avoid leading commas why?
  • When formatting after focusing on the opening tag, the closing tag may be automatically added. This is an issue caused by another plugin (e.g. Auto Close Tag).
  • SQL formatting is first done using sql-formatter. However, if it includes something particularly complex such as cfloop, my own custom logic is applied.
  • The formatting of cfscript is very similar to JavaScript. If the string contains SQL statements, XML, or HTML tags, tags may break, so it’s better not to use it.
  • Automatic tag wrapping is useful when a tag has many attributes, but short inline tags may also get wrapped.
  • I have already tried using Lucee’s AST methods astFromString() and astFromPath(), but I couldn’t get detailed information from them. Below is the execution result I obtained, and I’m still experimenting with this. [See issue #20](https://github.com/satt-hri/vscode-plugin-cf-formatter/issues/20)

1. Tag wrapping

Tag wrapping demo

2. Partial formatting

2.1 CFTag Syntax 2.2 Script Syntax
CFTag demo Script demo

3. Indent formatting

Indent formatting demo

⚙️ CFML Formatter Default Settings

Setting Default Value Type Description
hri.cfml.formatter.indentWithTabs true boolean Use tabs instead of spaces for indentation.
hri.cfml.formatter.indentSize 4 number Number of spaces when indenting with spaces (1–10).
hri.cfml.formatter.indentChar " " string Indent character: space " " or \t. Overridden by indentWithTabs.
hri.cfml.formatter.wrapLineLength 0 number Wrap lines after this many characters. 0 means no limit.
hri.cfml.formatter.maxPreserveNewlines 2 number Maximum number of consecutive newlines to preserve (0–10).
hri.cfml.formatter.preserveNewlines true boolean Whether to preserve existing newlines.
hri.cfml.formatter.keepArrayIndentation false boolean Whether to preserve original array indentation.
hri.cfml.formatter.braceStyle "collapse" string Brace style: collapse / expand / end-expand / none.
hri.cfml.formatter.breakChainedMethods false boolean Whether to break chained methods into multiple lines.
hri.cfml.formatter.spaceBeforeConditional true boolean Whether to add a space before conditionals (if, while, for).
hri.cfml.formatter.endWithNewline false boolean Whether to add a newline at the end of the file.
hri.cfml.formatter.expressionWidth 30 number Wrap lines when the SQL string length exceeds this value.
hri.cfml.formatter.sqlLanguage "mysql" string Select SQL dialect for formatting.

💡 How to Change Settings Press Ctrl + , in VSCode and enter "Format CFML (satt)" in the search box to make changes. After modifying, don’t forget to reload the window!


👘 日本語

VS Code 用 CFML コード自動整形拡張機能。
この拡張機能は タグの自動改行、インデント整形に特化 しており、余計なコードスタイルの変更は行いません。


機能

  • CFML (.cfc) コードの自動インデント整形(安定動作)
  • タグの自動改行
  • ブロックタグごとで部分的にフォーマット
  • 元のコードスタイルを保持
  • 手動実行 & 保存時自動整形に対応

使い方

  1. 拡張機能をインストール
  2. CFML ファイルを開く(.cfm または .cfc)
  3. ショートカット Shift + Alt + M または右クリックで Format CFML (satt) を選択
  4. 利用可能なフォーマットオプションから選択:
    • CFTag 構文: CFML タグをフォーマットします(例: <cfquery xxx>XXX</cfquery>)。選択がない場合は CFC ファイル全体をフォーマットします。
    • Script 構文: <cfscript> ブロック内のコンテンツをフォーマットします。埋め込まれた JavaScript もフォーマット可能です。
    • HTML 構文: .cfm ファイル内の HTML タグコンテンツをフォーマットします。
    • CSS 構文: .cfm ファイル内の CSS コンテンツをフォーマットします。

注意点

  • .cfc ファイルの整形は安定動作
  • .cfm ファイルは整形が乱れる場合あり → 今後改善予定
  • SQL文はカンマ前置をしないように 何故?
  • 開始タグにフォーカスしてからフォーマットすると、自動で閉じタグが追加されてしまう場合がある。これは他のプラグインの問題である。例: (Auto Close Tag)
  • SQL のフォーマットは、まず sql-formatter を使用します。ただし、cfloop など特に複雑なものを含む場合は、自作のロジックでフォーマットします。
  • cfscript のフォーマットは、JavaScript と非常に似ています。 SQL 文や XML、HTML タグが含まれていると、タグが壊れることがあるので、使わないほうがいいです。
  • タグの自動改行は属性が多い場合に便利ですが、インラインで短いタグを使いたいケースでは改行されることがあります。

CFML フォーマッタ デフォルト設定

設定項目 デフォルト値 型 説明
hri.cfml.formatter.indentWithTabs true boolean インデントにスペースではなくタブを使用する。
hri.cfml.formatter.indentSize 4 number スペースでインデントする場合のスペース数(1–10)。
hri.cfml.formatter.indentChar " " string インデント文字:スペース " " または \t。indentWithTabs で上書きされる。
hri.cfml.formatter.wrapLineLength 0 number この文字数を超えると改行。0 は制限なし。
hri.cfml.formatter.maxPreserveNewlines 2 number 連続して保持する改行の最大数(0–10)。
hri.cfml.formatter.preserveNewlines true boolean 既存の改行を保持するかどうか。
hri.cfml.formatter.keepArrayIndentation false boolean 配列の元のインデントを保持するかどうか。
hri.cfml.formatter.braceStyle "collapse" string 波括弧スタイル:collapse / expand / end-expand / none。
hri.cfml.formatter.breakChainedMethods false boolean メソッドチェーンを複数行に分割するかどうか。
hri.cfml.formatter.spaceBeforeConditional true boolean 条件文(if, while, for)の前にスペースを入れるか。
hri.cfml.formatter.endWithNewline false boolean ファイル末尾に改行を追加するかどうか。
hri.cfml.formatter.expressionWidth 30 number sql指定文字列長さを超えると改行
hri.cfml.formatter.sqlLanguage "mysql" string フォーマットSQLを選ぶ

💡 設定変更方法
VSCode で Ctrl + , を押し、検索欄に 「Format CFML (satt)」 と入力すると変更可能。変更があったら、再起動みたいな操作でウィンドウをリロードするのを忘れないでね

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft