@codemirror/autocomplete
Advanced tools
Comparing version 6.4.2 to 6.5.0
@@ -0,1 +1,15 @@ | ||
## 6.5.0 (2023-04-13) | ||
### Bug fixes | ||
When `closeBrackets` skips a bracket, it now generates a change that overwrites the bracket. | ||
Replace the entire selected range when picking a completion with a non-cursor selection active. | ||
### New features | ||
Completions can now provide a `section` field that is used to group them into sections. | ||
The new `positionInfo` option can be used to provide custom logic for positioning the info tooltips. | ||
## 6.4.2 (2023-02-17) | ||
@@ -2,0 +16,0 @@ |
import * as _codemirror_state from '@codemirror/state'; | ||
import { EditorState, TransactionSpec, Transaction, StateCommand, Facet, Extension, StateEffect } from '@codemirror/state'; | ||
import { EditorView, KeyBinding, Command } from '@codemirror/view'; | ||
import { EditorView, Rect, KeyBinding, Command } from '@codemirror/view'; | ||
import * as _lezer_common from '@lezer/common'; | ||
@@ -82,2 +82,15 @@ | ||
/** | ||
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 | ||
@@ -147,4 +160,37 @@ match score. Defaults to using | ||
boost?: number; | ||
/** | ||
Can be used to divide the completion list into sections. | ||
Completions in a given section (matched by name) will be grouped | ||
together, with a heading above them. Options without section | ||
will appear above all sections. A string value is equivalent to | ||
a `{name}` object. | ||
*/ | ||
section?: string | CompletionSection; | ||
} | ||
/** | ||
Object used to describe a completion | ||
[section](https://codemirror.net/6/docs/ref/#autocomplete.Completion.section). It is recommended to | ||
create a shared object used by all the completions in a given | ||
section. | ||
*/ | ||
interface CompletionSection { | ||
/** | ||
The name of the section. If no `render` method is present, this | ||
will be displayed above the options. | ||
*/ | ||
name: string; | ||
/** | ||
An optional function that renders the section header. Since the | ||
headers are shown inside a list, you should make sure the | ||
resulting element has a `display: list-item` style. | ||
*/ | ||
header?: (section: CompletionSection) => HTMLElement; | ||
/** | ||
By default, sections are ordered alphabetically by name. To | ||
specify an explicit order, `rank` can be used. Sections with a | ||
lower rank will be shown above sections with a higher rank. | ||
*/ | ||
rank?: number; | ||
} | ||
/** | ||
An instance of this is passed to completion source functions. | ||
@@ -493,2 +539,2 @@ */ | ||
export { CloseBracketConfig, Completion, CompletionContext, CompletionResult, CompletionSource, acceptCompletion, autocompletion, clearSnippet, closeBrackets, closeBracketsKeymap, closeCompletion, completeAnyWord, completeFromList, completionKeymap, completionStatus, currentCompletions, deleteBracketPair, ifIn, ifNotIn, insertBracket, insertCompletionText, moveCompletionSelection, nextSnippetField, pickedCompletion, prevSnippetField, selectedCompletion, selectedCompletionIndex, setSelectedCompletion, snippet, snippetCompletion, snippetKeymap, startCompletion }; | ||
export { CloseBracketConfig, Completion, CompletionContext, CompletionResult, CompletionSection, CompletionSource, acceptCompletion, autocompletion, clearSnippet, closeBrackets, closeBracketsKeymap, closeCompletion, completeAnyWord, completeFromList, completionKeymap, completionStatus, currentCompletions, deleteBracketPair, ifIn, ifNotIn, insertBracket, insertCompletionText, moveCompletionSelection, nextSnippetField, pickedCompletion, prevSnippetField, selectedCompletion, selectedCompletionIndex, setSelectedCompletion, snippet, snippetCompletion, snippetKeymap, startCompletion }; |
{ | ||
"name": "@codemirror/autocomplete", | ||
"version": "6.4.2", | ||
"version": "6.5.0", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197551
4339