@codemirror/autocomplete 6.10.1 → 6.11.0
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 +16 -0
- package/dist/index.cjs +5 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 6.11.0 (2023-11-09)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue that would prevent typing over closed brackets after starting a new line with enter.
|
|
6
|
+
|
|
7
|
+
### New features
|
|
8
|
+
|
|
9
|
+
Additional elements rendered in completion options with `addToOptions` are now given access to the editor view.
|
|
10
|
+
|
|
11
|
+
## 6.10.2 (2023-10-13)
|
|
12
|
+
|
|
13
|
+
### Bug fixes
|
|
14
|
+
|
|
15
|
+
Fix a bug that caused `updateSyncTime` to always delay the initial population of the tooltip.
|
|
16
|
+
|
|
1
17
|
## 6.10.1 (2023-10-11)
|
|
2
18
|
|
|
3
19
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -404,7 +404,7 @@ function optionContent(config) {
|
|
|
404
404
|
position: 20
|
|
405
405
|
});
|
|
406
406
|
content.push({
|
|
407
|
-
render(completion, _s, match) {
|
|
407
|
+
render(completion, _s, _v, match) {
|
|
408
408
|
let labelElt = document.createElement("span");
|
|
409
409
|
labelElt.className = "cm-completionLabel";
|
|
410
410
|
let label = completion.displayLabel || completion.label, off = 0;
|
|
@@ -653,7 +653,7 @@ class CompletionTooltip {
|
|
|
653
653
|
if (cls)
|
|
654
654
|
li.className = cls;
|
|
655
655
|
for (let source of this.optionContent) {
|
|
656
|
-
let node = source(completion, this.view.state, match);
|
|
656
|
+
let node = source(completion, this.view.state, this.view, match);
|
|
657
657
|
if (node)
|
|
658
658
|
li.appendChild(node);
|
|
659
659
|
}
|
|
@@ -1067,7 +1067,7 @@ const completionPlugin = view.ViewPlugin.fromClass(class {
|
|
|
1067
1067
|
if (this.debounceUpdate > -1)
|
|
1068
1068
|
clearTimeout(this.debounceUpdate);
|
|
1069
1069
|
this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
|
|
1070
|
-
? setTimeout(() => this.startUpdate(),
|
|
1070
|
+
? setTimeout(() => this.startUpdate(), 50) : -1;
|
|
1071
1071
|
if (this.composing != 0 /* CompositionState.None */)
|
|
1072
1072
|
for (let tr of update.transactions) {
|
|
1073
1073
|
if (getUserEvent(tr) == "input")
|
|
@@ -1663,10 +1663,8 @@ const bracketState = state.StateField.define({
|
|
|
1663
1663
|
create() { return state.RangeSet.empty; },
|
|
1664
1664
|
update(value, tr) {
|
|
1665
1665
|
if (tr.selection) {
|
|
1666
|
-
let
|
|
1667
|
-
|
|
1668
|
-
if (lineStart != tr.changes.mapPos(prevLineStart, -1))
|
|
1669
|
-
value = state.RangeSet.empty;
|
|
1666
|
+
let line = tr.state.doc.lineAt(tr.selection.main.head);
|
|
1667
|
+
value = value.update({ filter: from => from >= line.from && from <= line.to });
|
|
1670
1668
|
}
|
|
1671
1669
|
value = value.map(tr.changes);
|
|
1672
1670
|
for (let effect of tr.effects)
|
package/dist/index.d.cts
CHANGED
|
@@ -340,7 +340,7 @@ interface CompletionConfig {
|
|
|
340
340
|
80.
|
|
341
341
|
*/
|
|
342
342
|
addToOptions?: {
|
|
343
|
-
render: (completion: Completion, state: EditorState) => Node | null;
|
|
343
|
+
render: (completion: Completion, state: EditorState, view: EditorView) => Node | null;
|
|
344
344
|
position: number;
|
|
345
345
|
}[];
|
|
346
346
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -340,7 +340,7 @@ interface CompletionConfig {
|
|
|
340
340
|
80.
|
|
341
341
|
*/
|
|
342
342
|
addToOptions?: {
|
|
343
|
-
render: (completion: Completion, state: EditorState) => Node | null;
|
|
343
|
+
render: (completion: Completion, state: EditorState, view: EditorView) => Node | null;
|
|
344
344
|
position: number;
|
|
345
345
|
}[];
|
|
346
346
|
/**
|
package/dist/index.js
CHANGED
|
@@ -402,7 +402,7 @@ function optionContent(config) {
|
|
|
402
402
|
position: 20
|
|
403
403
|
});
|
|
404
404
|
content.push({
|
|
405
|
-
render(completion, _s, match) {
|
|
405
|
+
render(completion, _s, _v, match) {
|
|
406
406
|
let labelElt = document.createElement("span");
|
|
407
407
|
labelElt.className = "cm-completionLabel";
|
|
408
408
|
let label = completion.displayLabel || completion.label, off = 0;
|
|
@@ -651,7 +651,7 @@ class CompletionTooltip {
|
|
|
651
651
|
if (cls)
|
|
652
652
|
li.className = cls;
|
|
653
653
|
for (let source of this.optionContent) {
|
|
654
|
-
let node = source(completion, this.view.state, match);
|
|
654
|
+
let node = source(completion, this.view.state, this.view, match);
|
|
655
655
|
if (node)
|
|
656
656
|
li.appendChild(node);
|
|
657
657
|
}
|
|
@@ -1065,7 +1065,7 @@ const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
1065
1065
|
if (this.debounceUpdate > -1)
|
|
1066
1066
|
clearTimeout(this.debounceUpdate);
|
|
1067
1067
|
this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
|
|
1068
|
-
? setTimeout(() => this.startUpdate(),
|
|
1068
|
+
? setTimeout(() => this.startUpdate(), 50) : -1;
|
|
1069
1069
|
if (this.composing != 0 /* CompositionState.None */)
|
|
1070
1070
|
for (let tr of update.transactions) {
|
|
1071
1071
|
if (getUserEvent(tr) == "input")
|
|
@@ -1661,10 +1661,8 @@ const bracketState = /*@__PURE__*/StateField.define({
|
|
|
1661
1661
|
create() { return RangeSet.empty; },
|
|
1662
1662
|
update(value, tr) {
|
|
1663
1663
|
if (tr.selection) {
|
|
1664
|
-
let
|
|
1665
|
-
|
|
1666
|
-
if (lineStart != tr.changes.mapPos(prevLineStart, -1))
|
|
1667
|
-
value = RangeSet.empty;
|
|
1664
|
+
let line = tr.state.doc.lineAt(tr.selection.main.head);
|
|
1665
|
+
value = value.update({ filter: from => from >= line.from && from <= line.to });
|
|
1668
1666
|
}
|
|
1669
1667
|
value = value.map(tr.changes);
|
|
1670
1668
|
for (let effect of tr.effects)
|