@codemirror/autocomplete 6.18.3 → 6.18.4

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.18.4 (2024-12-17)
2
+
3
+ ### Bug fixes
4
+
5
+ Align the behavior of snippet completions with text completions in that they overwrite the selected text.
6
+
1
7
  ## 6.18.3 (2024-11-13)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1560,8 +1560,9 @@ function snippet(template) {
1560
1560
  let snippet = Snippet.parse(template);
1561
1561
  return (editor, completion, from, to) => {
1562
1562
  let { text, ranges } = snippet.instantiate(editor.state, from);
1563
+ let { main } = editor.state.selection;
1563
1564
  let spec = {
1564
- changes: { from, to, insert: state.Text.of(text) },
1565
+ changes: { from, to: to == main.from ? main.to : to, insert: state.Text.of(text) },
1565
1566
  scrollIntoView: true,
1566
1567
  annotations: completion ? [pickedCompletion.of(completion), state.Transaction.userEvent.of("input.complete")] : undefined
1567
1568
  };
package/dist/index.js CHANGED
@@ -1558,8 +1558,9 @@ function snippet(template) {
1558
1558
  let snippet = Snippet.parse(template);
1559
1559
  return (editor, completion, from, to) => {
1560
1560
  let { text, ranges } = snippet.instantiate(editor.state, from);
1561
+ let { main } = editor.state.selection;
1561
1562
  let spec = {
1562
- changes: { from, to, insert: Text.of(text) },
1563
+ changes: { from, to: to == main.from ? main.to : to, insert: Text.of(text) },
1563
1564
  scrollIntoView: true,
1564
1565
  annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of("input.complete")] : undefined
1565
1566
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/autocomplete",
3
- "version": "6.18.3",
3
+ "version": "6.18.4",
4
4
  "description": "Autocompletion for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",
@@ -31,12 +31,6 @@
31
31
  "@codemirror/view": "^6.17.0",
32
32
  "@lezer/common": "^1.0.0"
33
33
  },
34
- "peerDependencies": {
35
- "@codemirror/language": "^6.0.0",
36
- "@codemirror/state": "^6.0.0",
37
- "@codemirror/view": "^6.0.0",
38
- "@lezer/common": "^1.0.0"
39
- },
40
34
  "devDependencies": {
41
35
  "@codemirror/buildhelper": "^1.0.0"
42
36
  },