# @codemirror/autocomplete

> Autocompletion for the CodeMirror code editor

Latest version **6.20.3** (published 2026-06-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @codemirror/autocomplete
pnpm add @codemirror/autocomplete
yarn add @codemirror/autocomplete
bun add @codemirror/autocomplete
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 6.20.3 |
| Published | 2026-06-03 |
| First published | 2020-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 250.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Marijn Haverbeke |
| Maintainers | marijn |
| Keywords | editor, code |

## Links

- npm: https://www.npmjs.com/package/@codemirror/autocomplete
- Repository: https://code.haverbeke.berlin/codemirror/autocomplete
- npm.io page: https://npm.io/package/@codemirror/autocomplete

## Dependencies (4)

- [@lezer/common](https://npm.io/package/@lezer/common.md) ^1.0.0
- [@codemirror/view](https://npm.io/package/@codemirror/view.md) ^6.17.0
- [@codemirror/state](https://npm.io/package/@codemirror/state.md) ^6.0.0
- [@codemirror/language](https://npm.io/package/@codemirror/language.md) ^6.0.0

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 6.20.3 (latest) — 2026-06-03
- 6.20.2 — 2026-05-06
- 6.20.1 — 2026-03-02
- 6.20.0 — 2025-11-20
- 6.19.1 — 2025-10-23
- 6.19.0 — 2025-09-26
- 6.18.7 — 2025-09-02
- 6.18.6 — 2025-02-12
- 6.18.5 — 2025-02-11
- 6.18.4 — 2024-12-17
- 6.18.3 — 2024-11-13
- 6.18.2 — 2024-10-30
- 6.18.1 — 2024-09-14
- 6.18.0 — 2024-08-05
- 6.17.0 — 2024-07-03
- … 74 more at https://npm.io/package/@codemirror/autocomplete/versions

## README

# @codemirror/autocomplete [![NPM version](https://img.shields.io/npm/v/@codemirror/autocomplete.svg)](https://www.npmjs.org/package/@codemirror/autocomplete)

[ [**WEBSITE**](https://codemirror.net/) | [**DOCS**](https://codemirror.net/docs/ref/#autocomplete) | [**ISSUES**](https://code.haverbeke.berlin/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/) | [**CHANGELOG**](https://code.haverbeke.berlin/codemirror/autocomplete/src/branch/main/CHANGELOG.md) ]

This package implements autocompletion for the
[CodeMirror](https://codemirror.net/) code editor.

The [project page](https://codemirror.net/) has more information, a
number of [examples](https://codemirror.net/examples/) and the
[documentation](https://codemirror.net/docs/).

This code is released under an
[MIT license](https://code.haverbeke.berlin/codemirror/autocomplete/tree/main/LICENSE).

We aim to be an inclusive, welcoming community. To make that explicit,
we have a [code of
conduct](http://contributor-covenant.org/version/1/1/0/) that applies
to communication around the project.

## Usage

```javascript
import {EditorView} from "@codemirror/view"
import {autocompletion} from "@codemirror/autocomplete"
import {jsonLanguage} from "@codemirror/lang-json"

const view = new EditorView({
  parent: document.body,
  extensions: [
    jsonLanguage,
    autocompletion(),
    jsonLanguage.data.of({
      autocomplete: ["id", "name", "address"]
    })
  ]
})
```

This configuration will just complete the given words anywhere in JSON
context. Most language modules come with more refined autocompletion
built-in, but you can also write your own custom autocompletion
[sources](https://codemirror.net/docs/ref/#autocomplete.CompletionSource)
and associate them with your language this way.

---
_Source: https://npm.io/package/@codemirror/autocomplete · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
