@codemirror/autocomplete 6.4.1 → 6.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.4.2 (2023-02-17)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug where the apply method created by `snippet` didn't add a `pickedCompletion` annotation to the transactions it created.
6
+
1
7
  ## 6.4.1 (2023-02-14)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1367,11 +1367,12 @@ interpreted as indicating a placeholder.
1367
1367
  */
1368
1368
  function snippet(template) {
1369
1369
  let snippet = Snippet.parse(template);
1370
- return (editor, _completion, from, to) => {
1370
+ return (editor, completion, from, to) => {
1371
1371
  let { text, ranges } = snippet.instantiate(editor.state, from);
1372
1372
  let spec = {
1373
1373
  changes: { from, to, insert: state.Text.of(text) },
1374
- scrollIntoView: true
1374
+ scrollIntoView: true,
1375
+ annotations: pickedCompletion.of(completion)
1375
1376
  };
1376
1377
  if (ranges.length)
1377
1378
  spec.selection = fieldSelection(ranges, 0);
package/dist/index.d.ts CHANGED
@@ -338,7 +338,7 @@ interpreted as indicating a placeholder.
338
338
  declare function snippet(template: string): (editor: {
339
339
  state: EditorState;
340
340
  dispatch: (tr: Transaction) => void;
341
- }, _completion: Completion, from: number, to: number) => void;
341
+ }, completion: Completion, from: number, to: number) => void;
342
342
  /**
343
343
  A command that clears the active snippet, if any.
344
344
  */
package/dist/index.js CHANGED
@@ -1363,11 +1363,12 @@ interpreted as indicating a placeholder.
1363
1363
  */
1364
1364
  function snippet(template) {
1365
1365
  let snippet = Snippet.parse(template);
1366
- return (editor, _completion, from, to) => {
1366
+ return (editor, completion, from, to) => {
1367
1367
  let { text, ranges } = snippet.instantiate(editor.state, from);
1368
1368
  let spec = {
1369
1369
  changes: { from, to, insert: Text.of(text) },
1370
- scrollIntoView: true
1370
+ scrollIntoView: true,
1371
+ annotations: pickedCompletion.of(completion)
1371
1372
  };
1372
1373
  if (ranges.length)
1373
1374
  spec.selection = fieldSelection(ranges, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/autocomplete",
3
- "version": "6.4.1",
3
+ "version": "6.4.2",
4
4
  "description": "Autocompletion for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",