@codemirror/autocomplete 6.7.1 → 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.
@@ -0,0 +1,557 @@
1
+ import * as _codemirror_state from '@codemirror/state';
2
+ import { EditorState, TransactionSpec, Transaction, StateCommand, Facet, Extension, StateEffect } from '@codemirror/state';
3
+ import { EditorView, Rect, KeyBinding, Command } from '@codemirror/view';
4
+ import * as _lezer_common from '@lezer/common';
5
+
6
+ /**
7
+ Objects type used to represent individual completions.
8
+ */
9
+ interface Completion {
10
+ /**
11
+ The label to show in the completion picker. This is what input
12
+ is matched agains to determine whether a completion matches (and
13
+ how well it matches).
14
+ */
15
+ label: string;
16
+ /**
17
+ An optional short piece of information to show (with a different
18
+ style) after the label.
19
+ */
20
+ detail?: string;
21
+ /**
22
+ Additional info to show when the completion is selected. Can be
23
+ a plain string or a function that'll render the DOM structure to
24
+ show when invoked.
25
+ */
26
+ info?: string | ((completion: Completion) => CompletionInfo | Promise<CompletionInfo>);
27
+ /**
28
+ How to apply the completion. The default is to replace it with
29
+ its [label](https://codemirror.net/6/docs/ref/#autocomplete.Completion.label). When this holds a
30
+ string, the completion range is replaced by that string. When it
31
+ is a function, that function is called to perform the
32
+ completion. If it fires a transaction, it is responsible for
33
+ adding the [`pickedCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.pickedCompletion)
34
+ annotation to it.
35
+ */
36
+ apply?: string | ((view: EditorView, completion: Completion, from: number, to: number) => void);
37
+ /**
38
+ The type of the completion. This is used to pick an icon to show
39
+ for the completion. Icons are styled with a CSS class created by
40
+ appending the type name to `"cm-completionIcon-"`. You can
41
+ define or restyle icons by defining these selectors. The base
42
+ library defines simple icons for `class`, `constant`, `enum`,
43
+ `function`, `interface`, `keyword`, `method`, `namespace`,
44
+ `property`, `text`, `type`, and `variable`.
45
+
46
+ Multiple types can be provided by separating them with spaces.
47
+ */
48
+ type?: string;
49
+ /**
50
+ When given, should be a number from -99 to 99 that adjusts how
51
+ this completion is ranked compared to other completions that
52
+ match the input as well as this one. A negative number moves it
53
+ down the list, a positive number moves it up.
54
+ */
55
+ boost?: number;
56
+ /**
57
+ Can be used to divide the completion list into sections.
58
+ Completions in a given section (matched by name) will be grouped
59
+ together, with a heading above them. Options without section
60
+ will appear above all sections. A string value is equivalent to
61
+ a `{name}` object.
62
+ */
63
+ section?: string | CompletionSection;
64
+ }
65
+ /**
66
+ The type returned from
67
+ [`Completion.info`](https://codemirror.net/6/docs/ref/#autocomplete.Completion.info). May be a DOM
68
+ node, null to indicate there is no info, or an object with an
69
+ optional `destroy` method that cleans up the node.
70
+ */
71
+ declare type CompletionInfo = Node | null | {
72
+ dom: Node;
73
+ destroy?(): void;
74
+ };
75
+ /**
76
+ Object used to describe a completion
77
+ [section](https://codemirror.net/6/docs/ref/#autocomplete.Completion.section). It is recommended to
78
+ create a shared object used by all the completions in a given
79
+ section.
80
+ */
81
+ interface CompletionSection {
82
+ /**
83
+ The name of the section. If no `render` method is present, this
84
+ will be displayed above the options.
85
+ */
86
+ name: string;
87
+ /**
88
+ An optional function that renders the section header. Since the
89
+ headers are shown inside a list, you should make sure the
90
+ resulting element has a `display: list-item` style.
91
+ */
92
+ header?: (section: CompletionSection) => HTMLElement;
93
+ /**
94
+ By default, sections are ordered alphabetically by name. To
95
+ specify an explicit order, `rank` can be used. Sections with a
96
+ lower rank will be shown above sections with a higher rank.
97
+ */
98
+ rank?: number;
99
+ }
100
+ /**
101
+ An instance of this is passed to completion source functions.
102
+ */
103
+ declare class CompletionContext {
104
+ /**
105
+ The editor state that the completion happens in.
106
+ */
107
+ readonly state: EditorState;
108
+ /**
109
+ The position at which the completion is happening.
110
+ */
111
+ readonly pos: number;
112
+ /**
113
+ Indicates whether completion was activated explicitly, or
114
+ implicitly by typing. The usual way to respond to this is to
115
+ only return completions when either there is part of a
116
+ completable entity before the cursor, or `explicit` is true.
117
+ */
118
+ readonly explicit: boolean;
119
+ /**
120
+ Create a new completion context. (Mostly useful for testing
121
+ completion sources—in the editor, the extension will create
122
+ these for you.)
123
+ */
124
+ constructor(
125
+ /**
126
+ The editor state that the completion happens in.
127
+ */
128
+ state: EditorState,
129
+ /**
130
+ The position at which the completion is happening.
131
+ */
132
+ pos: number,
133
+ /**
134
+ Indicates whether completion was activated explicitly, or
135
+ implicitly by typing. The usual way to respond to this is to
136
+ only return completions when either there is part of a
137
+ completable entity before the cursor, or `explicit` is true.
138
+ */
139
+ explicit: boolean);
140
+ /**
141
+ Get the extent, content, and (if there is a token) type of the
142
+ token before `this.pos`.
143
+ */
144
+ tokenBefore(types: readonly string[]): {
145
+ from: number;
146
+ to: number;
147
+ text: string;
148
+ type: _lezer_common.NodeType;
149
+ } | null;
150
+ /**
151
+ Get the match of the given expression directly before the
152
+ cursor.
153
+ */
154
+ matchBefore(expr: RegExp): {
155
+ from: number;
156
+ to: number;
157
+ text: string;
158
+ } | null;
159
+ /**
160
+ Yields true when the query has been aborted. Can be useful in
161
+ asynchronous queries to avoid doing work that will be ignored.
162
+ */
163
+ get aborted(): boolean;
164
+ /**
165
+ Allows you to register abort handlers, which will be called when
166
+ the query is
167
+ [aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted).
168
+ */
169
+ addEventListener(type: "abort", listener: () => void): void;
170
+ }
171
+ /**
172
+ Given a a fixed array of options, return an autocompleter that
173
+ completes them.
174
+ */
175
+ declare function completeFromList(list: readonly (string | Completion)[]): CompletionSource;
176
+ /**
177
+ Wrap the given completion source so that it will only fire when the
178
+ cursor is in a syntax node with one of the given names.
179
+ */
180
+ declare function ifIn(nodes: readonly string[], source: CompletionSource): CompletionSource;
181
+ /**
182
+ Wrap the given completion source so that it will not fire when the
183
+ cursor is in a syntax node with one of the given names.
184
+ */
185
+ declare function ifNotIn(nodes: readonly string[], source: CompletionSource): CompletionSource;
186
+ /**
187
+ The function signature for a completion source. Such a function
188
+ may return its [result](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult)
189
+ synchronously or as a promise. Returning null indicates no
190
+ completions are available.
191
+ */
192
+ declare type CompletionSource = (context: CompletionContext) => CompletionResult | null | Promise<CompletionResult | null>;
193
+ /**
194
+ Interface for objects returned by completion sources.
195
+ */
196
+ interface CompletionResult {
197
+ /**
198
+ The start of the range that is being completed.
199
+ */
200
+ from: number;
201
+ /**
202
+ The end of the range that is being completed. Defaults to the
203
+ main cursor position.
204
+ */
205
+ to?: number;
206
+ /**
207
+ The completions returned. These don't have to be compared with
208
+ the input by the source—the autocompletion system will do its
209
+ own matching (against the text between `from` and `to`) and
210
+ sorting.
211
+ */
212
+ options: readonly Completion[];
213
+ /**
214
+ When given, further typing or deletion that causes the part of
215
+ the document between ([mapped](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) `from`
216
+ and `to` to match this regular expression or predicate function
217
+ will not query the completion source again, but continue with
218
+ this list of options. This can help a lot with responsiveness,
219
+ since it allows the completion list to be updated synchronously.
220
+ */
221
+ validFor?: RegExp | ((text: string, from: number, to: number, state: EditorState) => boolean);
222
+ /**
223
+ By default, the library filters and scores completions. Set
224
+ `filter` to `false` to disable this, and cause your completions
225
+ to all be included, in the order they were given. When there are
226
+ other sources, unfiltered completions appear at the top of the
227
+ list of completions. `validFor` must not be given when `filter`
228
+ is `false`, because it only works when filtering.
229
+ */
230
+ filter?: boolean;
231
+ /**
232
+ When [`filter`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.filter) is set to
233
+ `false`, this may be provided to compute the ranges on the label
234
+ that match the input. Should return an array of numbers where
235
+ each pair of adjacent numbers provide the start and end of a
236
+ range.
237
+ */
238
+ getMatch?: (completion: Completion) => readonly number[];
239
+ /**
240
+ Synchronously update the completion result after typing or
241
+ deletion. If given, this should not do any expensive work, since
242
+ it will be called during editor state updates. The function
243
+ should make sure (similar to
244
+ [`validFor`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.validFor)) that the
245
+ completion still applies in the new state.
246
+ */
247
+ update?: (current: CompletionResult, from: number, to: number, context: CompletionContext) => CompletionResult | null;
248
+ }
249
+ /**
250
+ This annotation is added to transactions that are produced by
251
+ picking a completion.
252
+ */
253
+ declare const pickedCompletion: _codemirror_state.AnnotationType<Completion>;
254
+ /**
255
+ Helper function that returns a transaction spec which inserts a
256
+ completion's text in the main selection range, and any other
257
+ selection range that has the same text in front of it.
258
+ */
259
+ declare function insertCompletionText(state: EditorState, text: string, from: number, to: number): TransactionSpec;
260
+
261
+ interface CompletionConfig {
262
+ /**
263
+ When enabled (defaults to true), autocompletion will start
264
+ whenever the user types something that can be completed.
265
+ */
266
+ activateOnTyping?: boolean;
267
+ /**
268
+ By default, when completion opens, the first option is selected
269
+ and can be confirmed with
270
+ [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion). When this
271
+ is set to false, the completion widget starts with no completion
272
+ selected, and the user has to explicitly move to a completion
273
+ before you can confirm one.
274
+ */
275
+ selectOnOpen?: boolean;
276
+ /**
277
+ Override the completion sources used. By default, they will be
278
+ taken from the `"autocomplete"` [language
279
+ data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) (which should hold
280
+ [completion sources](https://codemirror.net/6/docs/ref/#autocomplete.CompletionSource) or arrays
281
+ of [completions](https://codemirror.net/6/docs/ref/#autocomplete.Completion)).
282
+ */
283
+ override?: readonly CompletionSource[] | null;
284
+ /**
285
+ Determines whether the completion tooltip is closed when the
286
+ editor loses focus. Defaults to true.
287
+ */
288
+ closeOnBlur?: boolean;
289
+ /**
290
+ The maximum number of options to render to the DOM.
291
+ */
292
+ maxRenderedOptions?: number;
293
+ /**
294
+ Set this to false to disable the [default completion
295
+ keymap](https://codemirror.net/6/docs/ref/#autocomplete.completionKeymap). (This requires you to
296
+ add bindings to control completion yourself. The bindings should
297
+ probably have a higher precedence than other bindings for the
298
+ same keys.)
299
+ */
300
+ defaultKeymap?: boolean;
301
+ /**
302
+ By default, completions are shown below the cursor when there is
303
+ space. Setting this to true will make the extension put the
304
+ completions above the cursor when possible.
305
+ */
306
+ aboveCursor?: boolean;
307
+ /**
308
+ When given, this may return an additional CSS class to add to
309
+ the completion dialog element.
310
+ */
311
+ tooltipClass?: (state: EditorState) => string;
312
+ /**
313
+ This can be used to add additional CSS classes to completion
314
+ options.
315
+ */
316
+ optionClass?: (completion: Completion) => string;
317
+ /**
318
+ By default, the library will render icons based on the
319
+ completion's [type](https://codemirror.net/6/docs/ref/#autocomplete.Completion.type) in front of
320
+ each option. Set this to false to turn that off.
321
+ */
322
+ icons?: boolean;
323
+ /**
324
+ This option can be used to inject additional content into
325
+ options. The `render` function will be called for each visible
326
+ completion, and should produce a DOM node to show. `position`
327
+ determines where in the DOM the result appears, relative to
328
+ other added widgets and the standard content. The default icons
329
+ have position 20, the label position 50, and the detail position
330
+ 80.
331
+ */
332
+ addToOptions?: {
333
+ render: (completion: Completion, state: EditorState) => Node | null;
334
+ position: number;
335
+ }[];
336
+ /**
337
+ By default, [info](https://codemirror.net/6/docs/ref/#autocomplet.Completion.info) tooltips are
338
+ placed to the side of the selected. This option can be used to
339
+ override that. It will be given rectangles for the list of
340
+ completions, the selected option, the info element, and the
341
+ availble [tooltip space](https://codemirror.net/6/docs/ref/#view.tooltips^config.tooltipSpace),
342
+ and should return style and/or class strings for the info
343
+ element.
344
+ */
345
+ positionInfo?: (view: EditorView, list: Rect, option: Rect, info: Rect, space: Rect) => {
346
+ style?: string;
347
+ class?: string;
348
+ };
349
+ /**
350
+ The comparison function to use when sorting completions with the same
351
+ match score. Defaults to using
352
+ [`localeCompare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare).
353
+ */
354
+ compareCompletions?: (a: Completion, b: Completion) => number;
355
+ /**
356
+ By default, commands relating to an open completion only take
357
+ effect 75 milliseconds after the completion opened, so that key
358
+ presses made before the user is aware of the tooltip don't go to
359
+ the tooltip. This option can be used to configure that delay.
360
+ */
361
+ interactionDelay?: number;
362
+ }
363
+
364
+ /**
365
+ Convert a snippet template to a function that can
366
+ [apply](https://codemirror.net/6/docs/ref/#autocomplete.Completion.apply) it. Snippets are written
367
+ using syntax like this:
368
+
369
+ "for (let ${index} = 0; ${index} < ${end}; ${index}++) {\n\t${}\n}"
370
+
371
+ Each `${}` placeholder (you may also use `#{}`) indicates a field
372
+ that the user can fill in. Its name, if any, will be the default
373
+ content for the field.
374
+
375
+ When the snippet is activated by calling the returned function,
376
+ the code is inserted at the given position. Newlines in the
377
+ template are indented by the indentation of the start line, plus
378
+ one [indent unit](https://codemirror.net/6/docs/ref/#language.indentUnit) per tab character after
379
+ the newline.
380
+
381
+ On activation, (all instances of) the first field are selected.
382
+ The user can move between fields with Tab and Shift-Tab as long as
383
+ the fields are active. Moving to the last field or moving the
384
+ cursor out of the current field deactivates the fields.
385
+
386
+ The order of fields defaults to textual order, but you can add
387
+ numbers to placeholders (`${1}` or `${1:defaultText}`) to provide
388
+ a custom order.
389
+
390
+ To include a literal `{` or `}` in your template, put a backslash
391
+ in front of it. This will be removed and the brace will not be
392
+ interpreted as indicating a placeholder.
393
+ */
394
+ declare function snippet(template: string): (editor: {
395
+ state: EditorState;
396
+ dispatch: (tr: Transaction) => void;
397
+ }, completion: Completion | null, from: number, to: number) => void;
398
+ /**
399
+ A command that clears the active snippet, if any.
400
+ */
401
+ declare const clearSnippet: StateCommand;
402
+ /**
403
+ Move to the next snippet field, if available.
404
+ */
405
+ declare const nextSnippetField: StateCommand;
406
+ /**
407
+ Move to the previous snippet field, if available.
408
+ */
409
+ declare const prevSnippetField: StateCommand;
410
+ /**
411
+ Check if there is an active snippet with a next field for
412
+ `nextSnippetField` to move to.
413
+ */
414
+ declare function hasNextSnippetField(state: EditorState): boolean;
415
+ /**
416
+ Returns true if there is an active snippet and a previous field
417
+ for `prevSnippetField` to move to.
418
+ */
419
+ declare function hasPrevSnippetField(state: EditorState): boolean;
420
+ /**
421
+ A facet that can be used to configure the key bindings used by
422
+ snippets. The default binds Tab to
423
+ [`nextSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.nextSnippetField), Shift-Tab to
424
+ [`prevSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.prevSnippetField), and Escape
425
+ to [`clearSnippet`](https://codemirror.net/6/docs/ref/#autocomplete.clearSnippet).
426
+ */
427
+ declare const snippetKeymap: Facet<readonly KeyBinding[], readonly KeyBinding[]>;
428
+ /**
429
+ Create a completion from a snippet. Returns an object with the
430
+ properties from `completion`, plus an `apply` function that
431
+ applies the snippet.
432
+ */
433
+ declare function snippetCompletion(template: string, completion: Completion): Completion;
434
+
435
+ /**
436
+ Returns a command that moves the completion selection forward or
437
+ backward by the given amount.
438
+ */
439
+ declare function moveCompletionSelection(forward: boolean, by?: "option" | "page"): Command;
440
+ /**
441
+ Accept the current completion.
442
+ */
443
+ declare const acceptCompletion: Command;
444
+ /**
445
+ Explicitly start autocompletion.
446
+ */
447
+ declare const startCompletion: Command;
448
+ /**
449
+ Close the currently active completion.
450
+ */
451
+ declare const closeCompletion: Command;
452
+
453
+ /**
454
+ A completion source that will scan the document for words (using a
455
+ [character categorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer)), and
456
+ return those as completions.
457
+ */
458
+ declare const completeAnyWord: CompletionSource;
459
+
460
+ /**
461
+ Configures bracket closing behavior for a syntax (via
462
+ [language data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt)) using the `"closeBrackets"`
463
+ identifier.
464
+ */
465
+ interface CloseBracketConfig {
466
+ /**
467
+ The opening brackets to close. Defaults to `["(", "[", "{", "'",
468
+ '"']`. Brackets may be single characters or a triple of quotes
469
+ (as in `"''''"`).
470
+ */
471
+ brackets?: string[];
472
+ /**
473
+ Characters in front of which newly opened brackets are
474
+ automatically closed. Closing always happens in front of
475
+ whitespace. Defaults to `")]}:;>"`.
476
+ */
477
+ before?: string;
478
+ /**
479
+ When determining whether a given node may be a string, recognize
480
+ these prefixes before the opening quote.
481
+ */
482
+ stringPrefixes?: string[];
483
+ }
484
+ /**
485
+ Extension to enable bracket-closing behavior. When a closeable
486
+ bracket is typed, its closing bracket is immediately inserted
487
+ after the cursor. When closing a bracket directly in front of a
488
+ closing bracket inserted by the extension, the cursor moves over
489
+ that bracket.
490
+ */
491
+ declare function closeBrackets(): Extension;
492
+ /**
493
+ Command that implements deleting a pair of matching brackets when
494
+ the cursor is between them.
495
+ */
496
+ declare const deleteBracketPair: StateCommand;
497
+ /**
498
+ Close-brackets related key bindings. Binds Backspace to
499
+ [`deleteBracketPair`](https://codemirror.net/6/docs/ref/#autocomplete.deleteBracketPair).
500
+ */
501
+ declare const closeBracketsKeymap: readonly KeyBinding[];
502
+ /**
503
+ Implements the extension's behavior on text insertion. If the
504
+ given string counts as a bracket in the language around the
505
+ selection, and replacing the selection with it requires custom
506
+ behavior (inserting a closing version or skipping past a
507
+ previously-closed bracket), this function returns a transaction
508
+ representing that custom behavior. (You only need this if you want
509
+ to programmatically insert brackets—the
510
+ [`closeBrackets`](https://codemirror.net/6/docs/ref/#autocomplete.closeBrackets) extension will
511
+ take care of running this for user input.)
512
+ */
513
+ declare function insertBracket(state: EditorState, bracket: string): Transaction | null;
514
+
515
+ /**
516
+ Returns an extension that enables autocompletion.
517
+ */
518
+ declare function autocompletion(config?: CompletionConfig): Extension;
519
+ /**
520
+ Basic keybindings for autocompletion.
521
+
522
+ - Ctrl-Space: [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
523
+ - Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)
524
+ - ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`
525
+ - ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`
526
+ - PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
527
+ - PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
528
+ - Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)
529
+ */
530
+ declare const completionKeymap: readonly KeyBinding[];
531
+ /**
532
+ Get the current completion status. When completions are available,
533
+ this will return `"active"`. When completions are pending (in the
534
+ process of being queried), this returns `"pending"`. Otherwise, it
535
+ returns `null`.
536
+ */
537
+ declare function completionStatus(state: EditorState): null | "active" | "pending";
538
+ /**
539
+ Returns the available completions as an array.
540
+ */
541
+ declare function currentCompletions(state: EditorState): readonly Completion[];
542
+ /**
543
+ Return the currently selected completion, if any.
544
+ */
545
+ declare function selectedCompletion(state: EditorState): Completion | null;
546
+ /**
547
+ Returns the currently selected position in the active completion
548
+ list, or null if no completions are active.
549
+ */
550
+ declare function selectedCompletionIndex(state: EditorState): number | null;
551
+ /**
552
+ Create an effect that can be attached to a transaction to change
553
+ the currently selected completion.
554
+ */
555
+ declare function setSelectedCompletion(index: number): StateEffect<unknown>;
556
+
557
+ export { CloseBracketConfig, Completion, CompletionContext, CompletionInfo, CompletionResult, CompletionSection, CompletionSource, acceptCompletion, autocompletion, clearSnippet, closeBrackets, closeBracketsKeymap, closeCompletion, completeAnyWord, completeFromList, completionKeymap, completionStatus, currentCompletions, deleteBracketPair, hasNextSnippetField, hasPrevSnippetField, ifIn, ifNotIn, insertBracket, insertCompletionText, moveCompletionSelection, nextSnippetField, pickedCompletion, prevSnippetField, selectedCompletion, selectedCompletionIndex, setSelectedCompletion, snippet, snippetCompletion, snippetKeymap, startCompletion };
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ interface Completion {
23
23
  a plain string or a function that'll render the DOM structure to
24
24
  show when invoked.
25
25
  */
26
- info?: string | ((completion: Completion) => (Node | null | Promise<Node | null>));
26
+ info?: string | ((completion: Completion) => CompletionInfo | Promise<CompletionInfo>);
27
27
  /**
28
28
  How to apply the completion. The default is to replace it with
29
29
  its [label](https://codemirror.net/6/docs/ref/#autocomplete.Completion.label). When this holds a
@@ -63,6 +63,16 @@ interface Completion {
63
63
  section?: string | CompletionSection;
64
64
  }
65
65
  /**
66
+ The type returned from
67
+ [`Completion.info`](https://codemirror.net/6/docs/ref/#autocomplete.Completion.info). May be a DOM
68
+ node, null to indicate there is no info, or an object with an
69
+ optional `destroy` method that cleans up the node.
70
+ */
71
+ declare type CompletionInfo = Node | null | {
72
+ dom: Node;
73
+ destroy?(): void;
74
+ };
75
+ /**
66
76
  Object used to describe a completion
67
77
  [section](https://codemirror.net/6/docs/ref/#autocomplete.Completion.section). It is recommended to
68
78
  create a shared object used by all the completions in a given
@@ -544,4 +554,4 @@ the currently selected completion.
544
554
  */
545
555
  declare function setSelectedCompletion(index: number): StateEffect<unknown>;
546
556
 
547
- export { CloseBracketConfig, Completion, CompletionContext, CompletionResult, CompletionSection, CompletionSource, acceptCompletion, autocompletion, clearSnippet, closeBrackets, closeBracketsKeymap, closeCompletion, completeAnyWord, completeFromList, completionKeymap, completionStatus, currentCompletions, deleteBracketPair, hasNextSnippetField, hasPrevSnippetField, ifIn, ifNotIn, insertBracket, insertCompletionText, moveCompletionSelection, nextSnippetField, pickedCompletion, prevSnippetField, selectedCompletion, selectedCompletionIndex, setSelectedCompletion, snippet, snippetCompletion, snippetKeymap, startCompletion };
557
+ export { CloseBracketConfig, Completion, CompletionContext, CompletionInfo, CompletionResult, CompletionSection, CompletionSource, acceptCompletion, autocompletion, clearSnippet, closeBrackets, closeBracketsKeymap, closeCompletion, completeAnyWord, completeFromList, completionKeymap, completionStatus, currentCompletions, deleteBracketPair, hasNextSnippetField, hasPrevSnippetField, ifIn, ifNotIn, insertBracket, insertCompletionText, moveCompletionSelection, nextSnippetField, pickedCompletion, prevSnippetField, selectedCompletion, selectedCompletionIndex, setSelectedCompletion, snippet, snippetCompletion, snippetKeymap, startCompletion };