CFML Assist — Lucee Malaysia
Editor support for CFML and Lucee, generated from the engine itself.
Built and maintained by the lucee.my community.
English first, Bahasa Melayu below.
English
Why it is different
Most CFML extensions keep a hand written list of functions, and that list goes stale. This one asks the
running engine: getFunctionList(), getFunctionData() and getTagData() on Lucee 7.1.1.17-RC (the version
recorded in the bundled metadata). The names,
types and descriptions you see are the ones the engine actually has.
What works
- Completions for 783 functions and 112 tags, with types and descriptions
- Attribute completions inside a tag, including which attributes are required
- Hover documentation for functions, tags and attributes, with a link to the page on docs.lucee.org
- Diagnostics: unknown tags, unknown attributes, missing required attributes, and SQL injection
(
form, url, cookie, cgi or arguments values, such as #form.x# or #trim(url.y)#, concatenated
into SQL without cfqueryparam)
- Leaked variables: inside a function, an assignment without
var or local. (including <cfquery name>
and <cfloop index> in tag components) is flagged, because it lands in the shared variables scope.
Skipped for localmode="modern"; turn off with cfmlAssist.diagnostics.unscopedVar
- Quick fixes (the light bulb): wrap an unsafe SQL value in
<cfqueryparam>, removing its SQL quotes,
add a missing required attribute, or declare a leaked variable with var / local.
- Signature help with the active parameter highlighted
- Snippets: 12 everyday patterns, including a
cfquery that already uses cfqueryparam
- Formatting: consistent indentation, long opening tags wrapped one attribute per line, and aligned multiline tags
- Syntax colours that follow your theme: CFML and HTML tags, attributes,
#expressions# inside text and
attribute values, Lucee built-in functions apart from your own, scopes (form, url, arguments...), SQL in
<cfquery>, JavaScript in <script>, CSS in <style>, and script components. Plain text is left alone, so
an apostrophe in "Don't" no longer colours the rest of the line
- Member functions:
senarai. on an array offers .append(), .len()... with signature help and hover
(338 members in 12 types, generated and tested on the engine). Shown only when the type is certain: a literal,
<cfquery name>, or the latest assignment from a literal or engine function
- Your own functions: functions defined in the same file (script or
<cffunction>) get completion,
hover, signature help and go to definition; <cfinclude template="..."> opens the included file
- Go to definition for components:
new components.Harga() opens components/Harga.cfc, and
h.jumlah() jumps to the jumlah function in it
- Component methods: type
h. and see the methods of new components.Harga() or
createObject("component", "components.Harga") with their signatures, for script and tag-based components
- Application.cfc mappings:
this.mappings is read, so new model.Harga() resolves to a mapped folder outside
the webroot. Relative paths and expandPath() are taken from the folder of Application.cfc
- Find All References and Rename (F2) for functions: a component method is found in its component and in
h.method() calls anywhere in the project where h resolves to that component; page functions within the page
- Outline as a tree: component > properties and functions > queries, plus
<cfscript> blocks in pages;
entries span their whole body so they fold and follow the cursor. Workspace search for CFC functions
- Settings: turn diagnostics off, exclude folders from indexing, or raise the indexed
.cfc limit
(cfmlAssist.index.maxFiles, default 2000, with a warning when reached)
What is missing
This is honest about scope. There is no framework awareness for ColdBox or Wheels, and rename covers functions only, not variables. Formatting
wraps standalone opening tags, but does not reflow inline text or format embedded JavaScript, CSS, or SQL.
The editor-independent logic (completions, hover, diagnostics, formatting, CFC
parsing) has automated tests you can run with npm test; behaviour inside VS Code itself is checked by hand.
Anything not listed does not exist yet.
Install
- Open Visual Studio Code
- Open Extensions and search for CFML Assist
- Install, then reload the window
Or:
code --install-extension luceemy.cfml-assist
If you already use another CFML extension, disable it: two extensions cannot own the same language id.
Other editors (Language Server)
The same features are available to any editor that speaks the Language Server Protocol, through
lsp/server.js (Node.js 18 or newer, no dependencies). Clone this repository, then point your editor at:
node /path/to/cfml-assist/lsp/server.js --stdio
Neovim 0.11:
vim.filetype.add({ extension = { cfm = "cfml", cfc = "cfml" } })
vim.lsp.config("cfml_assist", {
cmd = { "node", "/path/to/cfml-assist/lsp/server.js", "--stdio" },
filetypes = { "cfml" },
root_markers = { "Application.cfc", ".git" },
})
vim.lsp.enable("cfml_assist")
It provides completion, hover, signature help, diagnostics with quick fixes, formatting, go to definition,
outline, references and rename. Syntax colours come from your editor's own CFML grammar.
In a CFML file, run Format Document With..., choose Configure Default Formatter..., and
select CFML Assist. Add these entries to your VS Code settings.json to format on save:
"[cfml]": {
"editor.defaultFormatter": "luceemy.cfml-assist",
"editor.formatOnSave": true,
"editor.tabSize": 4,
"editor.insertSpaces": true
},
"cfmlAssist.format.printWidth": 100
Opening tags on their own line wrap after 100 columns by default. Existing multiline tags keep
one attribute per line. Set cfmlAssist.format.printWidth to 0 to disable automatic wrapping.
Quoted attribute values keep their contents; multiline quoted values, standalone comments, and
pre, textarea, script, and style blocks are preserved. Inline tags with text stay on one line.
This is a CFML formatter, not a replacement for Prettier on separate JavaScript or CSS files.
Development tests
Run npm test (or node --test) with Node.js 24. It runs the suites in test/, which
exercise core.js using the bundled metadata; they do not execute Lucee or a VS Code extension host. Tests in a real VS Code
live in test/vscode/; CI runs them on VS Code 1.80.0 and the current stable release. To run them locally:
npm install --no-save @vscode/test-electron@2.4.1
CFML_VSCODE_TEST=1 node test/vscode/run.js stable
The launcher is installed only for that run and is not a dependency of the extension.
Licence
MIT. No telemetry. Works offline, because the metadata ships inside the package.
Bahasa Melayu
Kenapa ia berbeza
Kebanyakan sambungan CFML menyimpan senarai fungsi secara manual, dan senarai itu menjadi basi.
Sambungan ini bertanya kepada enjin yang sedang berjalan: getFunctionList(), getFunctionData() dan
getTagData() pada Lucee 7.1.1.17-RC (versi yang tercatat dalam metadata), jadi nama, jenis dan deskripsi
sepadan dengan enjin yang anda jalankan.
Apa yang berfungsi
- Penyiapan untuk 783 fungsi dan 112 tag, dengan jenis dan deskripsi
- Penyiapan atribut di dalam tag, termasuk atribut yang wajib
- Hover untuk fungsi, tag dan atribut, dengan pautan ke halamannya di docs.lucee.org
- Diagnostik: tag tidak dikenali, atribut tidak dikenali, atribut wajib yang tiada, dan suntikan SQL
(nilai
form, url, cookie, cgi atau arguments, contohnya #form.x# atau #trim(url.y)#, yang
dicantum ke dalam SQL tanpa cfqueryparam)
- Pemboleh ubah bocor: di dalam fungsi, tugasan tanpa
var atau local. (termasuk <cfquery name> dan
<cfloop index> dalam komponen tag) ditandakan kerana ia masuk ke skop variables yang dikongsi.
Dilangkau untuk localmode="modern"; matikan dengan cfmlAssist.diagnostics.unscopedVar
- Quick fix (lampu mentol): bungkus nilai SQL yang tidak selamat dengan
<cfqueryparam> (petikan SQL
dibuang sekali), tambah atribut wajib yang tiada, atau isytihar pemboleh ubah bocor dengan var / local.
- Signature help dengan parameter aktif ditandakan
- Snippet: 12 corak harian, termasuk
cfquery yang sudah membawa cfqueryparam
- Format: inden konsisten, atribut tag panjang satu per baris, dan penjajaran tag berbilang baris
- Warna sintaks yang mengikut tema anda: tag CFML dan HTML, atribut,
#ungkapan# dalam teks dan nilai
atribut, fungsi bawaan Lucee berbeza daripada fungsi anda sendiri, skop (form, url, arguments...), SQL
dalam <cfquery>, JavaScript dalam <script>, CSS dalam <style>, dan komponen skrip. Teks biasa tidak
diwarnakan, jadi apostrof dalam "Don't" tidak lagi mewarnakan baki baris
- Fungsi ahli:
senarai. pada array mencadangkan .append(), .len()... dengan signature help dan hover
(338 kaedah dalam 12 jenis, dijana dan diuji pada enjin). Hanya muncul apabila jenisnya pasti: literal,
<cfquery name>, atau tugasan terakhir daripada literal atau fungsi enjin
- Fungsi anda sendiri: fungsi yang ditakrifkan dalam fail yang sama (skrip atau
<cffunction>) mendapat
penyiapan, hover, signature help dan pergi ke definisi; <cfinclude template="..."> membuka fail itu
- Pergi ke definisi untuk komponen:
new components.Harga() membuka components/Harga.cfc, dan
h.jumlah() melompat ke fungsi jumlah di dalamnya
- Kaedah komponen: taip
h. dan lihat kaedah new components.Harga() atau
createObject("component", "components.Harga") dengan tandatangannya, untuk komponen skrip dan tag
- Mapping Application.cfc:
this.mappings dibaca, jadi new model.Harga() ditemui dalam folder yang
dipetakan di luar webroot. Laluan relatif dan expandPath() dikira dari folder Application.cfc
- Find All References dan Rename (F2) untuk fungsi: kaedah komponen dicari dalam komponennya dan dalam
panggilan
h.kaedah() di seluruh projek apabila h dikenal pasti sebagai komponen itu; fungsi halaman dalam halamannya
- Outline berstruktur: komponen > property dan fungsi > query, serta blok
<cfscript> dalam halaman;
setiap entri meliputi seluruh badannya supaya boleh dilipat dan mengikut kursor. Carian seluruh projek untuk fungsi CFC
- Tetapan: matikan diagnostik, kecualikan folder daripada indeks, atau naikkan had fail
.cfc yang
diindeks (cfmlAssist.index.maxFiles, lalai 2000, dengan amaran apabila dicapai)
Apa yang belum ada
Ini jujur tentang skop. Belum ada kesedaran ColdBox atau Wheels, dan rename hanya untuk fungsi, bukan pemboleh ubah. Formatter memecahkan
tag pembuka pada baris sendiri, tetapi tidak menyusun semula teks sebaris atau memformat JavaScript, CSS
atau SQL terbenam. Logik yang tidak bergantung pada editor (penyiapan, hover, diagnostik, format,
bacaan CFC) mempunyai ujian automatik yang boleh dijalankan dengan npm test; tingkah laku di dalam
VS Code sendiri disemak secara manual. Apa yang tidak tersenarai belum wujud.
Cara memasang
- Buka Visual Studio Code
- Buka Extensions, cari CFML Assist
- Tekan Install, kemudian muat semula tetingkap
Atau:
code --install-extension luceemy.cfml-assist
Kalau anda sudah menggunakan sambungan CFML lain, matikan dahulu: dua sambungan tidak boleh memiliki ID
bahasa yang sama.
Editor lain (Language Server)
Ciri yang sama tersedia untuk mana-mana editor yang menyokong Language Server Protocol, melalui
lsp/server.js (Node.js 18 ke atas, tiada pergantungan). Klon repositori ini, kemudian tetapkan editor anda
untuk menjalankan node /laluan/ke/cfml-assist/lsp/server.js --stdio. Contoh konfigurasi Neovim ada dalam
bahagian English di atas. Ia menyediakan penyiapan, hover, signature help, diagnostik dengan quick fix, format,
pergi ke definisi, outline, rujukan dan rename. Warna sintaks datang daripada grammar CFML editor itu sendiri.
Buka fail CFML, jalankan Format Document With..., pilih Configure Default Formatter...,
dan pilih CFML Assist. Masukkan tetapan di atas dalam VS Code settings.json untuk format
semasa menyimpan fail. cfmlAssist.format.printWidth menentukan had panjang tag (lalai 100);
nilai 0 mematikan pembungkusan automatik. Tag berbilang baris kekal satu atribut setiap baris.
Kandungan nilai atribut berpetikan dikekalkan. JavaScript, CSS dan SQL terbenam tidak diformat.
Komuniti
Lesen
MIT. Tiada telemetri. Berfungsi luar talian kerana metadata dibawa di dalam pakej.
| |