CompletionProvider
The completion provider interface defines how extensions should communicate code completion suggestions in CodeEdit.
Registering a Completion Provider
codeedit.extensions.registerCompletionProvider(myCompletionProvider)
CompletionProvider Interface
class CompletionProvider {
provideCompletionItems(editor, context) {
...
return completionItems;
}
}
It is expected that every CompletionProvider
class include a provideCompletionItems
method, the role of which is to return an array of CompletionItem
objects. This array of objects is used to determine relevant completion suggestions as the user types inside the editor.
In the case of the CompletionProvider
, the provideCompletionItems
method will be called each time the user types in the editor while the activation event conditions are met. CodeEdit will then determine the relevant suggestions.
The provideCompletionItems
method expects an editor and context as arguments. These objects provide the extension with information about the state when a completion is triggered, including the scope of the current cursor position.
CompletionItem
Constructor
new CompletionItem(label: string, kind?:
CompletionItemKind
): CompletionItem
Instantiates a new completion item object.
Completion items must have a label that is used as the default insert text as well as for sorting and filtering of completion suggestions.
Properties
CompletionItemKind
Last updated