robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. Keyesfeat(marks): :marks completion, list extmarks #40743671e9d4913

master
4.2 KiB140 linesraw
1#pragma once
2
3#include <stdbool.h>
4#include <stddef.h>
5
6#include "nvim/eval/typval_defs.h"
7#include "nvim/pos_defs.h"
8#include "nvim/vim_defs.h"
9
10typedef enum {
11  XP_PREFIX_NONE,  ///< prefix not used
12  XP_PREFIX_NO,    ///< "no" prefix for bool option
13  XP_PREFIX_INV,   ///< "inv" prefix for bool option
14} xp_prefix_T;
15
16enum { EXPAND_BUF_LEN = 256, };
17
18/// used for completion on the command line
19typedef struct {
20  char *xp_pattern;             ///< start of item to expand, guaranteed
21                                ///< to be part of xp_line
22  int xp_context;               ///< type of expansion
23  size_t xp_pattern_len;        ///< bytes in xp_pattern before cursor
24  xp_prefix_T xp_prefix;
25  char *xp_arg;                 ///< completion function
26  LuaRef xp_luaref;             ///< Ref to Lua completion function
27  sctx_T xp_script_ctx;         ///< SCTX for completion function
28  int xp_backslash;             ///< one of the XP_BS_ values
29#ifndef BACKSLASH_IN_FILENAME
30  bool xp_shell;                ///< true for a shell command, more
31                                ///< characters need to be escaped
32#endif
33  int xp_numfiles;              ///< number of files found by file name completion
34  int xp_col;                   ///< cursor position in line
35  int xp_selected;              ///< selected index in completion
36  char *xp_orig;                ///< originally expanded string
37  char **xp_files;              ///< list of files
38  char **xp_files_abbr;         ///< optional parallel array of display
39                                ///< strings (override xp_files for the
40                                ///< pum text); NULL if unused
41  char **xp_files_kind;         ///< optional parallel array of "kind"
42                                ///< strings; NULL if unused
43  char **xp_files_menu;         ///< optional parallel array of "menu"
44                                ///< strings (shown after the match);
45                                ///< NULL if unused
46  char **xp_files_info;         ///< optional parallel array of "info"
47                                ///< strings (shown in info popup);
48                                ///< NULL if unused
49  char *xp_line;                ///< text being completed
50  char xp_buf[EXPAND_BUF_LEN];  ///< buffer for returned match
51  Direction xp_search_dir;      ///< Direction of search
52  pos_T xp_pre_incsearch_pos;   ///< Cursor position before incsearch
53} expand_T;
54
55/// values for xp_backslash
56enum {
57  XP_BS_NONE  = 0,    ///< nothing special for backslashes
58  XP_BS_ONE   = 0x1,  ///< uses one backslash before a space
59  XP_BS_THREE = 0x2,  ///< uses three backslashes before a space
60  XP_BS_COMMA = 0x4,  ///< commas need to be escaped with a backslash
61};
62
63/// values for xp_context when doing command line completion
64enum {
65  EXPAND_UNSUCCESSFUL = -2,
66  EXPAND_OK = -1,
67  EXPAND_NOTHING = 0,
68  EXPAND_COMMANDS,
69  EXPAND_FILES,
70  EXPAND_DIRECTORIES,
71  EXPAND_SETTINGS,
72  EXPAND_BOOL_SETTINGS,
73  EXPAND_TAGS,
74  EXPAND_OLD_SETTING,
75  EXPAND_HELP,
76  EXPAND_BUFFERS,
77  EXPAND_EVENTS,
78  EXPAND_MENUS,
79  EXPAND_SYNTAX,
80  EXPAND_HIGHLIGHT,
81  EXPAND_AUGROUP,
82  EXPAND_USER_VARS,
83  EXPAND_MAPPINGS,
84  EXPAND_TAGS_LISTFILES,
85  EXPAND_FUNCTIONS,
86  EXPAND_USER_FUNC,
87  EXPAND_EXPRESSION,
88  EXPAND_MENUNAMES,
89  EXPAND_USER_COMMANDS,
90  EXPAND_USER_CMD_FLAGS,
91  EXPAND_USER_NARGS,
92  EXPAND_USER_COMPLETE,
93  EXPAND_ENV_VARS,
94  EXPAND_LANGUAGE,
95  EXPAND_COLORS,
96  EXPAND_COMPILER,
97  EXPAND_USER_DEFINED,
98  EXPAND_USER_LIST,
99  EXPAND_USER_LUA,
100  EXPAND_SHELLCMD,
101  EXPAND_SIGN,
102  EXPAND_PROFILE,
103  EXPAND_FILETYPE,
104  EXPAND_FILES_IN_PATH,
105  EXPAND_OWNSYNTAX,
106  EXPAND_LOCALES,
107  EXPAND_HISTORY,
108  EXPAND_USER,
109  EXPAND_SYNTIME,
110  EXPAND_USER_ADDR_TYPE,
111  EXPAND_PACKADD,
112  EXPAND_MESSAGES,
113  EXPAND_MAPCLEAR,
114  EXPAND_ARGLIST,
115  EXPAND_DIFF_BUFFERS,
116  // EXPAND_DISASSEMBLE,
117  EXPAND_BREAKPOINT,
118  EXPAND_SCRIPTNAMES,
119  EXPAND_RUNTIME,
120  EXPAND_STRING_SETTING,
121  EXPAND_SETTING_SUBTRACT,
122  EXPAND_ARGOPT,
123  EXPAND_KEYMAP,
124  EXPAND_DIRS_IN_CDPATH,
125  EXPAND_SHELLCMDLINE,
126  EXPAND_FINDFUNC,
127  EXPAND_FILETYPECMD,
128  EXPAND_PATTERN_IN_BUF,
129  EXPAND_RETAB,
130  EXPAND_CHECKHEALTH,
131  EXPAND_LUA,
132  EXPAND_LSP,
133  EXPAND_LOG,
134  EXPAND_PACKDEL,
135  EXPAND_PACKUPDATE,
136  EXPAND_MARKS,
137};
138
139/// Type used by ExpandGeneric()
140typedef char *(*CompleteListItemGetter)(expand_T *, int);