Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

A general Autocomplete for the editor #65

Closed
Bios-Marcel opened this issue Mar 3, 2019 · 0 comments
Closed

A general Autocomplete for the editor #65

Bios-Marcel opened this issue Mar 3, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@Bios-Marcel
Copy link
Owner

Currently the editor offers autocomplete only for mentions. It'd be optimal if that autocomplete would be completely dynamic, allowing the programmer to register arbitrary autocomplete patterns.

For example:

editor.RegisterAutoCompletePattern(":(.*?)(?:$|\s)", func(input string) []string) {
    return emojis.GetEmojisStartingWith(input)
})

Where the first parameter is a regular expression containing a single captured group or no captured group, resulting in the complete content being passed. The input then gets passed to the handler function, which returns the autocomplete options for that given input.

The editor would then update the view after calling the handler.

On selection another handler should be called, something like:

editor.RegisterAutoCompleteActionHandler(func (selected string) string {
  //Code  
})

The autocomplete input should always be the first match and cut off at the current cursor position.

So :Emo(Cursor)ji: would be passed as Emo and the replacement should be Replacementji.

@Bios-Marcel Bios-Marcel added the enhancement New feature or request label Mar 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant