@codemirror/autocomplete
Advanced tools
Comparing version 6.18.4 to 6.18.5
@@ -0,1 +1,7 @@ | ||
## 6.18.5 (2025-02-11) | ||
### Bug fixes | ||
Fix an issue where clicking on the scrollbar for the completion list could move focus out of the editor. | ||
## 6.18.4 (2024-12-17) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "@codemirror/autocomplete", | ||
"version": "6.18.4", | ||
"version": "6.18.5", | ||
"description": "Autocompletion for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -19,1 +19,26 @@ # @codemirror/autocomplete [](https://www.npmjs.org/package/@codemirror/autocomplete) | ||
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. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
249737
4773
44