Can't insert completions when executing command `startAutocomplete` with `matches` argument.
linuspahl opened this issue · comments
Describe the bug
This might not be a bug and behaves as expected.
I am looking for a way to display suggestions like snippets independently of the current editor value and autocomplete filter logic.
I noticed that it is possible to run the following command to show any suggestions in the popover.
editor.execCommand('startAutocomplete', {
matches: [
{ value: 'example value' },
],
});
But when I click on the suggestion, nothing happens.
This seems to be the case, because this.completions
in the autocomplete.js
is only defined when opening the popup, but not when clicking on the suggestion.
https://github.com/ajaxorg/ace/blob/master/src/autocomplete.js#L834
It would be possible to change the editor value by extending each object in matches
with a completer
completer: {
insertMatch: (editor, data) => {
editor.setValue(data.value);
},
}
but I am wondering if I am using the startAutocomplete
command correctly and if it is intended for this use case.
I was also wondering if there is some kind of documentation for the commands and their arguments?
Expected Behavior
When using the 'startAutocomplete' command with matches
, it should be possible to insert a match when (for example) clicking on it.
Current Behavior
See "Describe the bug".
Reproduction Steps
I hope the code snippet in "Describe the bug" is sufficient.
Possible Solution
No response
Additional Information/Context
No response
Ace Version / Browser / OS / Keyboard layout
Ace version 1.32.3