@codemirror/autocomplete 6.9.2 → 6.10.1
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 +12 -0
- package/dist/index.cjs +6 -4
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 6.10.1 (2023-10-11)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix a bug where picking a selection with the mouse could use the wrong completion if the completion list was updated after being opened.
|
|
6
|
+
|
|
7
|
+
## 6.10.0 (2023-10-11)
|
|
8
|
+
|
|
9
|
+
### New features
|
|
10
|
+
|
|
11
|
+
The new autocompletion configuration option `updateSyncTime` allows control over how long fast sources are held back waiting for slower completion sources.
|
|
12
|
+
|
|
1
13
|
## 6.9.2 (2023-10-06)
|
|
2
14
|
|
|
3
15
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -341,7 +341,8 @@ const completionConfig = state.Facet.define({
|
|
|
341
341
|
addToOptions: [],
|
|
342
342
|
positionInfo: defaultPositionInfo,
|
|
343
343
|
compareCompletions: (a, b) => a.label.localeCompare(b.label),
|
|
344
|
-
interactionDelay: 75
|
|
344
|
+
interactionDelay: 75,
|
|
345
|
+
updateSyncTime: 100
|
|
345
346
|
}, {
|
|
346
347
|
defaultKeymap: (a, b) => a && b,
|
|
347
348
|
closeOnBlur: (a, b) => a && b,
|
|
@@ -471,6 +472,7 @@ class CompletionTooltip {
|
|
|
471
472
|
this.dom.className = "cm-tooltip-autocomplete";
|
|
472
473
|
this.updateTooltipClass(view.state);
|
|
473
474
|
this.dom.addEventListener("mousedown", (e) => {
|
|
475
|
+
let { options } = view.state.field(stateField).open;
|
|
474
476
|
for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
|
|
475
477
|
if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
|
|
476
478
|
this.applyCompletion(view, options[+match[1]]);
|
|
@@ -1024,7 +1026,7 @@ class RunningQuery {
|
|
|
1024
1026
|
this.done = undefined;
|
|
1025
1027
|
}
|
|
1026
1028
|
}
|
|
1027
|
-
const
|
|
1029
|
+
const MaxUpdateCount = 50, MinAbortTime = 1000;
|
|
1028
1030
|
const completionPlugin = view.ViewPlugin.fromClass(class {
|
|
1029
1031
|
constructor(view) {
|
|
1030
1032
|
this.view = view;
|
|
@@ -1065,7 +1067,7 @@ const completionPlugin = view.ViewPlugin.fromClass(class {
|
|
|
1065
1067
|
if (this.debounceUpdate > -1)
|
|
1066
1068
|
clearTimeout(this.debounceUpdate);
|
|
1067
1069
|
this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
|
|
1068
|
-
? setTimeout(() => this.startUpdate(),
|
|
1070
|
+
? setTimeout(() => this.startUpdate(), update.state.facet(completionConfig).updateSyncTime) : -1;
|
|
1069
1071
|
if (this.composing != 0 /* CompositionState.None */)
|
|
1070
1072
|
for (let tr of update.transactions) {
|
|
1071
1073
|
if (getUserEvent(tr) == "input")
|
|
@@ -1101,7 +1103,7 @@ const completionPlugin = view.ViewPlugin.fromClass(class {
|
|
|
1101
1103
|
if (this.running.every(q => q.done !== undefined))
|
|
1102
1104
|
this.accept();
|
|
1103
1105
|
else if (this.debounceAccept < 0)
|
|
1104
|
-
this.debounceAccept = setTimeout(() => this.accept(),
|
|
1106
|
+
this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
|
|
1105
1107
|
}
|
|
1106
1108
|
// For each finished query in this.running, try to create a result
|
|
1107
1109
|
// or, if appropriate, restart the query.
|
package/dist/index.d.cts
CHANGED
|
@@ -369,6 +369,13 @@ interface CompletionConfig {
|
|
|
369
369
|
the tooltip. This option can be used to configure that delay.
|
|
370
370
|
*/
|
|
371
371
|
interactionDelay?: number;
|
|
372
|
+
/**
|
|
373
|
+
When there are multiple asynchronous completion sources, this
|
|
374
|
+
controls how long the extension waits for a slow source before
|
|
375
|
+
displaying results from faster sources. Defaults to 100
|
|
376
|
+
milliseconds.
|
|
377
|
+
*/
|
|
378
|
+
updateSyncTime?: number;
|
|
372
379
|
}
|
|
373
380
|
|
|
374
381
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -369,6 +369,13 @@ interface CompletionConfig {
|
|
|
369
369
|
the tooltip. This option can be used to configure that delay.
|
|
370
370
|
*/
|
|
371
371
|
interactionDelay?: number;
|
|
372
|
+
/**
|
|
373
|
+
When there are multiple asynchronous completion sources, this
|
|
374
|
+
controls how long the extension waits for a slow source before
|
|
375
|
+
displaying results from faster sources. Defaults to 100
|
|
376
|
+
milliseconds.
|
|
377
|
+
*/
|
|
378
|
+
updateSyncTime?: number;
|
|
372
379
|
}
|
|
373
380
|
|
|
374
381
|
/**
|
package/dist/index.js
CHANGED
|
@@ -339,7 +339,8 @@ const completionConfig = /*@__PURE__*/Facet.define({
|
|
|
339
339
|
addToOptions: [],
|
|
340
340
|
positionInfo: defaultPositionInfo,
|
|
341
341
|
compareCompletions: (a, b) => a.label.localeCompare(b.label),
|
|
342
|
-
interactionDelay: 75
|
|
342
|
+
interactionDelay: 75,
|
|
343
|
+
updateSyncTime: 100
|
|
343
344
|
}, {
|
|
344
345
|
defaultKeymap: (a, b) => a && b,
|
|
345
346
|
closeOnBlur: (a, b) => a && b,
|
|
@@ -469,6 +470,7 @@ class CompletionTooltip {
|
|
|
469
470
|
this.dom.className = "cm-tooltip-autocomplete";
|
|
470
471
|
this.updateTooltipClass(view.state);
|
|
471
472
|
this.dom.addEventListener("mousedown", (e) => {
|
|
473
|
+
let { options } = view.state.field(stateField).open;
|
|
472
474
|
for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
|
|
473
475
|
if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
|
|
474
476
|
this.applyCompletion(view, options[+match[1]]);
|
|
@@ -1022,7 +1024,7 @@ class RunningQuery {
|
|
|
1022
1024
|
this.done = undefined;
|
|
1023
1025
|
}
|
|
1024
1026
|
}
|
|
1025
|
-
const
|
|
1027
|
+
const MaxUpdateCount = 50, MinAbortTime = 1000;
|
|
1026
1028
|
const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
1027
1029
|
constructor(view) {
|
|
1028
1030
|
this.view = view;
|
|
@@ -1063,7 +1065,7 @@ const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
1063
1065
|
if (this.debounceUpdate > -1)
|
|
1064
1066
|
clearTimeout(this.debounceUpdate);
|
|
1065
1067
|
this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
|
|
1066
|
-
? setTimeout(() => this.startUpdate(),
|
|
1068
|
+
? setTimeout(() => this.startUpdate(), update.state.facet(completionConfig).updateSyncTime) : -1;
|
|
1067
1069
|
if (this.composing != 0 /* CompositionState.None */)
|
|
1068
1070
|
for (let tr of update.transactions) {
|
|
1069
1071
|
if (getUserEvent(tr) == "input")
|
|
@@ -1099,7 +1101,7 @@ const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
1099
1101
|
if (this.running.every(q => q.done !== undefined))
|
|
1100
1102
|
this.accept();
|
|
1101
1103
|
else if (this.debounceAccept < 0)
|
|
1102
|
-
this.debounceAccept = setTimeout(() => this.accept(),
|
|
1104
|
+
this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
|
|
1103
1105
|
}
|
|
1104
1106
|
// For each finished query in this.running, try to create a result
|
|
1105
1107
|
// or, if appropriate, restart the query.
|