@codemirror/autocomplete 6.8.0 → 6.8.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 +6 -0
- package/dist/index.cjs +6 -7
- package/dist/index.js +6 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -731,9 +731,10 @@ function sortOptions(active, state) {
|
|
|
731
731
|
let result = [], prev = null;
|
|
732
732
|
let compare = state.facet(completionConfig).compareCompletions;
|
|
733
733
|
for (let opt of options.sort((a, b) => (b.score - a.score) || compare(a.completion, b.completion))) {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
prev.
|
|
734
|
+
let cur = opt.completion;
|
|
735
|
+
if (!prev || prev.label != cur.label || prev.detail != cur.detail ||
|
|
736
|
+
(prev.type != null && cur.type != null && prev.type != cur.type) ||
|
|
737
|
+
prev.apply != cur.apply || prev.boost != cur.boost)
|
|
737
738
|
result.push(opt);
|
|
738
739
|
else if (score(opt.completion) > score(prev))
|
|
739
740
|
result[result.length - 1] = opt;
|
|
@@ -977,12 +978,10 @@ Accept the current completion.
|
|
|
977
978
|
*/
|
|
978
979
|
const acceptCompletion = (view) => {
|
|
979
980
|
let cState = view.state.field(completionState, false);
|
|
980
|
-
if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 ||
|
|
981
|
+
if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 || cState.open.disabled ||
|
|
981
982
|
Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay)
|
|
982
983
|
return false;
|
|
983
|
-
|
|
984
|
-
return applyCompletion(view, cState.open.options[cState.open.selected]);
|
|
985
|
-
return true;
|
|
984
|
+
return applyCompletion(view, cState.open.options[cState.open.selected]);
|
|
986
985
|
};
|
|
987
986
|
/**
|
|
988
987
|
Explicitly start autocompletion.
|
package/dist/index.js
CHANGED
|
@@ -727,9 +727,10 @@ function sortOptions(active, state) {
|
|
|
727
727
|
let result = [], prev = null;
|
|
728
728
|
let compare = state.facet(completionConfig).compareCompletions;
|
|
729
729
|
for (let opt of options.sort((a, b) => (b.score - a.score) || compare(a.completion, b.completion))) {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
prev.
|
|
730
|
+
let cur = opt.completion;
|
|
731
|
+
if (!prev || prev.label != cur.label || prev.detail != cur.detail ||
|
|
732
|
+
(prev.type != null && cur.type != null && prev.type != cur.type) ||
|
|
733
|
+
prev.apply != cur.apply || prev.boost != cur.boost)
|
|
733
734
|
result.push(opt);
|
|
734
735
|
else if (score(opt.completion) > score(prev))
|
|
735
736
|
result[result.length - 1] = opt;
|
|
@@ -973,12 +974,10 @@ Accept the current completion.
|
|
|
973
974
|
*/
|
|
974
975
|
const acceptCompletion = (view) => {
|
|
975
976
|
let cState = view.state.field(completionState, false);
|
|
976
|
-
if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 ||
|
|
977
|
+
if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 || cState.open.disabled ||
|
|
977
978
|
Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay)
|
|
978
979
|
return false;
|
|
979
|
-
|
|
980
|
-
return applyCompletion(view, cState.open.options[cState.open.selected]);
|
|
981
|
-
return true;
|
|
980
|
+
return applyCompletion(view, cState.open.options[cState.open.selected]);
|
|
982
981
|
};
|
|
983
982
|
/**
|
|
984
983
|
Explicitly start autocompletion.
|