@codemirror/autocomplete 6.3.1 → 6.3.3
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 +9 -7
- package/dist/index.d.ts +3 -4
- package/dist/index.js +9 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 6.3.3 (2022-11-18)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Set an explicit `box-sizing` style on completion icons so CSS resets don't mess them up.
|
|
6
|
+
|
|
7
|
+
Allow closing braces in templates to be escaped with a backslash.
|
|
8
|
+
|
|
9
|
+
## 6.3.2 (2022-11-15)
|
|
10
|
+
|
|
11
|
+
### Bug fixes
|
|
12
|
+
|
|
13
|
+
Fix a regression that could cause the completion dialog to stick around when it should be hidden.
|
|
14
|
+
|
|
1
15
|
## 6.3.1 (2022-11-14)
|
|
2
16
|
|
|
3
17
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -712,6 +712,8 @@ class CompletionState {
|
|
|
712
712
|
if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||
|
|
713
713
|
!sameResults(active, this.active))
|
|
714
714
|
open = CompletionDialog.build(active, state, this.id, this.open, conf);
|
|
715
|
+
else if (open && open.disabled && !active.some(a => a.state == 1 /* State.Pending */))
|
|
716
|
+
open = null;
|
|
715
717
|
else if (open && tr.docChanged)
|
|
716
718
|
open = open.map(tr.changes);
|
|
717
719
|
if (!open && active.every(a => a.state != 1 /* State.Pending */) && active.some(a => a.hasResult()))
|
|
@@ -1134,7 +1136,8 @@ const baseTheme = view.EditorView.baseTheme({
|
|
|
1134
1136
|
display: "inline-block",
|
|
1135
1137
|
textAlign: "center",
|
|
1136
1138
|
paddingRight: ".6em",
|
|
1137
|
-
opacity: "0.6"
|
|
1139
|
+
opacity: "0.6",
|
|
1140
|
+
boxSizing: "content-box"
|
|
1138
1141
|
},
|
|
1139
1142
|
".cm-completionIcon-function, .cm-completionIcon-method": {
|
|
1140
1143
|
"&:after": { content: "'ƒ'" }
|
|
@@ -1236,8 +1239,8 @@ class Snippet {
|
|
|
1236
1239
|
positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));
|
|
1237
1240
|
line = line.slice(0, m.index) + name + line.slice(m.index + m[0].length);
|
|
1238
1241
|
}
|
|
1239
|
-
for (let esc; esc =
|
|
1240
|
-
line = line.slice(0, esc.index) + esc[1] +
|
|
1242
|
+
for (let esc; esc = /\\([{}])/.exec(line);) {
|
|
1243
|
+
line = line.slice(0, esc.index) + esc[1] + line.slice(esc.index + esc[0].length);
|
|
1241
1244
|
for (let pos of positions)
|
|
1242
1245
|
if (pos.line == lines.length && pos.from > esc.index) {
|
|
1243
1246
|
pos.from--;
|
|
@@ -1328,10 +1331,9 @@ The order of fields defaults to textual order, but you can add
|
|
|
1328
1331
|
numbers to placeholders (`${1}` or `${1:defaultText}`) to provide
|
|
1329
1332
|
a custom order.
|
|
1330
1333
|
|
|
1331
|
-
To include a literal
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
placeholder.
|
|
1334
|
+
To include a literal `{` or `}` in your template, put a backslash
|
|
1335
|
+
in front of it. This will be removed and the brace will not be
|
|
1336
|
+
interpreted as indicating a placeholder.
|
|
1335
1337
|
*/
|
|
1336
1338
|
function snippet(template) {
|
|
1337
1339
|
let snippet = Snippet.parse(template);
|
package/dist/index.d.ts
CHANGED
|
@@ -326,10 +326,9 @@ The order of fields defaults to textual order, but you can add
|
|
|
326
326
|
numbers to placeholders (`${1}` or `${1:defaultText}`) to provide
|
|
327
327
|
a custom order.
|
|
328
328
|
|
|
329
|
-
To include a literal
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
placeholder.
|
|
329
|
+
To include a literal `{` or `}` in your template, put a backslash
|
|
330
|
+
in front of it. This will be removed and the brace will not be
|
|
331
|
+
interpreted as indicating a placeholder.
|
|
333
332
|
*/
|
|
334
333
|
declare function snippet(template: string): (editor: {
|
|
335
334
|
state: EditorState;
|
package/dist/index.js
CHANGED
|
@@ -708,6 +708,8 @@ class CompletionState {
|
|
|
708
708
|
if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||
|
|
709
709
|
!sameResults(active, this.active))
|
|
710
710
|
open = CompletionDialog.build(active, state, this.id, this.open, conf);
|
|
711
|
+
else if (open && open.disabled && !active.some(a => a.state == 1 /* State.Pending */))
|
|
712
|
+
open = null;
|
|
711
713
|
else if (open && tr.docChanged)
|
|
712
714
|
open = open.map(tr.changes);
|
|
713
715
|
if (!open && active.every(a => a.state != 1 /* State.Pending */) && active.some(a => a.hasResult()))
|
|
@@ -1130,7 +1132,8 @@ const baseTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
|
1130
1132
|
display: "inline-block",
|
|
1131
1133
|
textAlign: "center",
|
|
1132
1134
|
paddingRight: ".6em",
|
|
1133
|
-
opacity: "0.6"
|
|
1135
|
+
opacity: "0.6",
|
|
1136
|
+
boxSizing: "content-box"
|
|
1134
1137
|
},
|
|
1135
1138
|
".cm-completionIcon-function, .cm-completionIcon-method": {
|
|
1136
1139
|
"&:after": { content: "'ƒ'" }
|
|
@@ -1232,8 +1235,8 @@ class Snippet {
|
|
|
1232
1235
|
positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));
|
|
1233
1236
|
line = line.slice(0, m.index) + name + line.slice(m.index + m[0].length);
|
|
1234
1237
|
}
|
|
1235
|
-
for (let esc; esc =
|
|
1236
|
-
line = line.slice(0, esc.index) + esc[1] +
|
|
1238
|
+
for (let esc; esc = /\\([{}])/.exec(line);) {
|
|
1239
|
+
line = line.slice(0, esc.index) + esc[1] + line.slice(esc.index + esc[0].length);
|
|
1237
1240
|
for (let pos of positions)
|
|
1238
1241
|
if (pos.line == lines.length && pos.from > esc.index) {
|
|
1239
1242
|
pos.from--;
|
|
@@ -1324,10 +1327,9 @@ The order of fields defaults to textual order, but you can add
|
|
|
1324
1327
|
numbers to placeholders (`${1}` or `${1:defaultText}`) to provide
|
|
1325
1328
|
a custom order.
|
|
1326
1329
|
|
|
1327
|
-
To include a literal
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
placeholder.
|
|
1330
|
+
To include a literal `{` or `}` in your template, put a backslash
|
|
1331
|
+
in front of it. This will be removed and the brace will not be
|
|
1332
|
+
interpreted as indicating a placeholder.
|
|
1331
1333
|
*/
|
|
1332
1334
|
function snippet(template) {
|
|
1333
1335
|
let snippet = Snippet.parse(template);
|