Skip to content

Integrating the LSP server into your IDE

Nick Kwiatkowski edited this page Nov 25, 2026 · 1 revision

Integrating the LSP server into your IDE

How the server is started

clif

Run with no arguments, clif is a Language Server speaking JSON-RPC 2.0 with LSP Content-Length headers over stdio. Configure your editor to launch it for these file types:

Extension Language id (suggested)
.cfc cfml
.cfm cfml
.cfml cfml
.cfs cfml

No command-line flags are needed. Settings come from .clif.json in the project and/or the client's initializationOptions (see LSP Initialization Options).

clif --version prints the version and exits, so an extension can probe the binary safely. An older cfmleditor-lsp binary name is still published for extensions that look for it.

Editors

VS Code

The CFML extension (cfmleditor) downloads and runs clif for you. To use your own build, point the extension's server path setting at your clif binary, or put a clif on PATH (see Building CLIF from source). Settings for the server go in initializationOptions, which the extension builds from its own settings, or in .clif.json.

For a generic client such as vscode-languageclient:

const serverOptions = { command: "clif", args: [] };
const clientOptions = {
  documentSelector: [{ scheme: "file", language: "cfml" }],
  initializationOptions: {
    formatting: { enabled: true },
    linting: { enabled: true, minSeverity: "WARNING" }
  }
};
new LanguageClient("clif", "clif", serverOptions, clientOptions).start();

Zed

The zed-cfml extension resolves its server in three steps: a path it has cached, then a clif found on PATH, then a GitHub release download. Settings go in Zed's settings.json:

{
  "lsp": {
    "clif": {
      "initialization_options": {
        "linting": { "enabled": true },
        "mappings": { "models": "./src/models" }
      }
    }
  }
}

Zed ignores a command's return value, so clif also reports command results through window/showMessage. Commands without a palette entry are reachable as code actions (cmd-. / ctrl-.), for example "Export unresolved calls report for the workspace".

Neovim (0.11+)

vim.filetype.add({ extension = { cfc = "cfml", cfm = "cfml", cfml = "cfml", cfs = "cfml" } })

vim.lsp.config("clif", {
  cmd = { "clif" },
  filetypes = { "cfml" },
  root_markers = { ".clif.json", ".cfmleditor.json", "Application.cfc", ".git" },
  init_options = {
    formatting = { enabled = true },
    references = { enabled = true },
  },
})
vim.lsp.enable("clif")

IntelliJ IDEA / JetBrains IDEs (LSP4IJ)

Install the LSP4IJ plugin, then add a new language server:

Field Value
Command clif (or the full path to the binary)
Mappings → File name patterns *.cfc, *.cfm, *.cfml, *.cfs
Configuration → Initialization options The JSON from LSP Initialization Options

The IntelliJ plugin starts the server without setting a working directory, so add a .clif.json with a workspaceName to the project if you want daemon mode.

Sublime Text (LSP package)

{
  "clients": {
    "clif": {
      "enabled": true,
      "command": ["clif"],
      "selector": "embedding.cfml | source.cfml",
      "initializationOptions": { "formatting": { "enabled": true } }
    }
  }
}

Emacs (eglot)

(add-to-list 'auto-mode-alist '("\\.cf[cms]l?\\'" . cfml-mode))
(with-eval-after-load 'eglot
  (add-to-list 'eglot-server-programs
               '(cfml-mode . ("clif" :initializationOptions (:formatting (:enabled t))))))

Helix (languages.toml)

[language-server.clif]
command = "clif"
config = { formatting = { enabled = true } }

[[language]]
name = "cfml"
scope = "source.cfml"
file-types = ["cfc", "cfm", "cfml", "cfs"]
language-servers = ["clif"]

A minimal project setup

// .clif.json at the project root
{
  "workspaceName": "myapp",
  "workspacePaths": ["."],
  "formatting": { "enabled": true },
  "linting": { "enabled": true, "minSeverity": "WARNING" },
  "references": { "enabled": true }
}

Settings are read once, at initialize. Restart the language server after changing them.

Daemon mode

When a .clif.json is found (walking upward from the working directory, nearest wins), the server runs in daemon mode:

Step Behaviour
1 The first editor session becomes the daemon, listening on a Unix socket and serving LSP over stdio
2 Later sessions for the same workspaceName connect to the daemon and share one index
3 The daemon shuts down when every session has disconnected

The socket is derived from workspaceName, so only sessions naming the same project share an index.

Without a config the server runs standalone: one session, its own index. Standalone sessions still read a .clif.json found above each workspace folder; they just don't join a daemon.

On macOS and Linux a config file is read only when you or root own it and no other user can write it. A file failing the check is skipped with a warning; chmod go-w .clif.json fixes it. Windows does not check.

Indexing

Configured Indexed
workspaceIndexGlobs Only .cfc files matching those globs
workspacePaths only Every .cfc under those folders
Neither The workspace folders the editor reports

Restart after a crash

The clif an editor starts is a supervisor: it runs the real server as a child process and relays the session. If the server exits unexpectedly, the supervisor starts a new one and replays the session: initialize, configuration, workspace folders, and every open document including unsaved edits.

Detail Behaviour
Unanswered requests Answered ContentModified, which editors retry or drop quietly
Notification The editor is told the server restarted
Limit More than 5 exits in 3 minutes: not restarted again
Daemon mode Each editor's supervisor restarts its own session
Opt out Set CLIF_NO_SUPERVISOR=1 in the editor's environment for the server (the wasm build always runs unsupervised)

Logs and crash reports

Output Where
Server log stderr, which the editor keeps in its language-server log
Copy of the full log The file named by CLIF_LOG (set in the environment the editor starts the server with)
Crash reports crash.log in the cache directory: ~/Library/Caches/clif/crash.log (macOS), ~/.cache/clif/crash.log or $XDG_CACHE_HOME/clif/crash.log (Linux), %LocalAppData%\clif\crash.log (Windows). With CLIF_LOG set, crash reports go there instead

Each start adds one line to crash.log naming the version, process and time; anything else is a crash record with its stack. For a fatal Go error the one-line reason (fatal error: stack overflow) appears only on stderr.

Tracing LSP traffic

Set "debug": true in the workspace's .clif.json and restart the server. Each LSP response record in stderr (or CLIF_LOG) holds the method, request id, elapsed time and JSON result or error; workspace commands record the command name. The trace includes published diagnostics and workspace/applyEdit acknowledgements. Results can contain source text: keep the log private and review it before sharing.

debug is read from the file on disk, not from initializationOptions.

← Integrator Documentation · Home

Clone this wiki locally