class Opal::Input::Autocomplete

Overview

Autocompletion engine supporting static dictionaries, dynamic providers, and ghost text preview generation.

Defined in:

opal/input/autocomplete.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(candidates : Array(String) = [] of String) #

[View source]

Instance Method Detail

def candidates(words : Array(String)) : self #

[View source]
def candidates : Array(String) #

[View source]
def candidates(*words : String) : self #

Adds candidate words for autocompletion


[View source]
def candidates=(candidates : Array(String)) #

[View source]
def complete(query : String) : String #

Returns the full completed string for the best match, or the query itself


[View source]
def ghost_text(query : String) : String | Nil #

Returns the ghost text suffix for the best match, or nil if no match Example: query "bu", match "build" -> returns "ild"


[View source]
def match_mode(m : Symbol) : self #

Sets matching mode (:prefix or :fuzzy)


[View source]
def matches(query : String) : Array(String) #

Returns all matching candidates for the current query


[View source]
def mode : Mode #

[View source]
def mode=(mode : Mode) #

[View source]
def provider(&block : String -> Array(String)) : self #

Adds a dynamic provider block generating suggestions based on query


[View source]