@codemirror/autocomplete
Advanced tools
Comparing version 6.6.0 to 6.6.1
@@ -0,1 +1,7 @@ | ||
## 6.6.1 (2023-05-03) | ||
### Bug fixes | ||
Fix a bug that made the editor use the completion's original position, rather than its current position, when changes happened in the document while a result was active. | ||
## 6.6.0 (2023-04-27) | ||
@@ -2,0 +8,0 @@ |
@@ -6,105 +6,2 @@ import * as _codemirror_state from '@codemirror/state'; | ||
interface CompletionConfig { | ||
/** | ||
When enabled (defaults to true), autocompletion will start | ||
whenever the user types something that can be completed. | ||
*/ | ||
activateOnTyping?: boolean; | ||
/** | ||
By default, when completion opens, the first option is selected | ||
and can be confirmed with | ||
[`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion). When this | ||
is set to false, the completion widget starts with no completion | ||
selected, and the user has to explicitly move to a completion | ||
before you can confirm one. | ||
*/ | ||
selectOnOpen?: boolean; | ||
/** | ||
Override the completion sources used. By default, they will be | ||
taken from the `"autocomplete"` [language | ||
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) (which should hold | ||
[completion sources](https://codemirror.net/6/docs/ref/#autocomplete.CompletionSource) or arrays | ||
of [completions](https://codemirror.net/6/docs/ref/#autocomplete.Completion)). | ||
*/ | ||
override?: readonly CompletionSource[] | null; | ||
/** | ||
Determines whether the completion tooltip is closed when the | ||
editor loses focus. Defaults to true. | ||
*/ | ||
closeOnBlur?: boolean; | ||
/** | ||
The maximum number of options to render to the DOM. | ||
*/ | ||
maxRenderedOptions?: number; | ||
/** | ||
Set this to false to disable the [default completion | ||
keymap](https://codemirror.net/6/docs/ref/#autocomplete.completionKeymap). (This requires you to | ||
add bindings to control completion yourself. The bindings should | ||
probably have a higher precedence than other bindings for the | ||
same keys.) | ||
*/ | ||
defaultKeymap?: boolean; | ||
/** | ||
By default, completions are shown below the cursor when there is | ||
space. Setting this to true will make the extension put the | ||
completions above the cursor when possible. | ||
*/ | ||
aboveCursor?: boolean; | ||
/** | ||
When given, this may return an additional CSS class to add to | ||
the completion dialog element. | ||
*/ | ||
tooltipClass?: (state: EditorState) => string; | ||
/** | ||
This can be used to add additional CSS classes to completion | ||
options. | ||
*/ | ||
optionClass?: (completion: Completion) => string; | ||
/** | ||
By default, the library will render icons based on the | ||
completion's [type](https://codemirror.net/6/docs/ref/#autocomplete.Completion.type) in front of | ||
each option. Set this to false to turn that off. | ||
*/ | ||
icons?: boolean; | ||
/** | ||
This option can be used to inject additional content into | ||
options. The `render` function will be called for each visible | ||
completion, and should produce a DOM node to show. `position` | ||
determines where in the DOM the result appears, relative to | ||
other added widgets and the standard content. The default icons | ||
have position 20, the label position 50, and the detail position | ||
80. | ||
*/ | ||
addToOptions?: { | ||
render: (completion: Completion, state: EditorState) => Node | null; | ||
position: number; | ||
}[]; | ||
/** | ||
By default, [info](https://codemirror.net/6/docs/ref/#autocomplet.Completion.info) tooltips are | ||
placed to the side of the selected. This option can be used to | ||
override that. It will be given rectangles for the list of | ||
completions, the selected option, the info element, and the | ||
availble [tooltip space](https://codemirror.net/6/docs/ref/#view.tooltips^config.tooltipSpace), | ||
and should return style and/or class strings for the info | ||
element. | ||
*/ | ||
positionInfo?: (view: EditorView, list: Rect, option: Rect, info: Rect, space: Rect) => { | ||
style?: string; | ||
class?: string; | ||
}; | ||
/** | ||
The comparison function to use when sorting completions with the same | ||
match score. Defaults to using | ||
[`localeCompare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare). | ||
*/ | ||
compareCompletions?: (a: Completion, b: Completion) => number; | ||
/** | ||
By default, commands relating to an open completion only take | ||
effect 75 milliseconds after the completion opened, so that key | ||
presses made before the user is aware of the tooltip don't go to | ||
the tooltip. This option can be used to configure that delay. | ||
*/ | ||
interactionDelay?: number; | ||
} | ||
/** | ||
@@ -355,2 +252,105 @@ Objects type used to represent individual completions. | ||
interface CompletionConfig { | ||
/** | ||
When enabled (defaults to true), autocompletion will start | ||
whenever the user types something that can be completed. | ||
*/ | ||
activateOnTyping?: boolean; | ||
/** | ||
By default, when completion opens, the first option is selected | ||
and can be confirmed with | ||
[`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion). When this | ||
is set to false, the completion widget starts with no completion | ||
selected, and the user has to explicitly move to a completion | ||
before you can confirm one. | ||
*/ | ||
selectOnOpen?: boolean; | ||
/** | ||
Override the completion sources used. By default, they will be | ||
taken from the `"autocomplete"` [language | ||
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) (which should hold | ||
[completion sources](https://codemirror.net/6/docs/ref/#autocomplete.CompletionSource) or arrays | ||
of [completions](https://codemirror.net/6/docs/ref/#autocomplete.Completion)). | ||
*/ | ||
override?: readonly CompletionSource[] | null; | ||
/** | ||
Determines whether the completion tooltip is closed when the | ||
editor loses focus. Defaults to true. | ||
*/ | ||
closeOnBlur?: boolean; | ||
/** | ||
The maximum number of options to render to the DOM. | ||
*/ | ||
maxRenderedOptions?: number; | ||
/** | ||
Set this to false to disable the [default completion | ||
keymap](https://codemirror.net/6/docs/ref/#autocomplete.completionKeymap). (This requires you to | ||
add bindings to control completion yourself. The bindings should | ||
probably have a higher precedence than other bindings for the | ||
same keys.) | ||
*/ | ||
defaultKeymap?: boolean; | ||
/** | ||
By default, completions are shown below the cursor when there is | ||
space. Setting this to true will make the extension put the | ||
completions above the cursor when possible. | ||
*/ | ||
aboveCursor?: boolean; | ||
/** | ||
When given, this may return an additional CSS class to add to | ||
the completion dialog element. | ||
*/ | ||
tooltipClass?: (state: EditorState) => string; | ||
/** | ||
This can be used to add additional CSS classes to completion | ||
options. | ||
*/ | ||
optionClass?: (completion: Completion) => string; | ||
/** | ||
By default, the library will render icons based on the | ||
completion's [type](https://codemirror.net/6/docs/ref/#autocomplete.Completion.type) in front of | ||
each option. Set this to false to turn that off. | ||
*/ | ||
icons?: boolean; | ||
/** | ||
This option can be used to inject additional content into | ||
options. The `render` function will be called for each visible | ||
completion, and should produce a DOM node to show. `position` | ||
determines where in the DOM the result appears, relative to | ||
other added widgets and the standard content. The default icons | ||
have position 20, the label position 50, and the detail position | ||
80. | ||
*/ | ||
addToOptions?: { | ||
render: (completion: Completion, state: EditorState) => Node | null; | ||
position: number; | ||
}[]; | ||
/** | ||
By default, [info](https://codemirror.net/6/docs/ref/#autocomplet.Completion.info) tooltips are | ||
placed to the side of the selected. This option can be used to | ||
override that. It will be given rectangles for the list of | ||
completions, the selected option, the info element, and the | ||
availble [tooltip space](https://codemirror.net/6/docs/ref/#view.tooltips^config.tooltipSpace), | ||
and should return style and/or class strings for the info | ||
element. | ||
*/ | ||
positionInfo?: (view: EditorView, list: Rect, option: Rect, info: Rect, space: Rect) => { | ||
style?: string; | ||
class?: string; | ||
}; | ||
/** | ||
The comparison function to use when sorting completions with the same | ||
match score. Defaults to using | ||
[`localeCompare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare). | ||
*/ | ||
compareCompletions?: (a: Completion, b: Completion) => number; | ||
/** | ||
By default, commands relating to an open completion only take | ||
effect 75 milliseconds after the completion opened, so that key | ||
presses made before the user is aware of the tooltip don't go to | ||
the tooltip. This option can be used to configure that delay. | ||
*/ | ||
interactionDelay?: number; | ||
} | ||
/** | ||
@@ -357,0 +357,0 @@ Convert a snippet template to a function that can |
{ | ||
"name": "@codemirror/autocomplete", | ||
"version": "6.6.0", | ||
"version": "6.6.1", | ||
"description": "Autocompletion for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
199697
4363