diff options
Diffstat (limited to 'ted.h')
-rw-r--r-- | ted.h | 39 |
1 files changed, 35 insertions, 4 deletions
@@ -352,7 +352,39 @@ typedef struct { u32 build_output_line; // which line in the build output corresponds to this error } BuildError; +// LSPSymbolKinds are translated to these. this is a much coarser categorization +typedef enum { + SYMBOL_OTHER, + SYMBOL_FUNCTION, + SYMBOL_FIELD, + SYMBOL_TYPE, + SYMBOL_VARIABLE, + SYMBOL_CONSTANT, + SYMBOL_KEYWORD +} SymbolKind; + +typedef struct { + char *label; + char *filter; + char *text; + char *detail; // this can be NULL! + SymbolKind kind; +} Autocompletion; + +typedef struct { + bool open; // is the autocomplete window open? + bool waiting_for_lsp; + + Autocompletion *completions; // dynamic array of all completions + u32 *suggested; // dynamic array of completions to be suggested (indices into completions) + BufferPos last_pos; // position of cursor last time completions were generated. if this changes, we need to recompute completions. + i32 cursor; // which completion is currently selected (index into suggested) + Rect rect; // rectangle where the autocomplete menu is (needed to avoid interpreting autocomplete clicks as other clicks) +} Autocomplete; + typedef struct Ted { + struct LSP *test_lsp; // @TODO: something better + SDL_Window *window; Font *font_bold; Font *font; @@ -401,10 +433,7 @@ typedef struct Ted { Command warn_unsaved; // if non-zero, the user is trying to execute this command, but there are unsaved changes bool build_shown; // are we showing the build output? bool building; // is the build process running? - bool autocomplete; // is the autocomplete window open? - - i32 autocomplete_cursor; // which completion is currently selected - Rect autocomplete_rect; // rectangle where the autocomplete menu is (needed to avoid interpreting autocomplete clicks as other clicks) + Autocomplete autocomplete; FILE *log; @@ -466,11 +495,13 @@ typedef struct Ted { char error_shown[512]; // error display in box on screen } Ted; +void autocomplete_close(Ted *ted); void command_execute(Ted *ted, Command c, i64 argument); void ted_switch_to_buffer(Ted *ted, TextBuffer *buffer); // the settings of the active buffer, or the default settings if there is no active buffer Settings *ted_active_settings(Ted *ted); void ted_load_configs(Ted *ted, bool reloading); +struct LSP *ted_get_lsp(Ted *ted, Language lang); static TextBuffer *find_search_buffer(Ted *ted); // first, we read all config files, then we parse them. // this is because we want less specific settings (e.g. settings applied |