@codemirror/autocomplete 6.18.6 → 6.19.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 +14 -0
- package/dist/index.cjs +45 -20
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +45 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 6.19.0 (2025-09-26)
|
|
2
|
+
|
|
3
|
+
### New features
|
|
4
|
+
|
|
5
|
+
Completion sections may now set their rank to `dynamic` to indicate their order should be determined by the matching score of their best-matching option.
|
|
6
|
+
|
|
7
|
+
## 6.18.7 (2025-09-02)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Add a binding for Alt-i to trigger `startCompletion`, following VS Code's current default bindings.
|
|
12
|
+
|
|
13
|
+
Improve handling of nested fields in snippets.
|
|
14
|
+
|
|
1
15
|
## 6.18.6 (2025-02-12)
|
|
2
16
|
|
|
3
17
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -189,16 +189,20 @@ selection range that has the same text in front of it.
|
|
|
189
189
|
*/
|
|
190
190
|
function insertCompletionText(state$1, text, from, to) {
|
|
191
191
|
let { main } = state$1.selection, fromOff = from - main.from, toOff = to - main.from;
|
|
192
|
-
return
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
192
|
+
return {
|
|
193
|
+
...state$1.changeByRange(range => {
|
|
194
|
+
if (range != main && from != to &&
|
|
195
|
+
state$1.sliceDoc(range.from + fromOff, range.from + toOff) != state$1.sliceDoc(from, to))
|
|
196
|
+
return { range };
|
|
197
|
+
let lines = state$1.toText(text);
|
|
198
|
+
return {
|
|
199
|
+
changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: lines },
|
|
200
|
+
range: state.EditorSelection.cursor(range.from + fromOff + lines.length)
|
|
201
|
+
};
|
|
202
|
+
}),
|
|
203
|
+
scrollIntoView: true,
|
|
204
|
+
userEvent: "input.complete"
|
|
205
|
+
};
|
|
202
206
|
}
|
|
203
207
|
const SourceCache = new WeakMap();
|
|
204
208
|
function asSource(source) {
|
|
@@ -750,7 +754,7 @@ function score(option) {
|
|
|
750
754
|
}
|
|
751
755
|
function sortOptions(active, state) {
|
|
752
756
|
let options = [];
|
|
753
|
-
let sections = null;
|
|
757
|
+
let sections = null, dynamicSectionScore = null;
|
|
754
758
|
let addOption = (option) => {
|
|
755
759
|
options.push(option);
|
|
756
760
|
let { section } = option.completion;
|
|
@@ -777,13 +781,24 @@ function sortOptions(active, state) {
|
|
|
777
781
|
for (let option of a.result.options)
|
|
778
782
|
if (match = matcher.match(option.label)) {
|
|
779
783
|
let matched = !option.displayLabel ? match.matched : getMatch ? getMatch(option, match.matched) : [];
|
|
780
|
-
|
|
784
|
+
let score = match.score + (option.boost || 0);
|
|
785
|
+
addOption(new Option(option, a.source, matched, score));
|
|
786
|
+
if (typeof option.section == "object" && option.section.rank === "dynamic") {
|
|
787
|
+
let { name } = option.section;
|
|
788
|
+
if (!dynamicSectionScore)
|
|
789
|
+
dynamicSectionScore = Object.create(null);
|
|
790
|
+
dynamicSectionScore[name] = Math.max(score, dynamicSectionScore[name] || -1e9);
|
|
791
|
+
}
|
|
781
792
|
}
|
|
782
793
|
}
|
|
783
794
|
}
|
|
784
795
|
if (sections) {
|
|
785
796
|
let sectionOrder = Object.create(null), pos = 0;
|
|
786
|
-
let cmp = (a, b) => {
|
|
797
|
+
let cmp = (a, b) => {
|
|
798
|
+
return (a.rank === "dynamic" && b.rank === "dynamic" ? dynamicSectionScore[b.name] - dynamicSectionScore[a.name] : 0) ||
|
|
799
|
+
(typeof a.rank == "number" ? a.rank : 1e9) - (typeof b.rank == "number" ? b.rank : 1e9) ||
|
|
800
|
+
(a.name < b.name ? -1 : 1);
|
|
801
|
+
};
|
|
787
802
|
for (let s of sections.sort(cmp)) {
|
|
788
803
|
pos -= 1e5;
|
|
789
804
|
sectionOrder[s.name] = pos;
|
|
@@ -843,7 +858,7 @@ class CompletionDialog {
|
|
|
843
858
|
}, prev ? prev.timestamp : Date.now(), selected, false);
|
|
844
859
|
}
|
|
845
860
|
map(changes) {
|
|
846
|
-
return new CompletionDialog(this.options, this.attrs,
|
|
861
|
+
return new CompletionDialog(this.options, this.attrs, { ...this.tooltip, pos: changes.mapPos(this.tooltip.pos) }, this.timestamp, this.selected, this.disabled);
|
|
847
862
|
}
|
|
848
863
|
setDisabled() {
|
|
849
864
|
return new CompletionDialog(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, true);
|
|
@@ -1028,7 +1043,10 @@ function applyCompletion(view, option) {
|
|
|
1028
1043
|
if (!(result instanceof ActiveResult))
|
|
1029
1044
|
return false;
|
|
1030
1045
|
if (typeof apply == "string")
|
|
1031
|
-
view.dispatch(
|
|
1046
|
+
view.dispatch({
|
|
1047
|
+
...insertCompletionText(view.state, apply, result.from, result.to),
|
|
1048
|
+
annotations: pickedCompletion.of(option.completion)
|
|
1049
|
+
});
|
|
1032
1050
|
else
|
|
1033
1051
|
apply(view, option.completion, result.from, result.to);
|
|
1034
1052
|
return true;
|
|
@@ -1445,7 +1463,7 @@ class Snippet {
|
|
|
1445
1463
|
let fields = [];
|
|
1446
1464
|
let lines = [], positions = [], m;
|
|
1447
1465
|
for (let line of template.split(/\r\n?|\n/)) {
|
|
1448
|
-
while (m = /[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(line)) {
|
|
1466
|
+
while (m = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(line)) {
|
|
1449
1467
|
let seq = m[1] ? +m[1] : null, rawName = m[2] || m[3] || "", found = -1;
|
|
1450
1468
|
let name = rawName.replace(/\\[{}]/g, m => m[1]);
|
|
1451
1469
|
for (let i = 0; i < fields.length; i++) {
|
|
@@ -1462,6 +1480,12 @@ class Snippet {
|
|
|
1462
1480
|
if (pos.field >= found)
|
|
1463
1481
|
pos.field++;
|
|
1464
1482
|
}
|
|
1483
|
+
for (let pos of positions)
|
|
1484
|
+
if (pos.line == lines.length && pos.from > m.index) {
|
|
1485
|
+
let snip = m[2] ? 3 + (m[1] || "").length : 2;
|
|
1486
|
+
pos.from -= snip;
|
|
1487
|
+
pos.to -= snip;
|
|
1488
|
+
}
|
|
1465
1489
|
positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));
|
|
1466
1490
|
line = line.slice(0, m.index) + rawName + line.slice(m.index + m[0].length);
|
|
1467
1491
|
}
|
|
@@ -1491,7 +1515,7 @@ class ActiveSnippet {
|
|
|
1491
1515
|
constructor(ranges, active) {
|
|
1492
1516
|
this.ranges = ranges;
|
|
1493
1517
|
this.active = active;
|
|
1494
|
-
this.deco = view.Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)));
|
|
1518
|
+
this.deco = view.Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
|
|
1495
1519
|
}
|
|
1496
1520
|
map(changes) {
|
|
1497
1521
|
let ranges = [];
|
|
@@ -1651,7 +1675,7 @@ properties from `completion`, plus an `apply` function that
|
|
|
1651
1675
|
applies the snippet.
|
|
1652
1676
|
*/
|
|
1653
1677
|
function snippetCompletion(template, completion) {
|
|
1654
|
-
return
|
|
1678
|
+
return { ...completion, apply: snippet(template) };
|
|
1655
1679
|
}
|
|
1656
1680
|
const snippetPointerHandler = view.EditorView.domEventHandlers({
|
|
1657
1681
|
mousedown(event, view) {
|
|
@@ -2009,17 +2033,18 @@ function autocompletion(config = {}) {
|
|
|
2009
2033
|
/**
|
|
2010
2034
|
Basic keybindings for autocompletion.
|
|
2011
2035
|
|
|
2012
|
-
- Ctrl-Space (and Alt-\` on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
2036
|
+
- Ctrl-Space (and Alt-\` or Alt-i on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
2013
2037
|
- Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)
|
|
2014
2038
|
- ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`
|
|
2015
2039
|
- ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`
|
|
2016
2040
|
- PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
|
|
2017
|
-
-
|
|
2041
|
+
- PageUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false, "page")`
|
|
2018
2042
|
- Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)
|
|
2019
2043
|
*/
|
|
2020
2044
|
const completionKeymap = [
|
|
2021
2045
|
{ key: "Ctrl-Space", run: startCompletion },
|
|
2022
2046
|
{ mac: "Alt-`", run: startCompletion },
|
|
2047
|
+
{ mac: "Alt-i", run: startCompletion },
|
|
2023
2048
|
{ key: "Escape", run: closeCompletion },
|
|
2024
2049
|
{ key: "ArrowDown", run: moveCompletionSelection(true) },
|
|
2025
2050
|
{ key: "ArrowUp", run: moveCompletionSelection(false) },
|
package/dist/index.d.cts
CHANGED
|
@@ -106,8 +106,12 @@ interface CompletionSection {
|
|
|
106
106
|
By default, sections are ordered alphabetically by name. To
|
|
107
107
|
specify an explicit order, `rank` can be used. Sections with a
|
|
108
108
|
lower rank will be shown above sections with a higher rank.
|
|
109
|
+
|
|
110
|
+
When set to `"dynamic"`, the section's position compared to
|
|
111
|
+
other dynamic sections depends on the matching score of the
|
|
112
|
+
best-matching option in the sections.
|
|
109
113
|
*/
|
|
110
|
-
rank?: number;
|
|
114
|
+
rank?: number | "dynamic";
|
|
111
115
|
}
|
|
112
116
|
/**
|
|
113
117
|
An instance of this is passed to completion source functions.
|
|
@@ -601,12 +605,12 @@ declare function autocompletion(config?: CompletionConfig): Extension;
|
|
|
601
605
|
/**
|
|
602
606
|
Basic keybindings for autocompletion.
|
|
603
607
|
|
|
604
|
-
- Ctrl-Space (and Alt-\` on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
608
|
+
- Ctrl-Space (and Alt-\` or Alt-i on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
605
609
|
- Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)
|
|
606
610
|
- ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`
|
|
607
611
|
- ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`
|
|
608
612
|
- PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
|
|
609
|
-
-
|
|
613
|
+
- PageUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false, "page")`
|
|
610
614
|
- Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)
|
|
611
615
|
*/
|
|
612
616
|
declare const completionKeymap: readonly KeyBinding[];
|
package/dist/index.d.ts
CHANGED
|
@@ -106,8 +106,12 @@ interface CompletionSection {
|
|
|
106
106
|
By default, sections are ordered alphabetically by name. To
|
|
107
107
|
specify an explicit order, `rank` can be used. Sections with a
|
|
108
108
|
lower rank will be shown above sections with a higher rank.
|
|
109
|
+
|
|
110
|
+
When set to `"dynamic"`, the section's position compared to
|
|
111
|
+
other dynamic sections depends on the matching score of the
|
|
112
|
+
best-matching option in the sections.
|
|
109
113
|
*/
|
|
110
|
-
rank?: number;
|
|
114
|
+
rank?: number | "dynamic";
|
|
111
115
|
}
|
|
112
116
|
/**
|
|
113
117
|
An instance of this is passed to completion source functions.
|
|
@@ -601,12 +605,12 @@ declare function autocompletion(config?: CompletionConfig): Extension;
|
|
|
601
605
|
/**
|
|
602
606
|
Basic keybindings for autocompletion.
|
|
603
607
|
|
|
604
|
-
- Ctrl-Space (and Alt-\` on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
608
|
+
- Ctrl-Space (and Alt-\` or Alt-i on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
605
609
|
- Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)
|
|
606
610
|
- ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`
|
|
607
611
|
- ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`
|
|
608
612
|
- PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
|
|
609
|
-
-
|
|
613
|
+
- PageUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false, "page")`
|
|
610
614
|
- Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)
|
|
611
615
|
*/
|
|
612
616
|
declare const completionKeymap: readonly KeyBinding[];
|
package/dist/index.js
CHANGED
|
@@ -187,16 +187,20 @@ selection range that has the same text in front of it.
|
|
|
187
187
|
*/
|
|
188
188
|
function insertCompletionText(state, text, from, to) {
|
|
189
189
|
let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from;
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
190
|
+
return {
|
|
191
|
+
...state.changeByRange(range => {
|
|
192
|
+
if (range != main && from != to &&
|
|
193
|
+
state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to))
|
|
194
|
+
return { range };
|
|
195
|
+
let lines = state.toText(text);
|
|
196
|
+
return {
|
|
197
|
+
changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: lines },
|
|
198
|
+
range: EditorSelection.cursor(range.from + fromOff + lines.length)
|
|
199
|
+
};
|
|
200
|
+
}),
|
|
201
|
+
scrollIntoView: true,
|
|
202
|
+
userEvent: "input.complete"
|
|
203
|
+
};
|
|
200
204
|
}
|
|
201
205
|
const SourceCache = /*@__PURE__*/new WeakMap();
|
|
202
206
|
function asSource(source) {
|
|
@@ -748,7 +752,7 @@ function score(option) {
|
|
|
748
752
|
}
|
|
749
753
|
function sortOptions(active, state) {
|
|
750
754
|
let options = [];
|
|
751
|
-
let sections = null;
|
|
755
|
+
let sections = null, dynamicSectionScore = null;
|
|
752
756
|
let addOption = (option) => {
|
|
753
757
|
options.push(option);
|
|
754
758
|
let { section } = option.completion;
|
|
@@ -775,13 +779,24 @@ function sortOptions(active, state) {
|
|
|
775
779
|
for (let option of a.result.options)
|
|
776
780
|
if (match = matcher.match(option.label)) {
|
|
777
781
|
let matched = !option.displayLabel ? match.matched : getMatch ? getMatch(option, match.matched) : [];
|
|
778
|
-
|
|
782
|
+
let score = match.score + (option.boost || 0);
|
|
783
|
+
addOption(new Option(option, a.source, matched, score));
|
|
784
|
+
if (typeof option.section == "object" && option.section.rank === "dynamic") {
|
|
785
|
+
let { name } = option.section;
|
|
786
|
+
if (!dynamicSectionScore)
|
|
787
|
+
dynamicSectionScore = Object.create(null);
|
|
788
|
+
dynamicSectionScore[name] = Math.max(score, dynamicSectionScore[name] || -1e9);
|
|
789
|
+
}
|
|
779
790
|
}
|
|
780
791
|
}
|
|
781
792
|
}
|
|
782
793
|
if (sections) {
|
|
783
794
|
let sectionOrder = Object.create(null), pos = 0;
|
|
784
|
-
let cmp = (a, b) => {
|
|
795
|
+
let cmp = (a, b) => {
|
|
796
|
+
return (a.rank === "dynamic" && b.rank === "dynamic" ? dynamicSectionScore[b.name] - dynamicSectionScore[a.name] : 0) ||
|
|
797
|
+
(typeof a.rank == "number" ? a.rank : 1e9) - (typeof b.rank == "number" ? b.rank : 1e9) ||
|
|
798
|
+
(a.name < b.name ? -1 : 1);
|
|
799
|
+
};
|
|
785
800
|
for (let s of sections.sort(cmp)) {
|
|
786
801
|
pos -= 1e5;
|
|
787
802
|
sectionOrder[s.name] = pos;
|
|
@@ -841,7 +856,7 @@ class CompletionDialog {
|
|
|
841
856
|
}, prev ? prev.timestamp : Date.now(), selected, false);
|
|
842
857
|
}
|
|
843
858
|
map(changes) {
|
|
844
|
-
return new CompletionDialog(this.options, this.attrs,
|
|
859
|
+
return new CompletionDialog(this.options, this.attrs, { ...this.tooltip, pos: changes.mapPos(this.tooltip.pos) }, this.timestamp, this.selected, this.disabled);
|
|
845
860
|
}
|
|
846
861
|
setDisabled() {
|
|
847
862
|
return new CompletionDialog(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, true);
|
|
@@ -1026,7 +1041,10 @@ function applyCompletion(view, option) {
|
|
|
1026
1041
|
if (!(result instanceof ActiveResult))
|
|
1027
1042
|
return false;
|
|
1028
1043
|
if (typeof apply == "string")
|
|
1029
|
-
view.dispatch(
|
|
1044
|
+
view.dispatch({
|
|
1045
|
+
...insertCompletionText(view.state, apply, result.from, result.to),
|
|
1046
|
+
annotations: pickedCompletion.of(option.completion)
|
|
1047
|
+
});
|
|
1030
1048
|
else
|
|
1031
1049
|
apply(view, option.completion, result.from, result.to);
|
|
1032
1050
|
return true;
|
|
@@ -1443,7 +1461,7 @@ class Snippet {
|
|
|
1443
1461
|
let fields = [];
|
|
1444
1462
|
let lines = [], positions = [], m;
|
|
1445
1463
|
for (let line of template.split(/\r\n?|\n/)) {
|
|
1446
|
-
while (m = /[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(line)) {
|
|
1464
|
+
while (m = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(line)) {
|
|
1447
1465
|
let seq = m[1] ? +m[1] : null, rawName = m[2] || m[3] || "", found = -1;
|
|
1448
1466
|
let name = rawName.replace(/\\[{}]/g, m => m[1]);
|
|
1449
1467
|
for (let i = 0; i < fields.length; i++) {
|
|
@@ -1460,6 +1478,12 @@ class Snippet {
|
|
|
1460
1478
|
if (pos.field >= found)
|
|
1461
1479
|
pos.field++;
|
|
1462
1480
|
}
|
|
1481
|
+
for (let pos of positions)
|
|
1482
|
+
if (pos.line == lines.length && pos.from > m.index) {
|
|
1483
|
+
let snip = m[2] ? 3 + (m[1] || "").length : 2;
|
|
1484
|
+
pos.from -= snip;
|
|
1485
|
+
pos.to -= snip;
|
|
1486
|
+
}
|
|
1463
1487
|
positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));
|
|
1464
1488
|
line = line.slice(0, m.index) + rawName + line.slice(m.index + m[0].length);
|
|
1465
1489
|
}
|
|
@@ -1489,7 +1513,7 @@ class ActiveSnippet {
|
|
|
1489
1513
|
constructor(ranges, active) {
|
|
1490
1514
|
this.ranges = ranges;
|
|
1491
1515
|
this.active = active;
|
|
1492
|
-
this.deco = Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)));
|
|
1516
|
+
this.deco = Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
|
|
1493
1517
|
}
|
|
1494
1518
|
map(changes) {
|
|
1495
1519
|
let ranges = [];
|
|
@@ -1649,7 +1673,7 @@ properties from `completion`, plus an `apply` function that
|
|
|
1649
1673
|
applies the snippet.
|
|
1650
1674
|
*/
|
|
1651
1675
|
function snippetCompletion(template, completion) {
|
|
1652
|
-
return
|
|
1676
|
+
return { ...completion, apply: snippet(template) };
|
|
1653
1677
|
}
|
|
1654
1678
|
const snippetPointerHandler = /*@__PURE__*/EditorView.domEventHandlers({
|
|
1655
1679
|
mousedown(event, view) {
|
|
@@ -2007,17 +2031,18 @@ function autocompletion(config = {}) {
|
|
|
2007
2031
|
/**
|
|
2008
2032
|
Basic keybindings for autocompletion.
|
|
2009
2033
|
|
|
2010
|
-
- Ctrl-Space (and Alt-\` on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
2034
|
+
- Ctrl-Space (and Alt-\` or Alt-i on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
2011
2035
|
- Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)
|
|
2012
2036
|
- ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`
|
|
2013
2037
|
- ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`
|
|
2014
2038
|
- PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
|
|
2015
|
-
-
|
|
2039
|
+
- PageUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false, "page")`
|
|
2016
2040
|
- Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)
|
|
2017
2041
|
*/
|
|
2018
2042
|
const completionKeymap = [
|
|
2019
2043
|
{ key: "Ctrl-Space", run: startCompletion },
|
|
2020
2044
|
{ mac: "Alt-`", run: startCompletion },
|
|
2045
|
+
{ mac: "Alt-i", run: startCompletion },
|
|
2021
2046
|
{ key: "Escape", run: closeCompletion },
|
|
2022
2047
|
{ key: "ArrowDown", run: /*@__PURE__*/moveCompletionSelection(true) },
|
|
2023
2048
|
{ key: "ArrowUp", run: /*@__PURE__*/moveCompletionSelection(false) },
|