diff options
author | pommicket <pommicket@gmail.com> | 2022-12-25 21:55:42 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-25 21:55:42 -0500 |
commit | 9602ae4d8582c3ccdb9e8c1561ad306491713be4 (patch) | |
tree | f3f02a332daa19ace69dbc9c0a9a63be85a41ad9 | |
parent | 4bd6bbe54b291d8d65997e998a2a3946293adcdf (diff) |
global lsp-enabled setting
-rw-r--r-- | config.c | 7 | ||||
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | ted.c | 5 | ||||
-rw-r--r-- | ted.cfg | 7 | ||||
-rw-r--r-- | ted.h | 1 |
5 files changed, 15 insertions, 6 deletions
@@ -251,6 +251,7 @@ static OptionBool const options_bool[] = { {"indent-with-spaces", &options_zero.indent_with_spaces, true}, {"trigger-characters", &options_zero.trigger_characters, true}, {"identifier-trigger-characters", &options_zero.identifier_trigger_characters, true}, + {"lsp-enabled", &options_zero.lsp_enabled, true}, }; static OptionU8 const options_u8[] = { {"tab-width", &options_zero.tab_width, 1, 100, true}, @@ -778,11 +779,11 @@ static void config_parse_line(ConfigReader *cfg, Settings *settings, const Confi bool const is_floating = *endptr == '\0'; bool is_bool = false; bool boolean = false; - #define BOOL_HELP "(should be yes/no/on/off)" - if (streq(value, "yes") || streq(value, "on")) { + #define BOOL_HELP "(should be yes/no/on/off/true/false)" + if (streq(value, "yes") || streq(value, "on") || streq(value, "true")) { is_bool = true; boolean = true; - } else if (streq(value, "no") || streq(value, "off")) { + } else if (streq(value, "no") || streq(value, "off") || streq(value, "false")) { is_bool = true; boolean = false; } @@ -34,6 +34,7 @@ FUTURE FEATURES: - plugins? - keyboard macros - ctrl+9/0 to inc/dec number would be useful here + - with macros we can really test performance of buffer_insert_text_at_pos, etc. (which should ideally be fast) */ #include "base.h" @@ -92,6 +92,10 @@ Settings *ted_get_settings(Ted *ted, const char *path, Language language) { } LSP *ted_get_lsp(Ted *ted, const char *path, Language language) { + Settings *settings = ted_get_settings(ted, path, language); + if (!settings->lsp_enabled) + return NULL; + int i; for (i = 0; i < TED_LSP_MAX; ++i) { LSP *lsp = ted->lsps[i]; @@ -105,7 +109,6 @@ LSP *ted_get_lsp(Ted *ted, const char *path, Language language) { } if (i == TED_LSP_MAX) return NULL; // why are there so many LSP open??? - Settings *settings = ted_get_settings(ted, path, language); if (*settings->lsp) { // start up this LSP char *root_dir = settings_get_root_dir(settings, path); @@ -33,6 +33,9 @@ restore-session = on trigger-characters = on # should all identifier characters (e.g. a-z) be treated as trigger characters? identifier-trigger-characters = off +# enable LSP support (for autocompletion, etc.) +# you can also set `lsp = ""` but this is a quick way to disable LSP servers for all langauges +lsp-enabled = yes # search depth for files to generate tags for. # if set to 0, tag generation/regeneration will do nothing @@ -40,7 +43,7 @@ tags-max-depth = 2 # regenerate tags if an identifier is not found (with Ctrl+click)? regenerate-tags-if-not-found = yes # this variable determines how ted finds the "root directory" of a project for -# running build commands and because LSPs need to know +# running build commands and because LSP servers need to know # FOR EXAMPLE: If you have the file /a/b/c/d.txt open, # ted will check each of the directories /, /a, /a/b, /a/b/c # and set the root to whichever one has one of these files, @@ -123,7 +126,7 @@ Ctrl+a = :select-all Tab = :tab Shift+Tab = :backtab Enter = :newline -# same as :newline for normal text insertion, but goes to the previous search result instead of the next one +# same as :newline for normal text insertion, but goes to the previous search result instead of the next one for find+replace Shift+Enter = :newline-back Keypad Enter = :newline Shift+Keypad Enter = :newline-back @@ -187,6 +187,7 @@ typedef struct { bool indent_with_spaces; bool trigger_characters; bool identifier_trigger_characters; + bool lsp_enabled; u8 tab_width; u8 cursor_width; u8 undo_save_time; |