quick-lint-js

Find bugs in JavaScript programs.

This page documents the quick-lint-js Language Server Protocol (LSP) server.

Table of Contents

Description

quick-lint-js supports the Language Server Protocol. This allows code editors to ask quick-lint-js for diagnostics which can be displayed inline.

To start the quick-lint-js LSP server, run the quick-lint-js CLI with the --lsp-server option. The server accepts JSON-RPC+LSP messages from the editor via standard input, and sends JSON-RPC messages to the editor via standard output.

Supported LSP features

quick-lint-js can receive and handle the following LSP requests and notifications:

  • Basic lifecycle

    • exit

    • initialize

    • initialized

    • shutdown

  • Document sync

    • textDocument/didClose

    • textDocument/didOpen

    • textDocument/didChange

quick-lint-js sends the following LSP requests and notifications:

  • textDocument/publishDiagnostics

  • window/showMessage

  • workspace/configuration

quick-lint-js interprets documents with the following document language IDs as if they were JavaScript+JSX files (like the --language=javascript-jsx command line option):

  • javascript

  • javascriptreact

  • js-jsx

  • js

quick-lint-js interprets documents with the following document language IDs as if they were TypeScript files (like the --language=experimental-typescript command line option):

  • typescript

quick-lint-js interprets documents with the following document language IDs as if they were TypeScript JSX files (like the --language=experimental-typescript-jsx command line option):

  • tsx

  • typescriptreact

quick-lint-js interprets documents with a base name of quick-lint-js.config as a JSON config file. The document’s language ID is ignored. See quick-lint-js.config(5) for more details.

Configuration

The quick-lint-js LSP server accepts the following configuration settings, communicated through workspace/configuration:

quick-lint-js.tracing-directory

Log raw LSP messages between the editor and quick-lint-js. A timestamped subdirectory is created inside the tracing directory containing binary log files. If null or an empty string, tracing is disabled.

It is also possible to configure quick-lint-js using the initialize request. To do so, set initializationOptions to an object containing a configuration object containing the settings. For example, the following initialize request sets quick-lint-js.tracing-directory:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "processId": null,
    "rootUri": null,
    "capabilities": {},
    "initializationOptions": {
      "configuration": {
        "quick-lint-js.tracing-directory": "/tmp/quick-lint-js-logs"
      }
    }
  }
}