@codemirror/autocomplete 6.9.2 → 6.10.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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.10.0 (2023-10-11)
2
+
3
+ ### New features
4
+
5
+ The new autocompletion configuration option `updateSyncTime` allows control over how long fast sources are held back waiting for slower completion sources.
6
+
1
7
  ## 6.9.2 (2023-10-06)
2
8
 
3
9
  ### 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,
@@ -1024,7 +1025,7 @@ class RunningQuery {
1024
1025
  this.done = undefined;
1025
1026
  }
1026
1027
  }
1027
- const DebounceTime = 50, MaxUpdateCount = 50, MinAbortTime = 1000;
1028
+ const MaxUpdateCount = 50, MinAbortTime = 1000;
1028
1029
  const completionPlugin = view.ViewPlugin.fromClass(class {
1029
1030
  constructor(view) {
1030
1031
  this.view = view;
@@ -1065,7 +1066,7 @@ const completionPlugin = view.ViewPlugin.fromClass(class {
1065
1066
  if (this.debounceUpdate > -1)
1066
1067
  clearTimeout(this.debounceUpdate);
1067
1068
  this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
1068
- ? setTimeout(() => this.startUpdate(), DebounceTime) : -1;
1069
+ ? setTimeout(() => this.startUpdate(), update.state.facet(completionConfig).updateSyncTime) : -1;
1069
1070
  if (this.composing != 0 /* CompositionState.None */)
1070
1071
  for (let tr of update.transactions) {
1071
1072
  if (getUserEvent(tr) == "input")
@@ -1101,7 +1102,7 @@ const completionPlugin = view.ViewPlugin.fromClass(class {
1101
1102
  if (this.running.every(q => q.done !== undefined))
1102
1103
  this.accept();
1103
1104
  else if (this.debounceAccept < 0)
1104
- this.debounceAccept = setTimeout(() => this.accept(), DebounceTime);
1105
+ this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
1105
1106
  }
1106
1107
  // For each finished query in this.running, try to create a result
1107
1108
  // 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,
@@ -1022,7 +1023,7 @@ class RunningQuery {
1022
1023
  this.done = undefined;
1023
1024
  }
1024
1025
  }
1025
- const DebounceTime = 50, MaxUpdateCount = 50, MinAbortTime = 1000;
1026
+ const MaxUpdateCount = 50, MinAbortTime = 1000;
1026
1027
  const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
1027
1028
  constructor(view) {
1028
1029
  this.view = view;
@@ -1063,7 +1064,7 @@ const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
1063
1064
  if (this.debounceUpdate > -1)
1064
1065
  clearTimeout(this.debounceUpdate);
1065
1066
  this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
1066
- ? setTimeout(() => this.startUpdate(), DebounceTime) : -1;
1067
+ ? setTimeout(() => this.startUpdate(), update.state.facet(completionConfig).updateSyncTime) : -1;
1067
1068
  if (this.composing != 0 /* CompositionState.None */)
1068
1069
  for (let tr of update.transactions) {
1069
1070
  if (getUserEvent(tr) == "input")
@@ -1099,7 +1100,7 @@ const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
1099
1100
  if (this.running.every(q => q.done !== undefined))
1100
1101
  this.accept();
1101
1102
  else if (this.debounceAccept < 0)
1102
- this.debounceAccept = setTimeout(() => this.accept(), DebounceTime);
1103
+ this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
1103
1104
  }
1104
1105
  // For each finished query in this.running, try to create a result
1105
1106
  // or, if appropriate, restart the query.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/autocomplete",
3
- "version": "6.9.2",
3
+ "version": "6.10.0",
4
4
  "description": "Autocompletion for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",