mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 08:51:14 -03:00
Support for fuzzy completions
https://github.com/fish-shell/fish-shell/issues/568 https://github.com/fish-shell/fish-shell/issues/528
This commit is contained in:
31
complete.h
31
complete.h
@@ -75,16 +75,11 @@ enum
|
||||
*/
|
||||
COMPLETE_NO_SPACE = 1 << 0,
|
||||
|
||||
/** This completion is case insensitive. */
|
||||
COMPLETE_CASE_INSENSITIVE = 1 << 1,
|
||||
|
||||
/** This is not the suffix of a token, but replaces it entirely */
|
||||
COMPLETE_REPLACES_TOKEN = 1 << 2,
|
||||
|
||||
/**
|
||||
This completion may or may not want a space at the end - guess by
|
||||
checking the last character of the completion.
|
||||
*/
|
||||
/** This completion may or may not want a space at the end - guess by
|
||||
checking the last character of the completion. */
|
||||
COMPLETE_AUTO_SPACE = 1 << 3,
|
||||
|
||||
/** This completion should be inserted as-is, without escaping. */
|
||||
@@ -107,16 +102,15 @@ class completion_t
|
||||
/* Destructor. Not inlining it saves code size. */
|
||||
~completion_t();
|
||||
|
||||
/**
|
||||
The completion string
|
||||
*/
|
||||
/** The completion string */
|
||||
wcstring completion;
|
||||
|
||||
/**
|
||||
The description for this completion
|
||||
*/
|
||||
/** The description for this completion */
|
||||
wcstring description;
|
||||
|
||||
/** The type of fuzzy match */
|
||||
string_fuzzy_match_t match;
|
||||
|
||||
/**
|
||||
Flags determining the completion behaviour.
|
||||
|
||||
@@ -128,14 +122,9 @@ class completion_t
|
||||
is case insensitive.
|
||||
*/
|
||||
int flags;
|
||||
|
||||
bool is_case_insensitive() const
|
||||
{
|
||||
return !!(flags & COMPLETE_CASE_INSENSITIVE);
|
||||
}
|
||||
|
||||
|
||||
/* Construction. Note: defining these so that they are not inlined reduces the executable size. */
|
||||
completion_t(const wcstring &comp, const wcstring &desc = L"", int flags_val = 0);
|
||||
completion_t(const wcstring &comp, const wcstring &desc = L"", string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact), int flags_val = 0);
|
||||
completion_t(const completion_t &);
|
||||
completion_t &operator=(const completion_t &);
|
||||
|
||||
@@ -286,7 +275,7 @@ void complete_load(const wcstring &cmd, bool reload);
|
||||
\param flags completion flags
|
||||
|
||||
*/
|
||||
void append_completion(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc = L"", int flags = 0);
|
||||
void append_completion(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc = L"", int flags = 0, string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact));
|
||||
|
||||
/* Function used for testing */
|
||||
void complete_set_variable_names(const wcstring_list_t *names);
|
||||
|
||||
Reference in New Issue
Block a user