summaryrefslogtreecommitdiff
path: root/ted.h
diff options
context:
space:
mode:
Diffstat (limited to 'ted.h')
-rw-r--r--ted.h43
1 files changed, 39 insertions, 4 deletions
diff --git a/ted.h b/ted.h
index e204b17..f7d79ae 100644
--- a/ted.h
+++ b/ted.h
@@ -183,6 +183,8 @@ typedef struct {
bool restore_session;
bool regenerate_tags_if_not_found;
bool indent_with_spaces;
+ bool trigger_characters;
+ bool identifier_trigger_characters;
u8 tab_width;
u8 cursor_width;
u8 undo_save_time;
@@ -352,7 +354,41 @@ 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!
+ char *documentation; // this can be NULL!
+ bool deprecated;
+ 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 +437,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 +499,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