@codemirror/autocomplete 6.19.1 → 6.20.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.20.0 (2025-11-20)
2
+
3
+ ### New features
4
+
5
+ Completions now support a `sortText` property to influence sort order.
6
+
1
7
  ## 6.19.1 (2025-10-23)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -391,7 +391,7 @@ const completionConfig = state.Facet.define({
391
391
  addToOptions: [],
392
392
  positionInfo: defaultPositionInfo,
393
393
  filterStrict: false,
394
- compareCompletions: (a, b) => a.label.localeCompare(b.label),
394
+ compareCompletions: (a, b) => (a.sortText || a.label).localeCompare(b.sortText || b.label),
395
395
  interactionDelay: 75,
396
396
  updateSyncTime: 100
397
397
  }, {
package/dist/index.d.cts CHANGED
@@ -21,6 +21,11 @@ interface Completion {
21
21
  */
22
22
  displayLabel?: string;
23
23
  /**
24
+ Overrides the text that is used to sort completions. Will
25
+ default to `label` if not given.
26
+ */
27
+ sortText?: string;
28
+ /**
24
29
  An optional short piece of information to show (with a different
25
30
  style) after the label.
26
31
  */
package/dist/index.d.ts CHANGED
@@ -21,6 +21,11 @@ interface Completion {
21
21
  */
22
22
  displayLabel?: string;
23
23
  /**
24
+ Overrides the text that is used to sort completions. Will
25
+ default to `label` if not given.
26
+ */
27
+ sortText?: string;
28
+ /**
24
29
  An optional short piece of information to show (with a different
25
30
  style) after the label.
26
31
  */
package/dist/index.js CHANGED
@@ -389,7 +389,7 @@ const completionConfig = /*@__PURE__*/Facet.define({
389
389
  addToOptions: [],
390
390
  positionInfo: defaultPositionInfo,
391
391
  filterStrict: false,
392
- compareCompletions: (a, b) => a.label.localeCompare(b.label),
392
+ compareCompletions: (a, b) => (a.sortText || a.label).localeCompare(b.sortText || b.label),
393
393
  interactionDelay: 75,
394
394
  updateSyncTime: 100
395
395
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/autocomplete",
3
- "version": "6.19.1",
3
+ "version": "6.20.0",
4
4
  "description": "Autocompletion for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",