@codemirror/autocomplete 6.10.0 → 6.10.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,15 @@
1
+ ## 6.10.2 (2023-10-13)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug that caused `updateSyncTime` to always delay the initial population of the tooltip.
6
+
7
+ ## 6.10.1 (2023-10-11)
8
+
9
+ ### Bug fixes
10
+
11
+ Fix a bug where picking a selection with the mouse could use the wrong completion if the completion list was updated after being opened.
12
+
1
13
  ## 6.10.0 (2023-10-11)
2
14
 
3
15
  ### New features
package/dist/index.cjs CHANGED
@@ -472,6 +472,7 @@ class CompletionTooltip {
472
472
  this.dom.className = "cm-tooltip-autocomplete";
473
473
  this.updateTooltipClass(view.state);
474
474
  this.dom.addEventListener("mousedown", (e) => {
475
+ let { options } = view.state.field(stateField).open;
475
476
  for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
476
477
  if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
477
478
  this.applyCompletion(view, options[+match[1]]);
@@ -1066,7 +1067,7 @@ const completionPlugin = view.ViewPlugin.fromClass(class {
1066
1067
  if (this.debounceUpdate > -1)
1067
1068
  clearTimeout(this.debounceUpdate);
1068
1069
  this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
1069
- ? setTimeout(() => this.startUpdate(), update.state.facet(completionConfig).updateSyncTime) : -1;
1070
+ ? setTimeout(() => this.startUpdate(), 50) : -1;
1070
1071
  if (this.composing != 0 /* CompositionState.None */)
1071
1072
  for (let tr of update.transactions) {
1072
1073
  if (getUserEvent(tr) == "input")
package/dist/index.js CHANGED
@@ -470,6 +470,7 @@ class CompletionTooltip {
470
470
  this.dom.className = "cm-tooltip-autocomplete";
471
471
  this.updateTooltipClass(view.state);
472
472
  this.dom.addEventListener("mousedown", (e) => {
473
+ let { options } = view.state.field(stateField).open;
473
474
  for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
474
475
  if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
475
476
  this.applyCompletion(view, options[+match[1]]);
@@ -1064,7 +1065,7 @@ const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
1064
1065
  if (this.debounceUpdate > -1)
1065
1066
  clearTimeout(this.debounceUpdate);
1066
1067
  this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
1067
- ? setTimeout(() => this.startUpdate(), update.state.facet(completionConfig).updateSyncTime) : -1;
1068
+ ? setTimeout(() => this.startUpdate(), 50) : -1;
1068
1069
  if (this.composing != 0 /* CompositionState.None */)
1069
1070
  for (let tr of update.transactions) {
1070
1071
  if (getUserEvent(tr) == "input")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/autocomplete",
3
- "version": "6.10.0",
3
+ "version": "6.10.2",
4
4
  "description": "Autocompletion for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",