2016-05-03 23:23:30 +00:00
|
|
|
/// Prototypes for functions related to tab-completion.
|
|
|
|
///
|
|
|
|
/// These functions are used for storing and retrieving tab-completion data, as well as for
|
|
|
|
/// performing tab-completion.
|
2005-10-04 15:11:39 +00:00
|
|
|
#ifndef FISH_COMPLETE_H
|
|
|
|
#define FISH_COMPLETE_H
|
|
|
|
|
2022-08-21 06:14:48 +00:00
|
|
|
#include "config.h" // IWYU pragma: keep
|
2017-02-14 04:37:27 +00:00
|
|
|
|
2022-08-21 06:14:48 +00:00
|
|
|
#include <cstddef>
|
2022-08-21 21:51:33 +00:00
|
|
|
#include <cstdint>
|
2018-10-17 01:38:41 +00:00
|
|
|
#include <functional>
|
2022-08-21 06:14:48 +00:00
|
|
|
#include <utility>
|
2016-05-03 23:23:30 +00:00
|
|
|
#include <vector>
|
2005-10-04 15:11:39 +00:00
|
|
|
|
2012-01-16 16:56:47 +00:00
|
|
|
#include "common.h"
|
2023-10-08 21:22:27 +00:00
|
|
|
#include "expand.h"
|
|
|
|
#include "parser.h"
|
2020-11-27 23:43:07 +00:00
|
|
|
#include "wcstringutil.h"
|
2019-05-05 00:55:57 +00:00
|
|
|
|
2019-04-25 21:21:06 +00:00
|
|
|
struct completion_mode_t {
|
|
|
|
/// If set, skip file completions.
|
|
|
|
bool no_files{false};
|
2019-05-30 17:12:49 +00:00
|
|
|
bool force_files{false};
|
2019-04-25 21:21:06 +00:00
|
|
|
|
|
|
|
/// If set, require a parameter after completion.
|
|
|
|
bool requires_param{false};
|
|
|
|
};
|
2019-04-25 20:25:36 +00:00
|
|
|
|
2016-05-03 23:23:30 +00:00
|
|
|
/// Character that separates the completion and description on programmable completions.
|
2022-09-20 18:58:37 +00:00
|
|
|
#define PROG_COMPLETE_SEP L'\t'
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2016-05-03 23:23:30 +00:00
|
|
|
enum {
|
|
|
|
/// Do not insert space afterwards if this is the only completion. (The default is to try insert
|
|
|
|
/// a space).
|
2012-02-26 02:54:49 +00:00
|
|
|
COMPLETE_NO_SPACE = 1 << 0,
|
2016-05-03 23:23:30 +00:00
|
|
|
/// This is not the suffix of a token, but replaces it entirely.
|
2022-05-31 01:53:32 +00:00
|
|
|
COMPLETE_REPLACES_TOKEN = 1 << 1,
|
2016-05-03 23:23:30 +00:00
|
|
|
/// This completion may or may not want a space at the end - guess by checking the last
|
|
|
|
/// character of the completion.
|
2022-05-31 01:53:32 +00:00
|
|
|
COMPLETE_AUTO_SPACE = 1 << 2,
|
2016-05-03 23:23:30 +00:00
|
|
|
/// This completion should be inserted as-is, without escaping.
|
2022-05-31 01:53:32 +00:00
|
|
|
COMPLETE_DONT_ESCAPE = 1 << 3,
|
2016-05-03 23:23:30 +00:00
|
|
|
/// If you do escape, don't escape tildes.
|
2022-05-31 01:53:32 +00:00
|
|
|
COMPLETE_DONT_ESCAPE_TILDES = 1 << 4,
|
2017-07-24 22:54:54 +00:00
|
|
|
/// Do not sort supplied completions
|
2022-05-31 01:53:32 +00:00
|
|
|
COMPLETE_DONT_SORT = 1 << 5,
|
2018-08-07 09:01:19 +00:00
|
|
|
/// This completion looks to have the same string as an existing argument.
|
2022-05-31 01:53:32 +00:00
|
|
|
COMPLETE_DUPLICATES_ARGUMENT = 1 << 6,
|
2022-07-17 18:23:54 +00:00
|
|
|
/// This completes not just a token but replaces the entire commandline.
|
|
|
|
COMPLETE_REPLACES_COMMANDLINE = 1 << 7,
|
2012-02-26 02:54:49 +00:00
|
|
|
};
|
2022-05-31 01:53:32 +00:00
|
|
|
using complete_flags_t = uint8_t;
|
2008-01-13 19:32:21 +00:00
|
|
|
|
2023-10-08 21:22:27 +00:00
|
|
|
#if INCLUDE_RUST_HEADERS
|
|
|
|
#include "complete.rs.h"
|
|
|
|
#else
|
|
|
|
struct CompletionListFfi;
|
|
|
|
struct Completion;
|
|
|
|
struct CompletionRequestOptions;
|
|
|
|
#endif
|
2014-08-16 01:14:36 +00:00
|
|
|
|
2023-10-08 21:22:27 +00:00
|
|
|
using completion_t = Completion;
|
|
|
|
using completion_request_options_t = CompletionRequestOptions;
|
|
|
|
using completion_list_t = CompletionListFfi;
|
2018-02-16 05:58:02 +00:00
|
|
|
|
2005-10-04 15:11:39 +00:00
|
|
|
#endif
|