npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@exercism/codemirror-lang-cfml

v1.0.2

Published

CFML language support for CodeMirror, with completion, as used on Exercism

Readme

CFML language support for CodeMirror

NPM Version

This package gives the CodeMirror 6 editor a Lezer grammar for CFScript, the script syntax of CFML (Adobe ColdFusion and Lucee), with highlighting, indentation, folding and completion. Exercism uses it in the editor for its CFML track.

To keep the package working on the Exercism website, don't change the versions of these packages:

"@codemirror/language": "^6.10.1",
"@lezer/highlight": "^1.2.0",
"@lezer/lr": "^1.4.0"

Install

  • NPM: npm install @exercism/codemirror-lang-cfml
  • Yarn: yarn add @exercism/codemirror-lang-cfml
  • Bun: bun add @exercism/codemirror-lang-cfml

Usage

import { EditorView, basicSetup } from "codemirror";
import { cfml } from "@exercism/codemirror-lang-cfml";

new EditorView({
  doc: "component {\n\tfunction hello() {\n\t\treturn 'Hello, World!';\n\t}\n}",
  extensions: [basicSetup, cfml()],
  parent: document.body,
});

cfml() includes the completion. The package also exports cfmlLanguage, the two completion sources (localCompletionSource and cfmlCompletion) and the snippets.

What it covers

The grammar reads .cfc components and plain CFScript:

  • component and interface declarations with attributes, as in component extends="Base" accessors=true { }.
  • property declarations, in both the property name="x" type="string"; and property string x; forms.
  • functions with access modifiers, return types, required and typed arguments, defaults and attributes, as in public numeric function add(required numeric a, b = 1) output=false { }.
  • closures (function(x) { }) and arrow functions ((x) => x * 2, x => x).
  • var, if, else if, Lucee's elseif, for, for (x in y), while, do, switch, try, catch, finally, throw and rethrow.
  • tags written as script, as in cfloop(index="i" from="1" to="#n#") { }, lock name="x" { }, include "page.cfm"; and abort;.
  • operators, including the word operators EQ, NEQ, GT, LT, GTE, LTE, IS, CONTAINS, MOD, AND, OR, NOT, XOR, EQV and IMP, & for joining strings, and the ?: Elvis operator.
  • strings with #expression# interpolation, and "", '' and ## escapes.
  • structs ({a: 1, "b" = 2}), ordered structs (["a": 1], [:]), arrays, new, and member functions such as name.len().

Keywords are case-insensitive, so FUNCTION, Function and function all work. Semicolons are optional at the end of a line, as Lucee allows. The rule that lets a line break end a statement is adapted in src/tokens.js from @lezer/javascript (MIT licence, by Marijn Haverbeke and others).

The completion offers:

  • keywords, CFML's built-in functions (such as arrayLen, listToArray and structKeyExists) and the scopes (arguments, variables, local and the others).
  • snippets for component, function, public and private functions, closures, if, if/else, for, for in, while, do, switch, try/catch, var, property and throw. The statement snippets appear at the start of a statement.
  • types for return types and arguments, such as numeric, string and struct.
  • the names declared in the file, each only where it is in scope. Inside a function that means its arguments, and the var and local. names, loop variables and caught errors declared before the cursor. Everywhere in the component, it means the functions, the properties, and the variables set outside a function's own scope (total = 0, variables.total = 0 or this.total = 0).
  • after arguments., local., variables. or this., the names that scope holds.
  • after any other dot, CFML's member functions, such as len, each, map and keyExists.

It offers nothing inside strings (outside #...#) and comments, or while you type a new name.

The grammar reads CFScript only, so .cfm pages written in tags (<cfset>, <cfoutput>) will show errors.

Prerequisites

Setup

Run bun install to install all dependencies.

Developing

To help with development, run bun run dev. This will start a Vite dev server (usually at http://localhost:5173/) that renders the index.html file. The #editor element shows some sample CFML code, highlighted by the grammar in src/syntax.grammar. Any changes to the grammar will auto-refresh the dev server's rendered contents.

Structure

.
├── src
│   ├── index.ts (the language, with its indentation and folding)
│   ├── syntax.grammar (the Lezer grammar)
│   ├── tokens.js (the case-insensitive keywords and the line break rule)
│   ├── highlight.js (the highlighting)
│   ├── complete.ts (the completion)
│   └── builtins.ts (the names of the built-in functions, member functions and types)
├── test
│   ├── cases (grammar test cases)
│   ├── grammar.test.ts (runs the grammar test cases)
│   ├── complete.test.ts (completion tests)
│   ├── editor.test.ts (indentation and folding tests)
│   └── lezer-plugin.ts (builds the grammar for the tests)
├── index.html (dev server file)
├── rollup.config.js (bundling config)
├── tsconfig.json (typescript config)
└── vite.config.js (vite dev server config)

Testing

Run bun test to run the tests.

Building

Run bun run prepare to build the package into dist/. bun install runs the same command, so a fresh install also builds the package.

Publishing

To publish a new version, set version in package.json and commit it. Then push a tag made of v followed by that version, for example v1.0.0. The tag starts the Publish workflow, which builds and tests the package and publishes it to npm. If the tag differs from version, the workflow stops before it publishes.