diff options
-rw-r--r-- | config.c | 1 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | signature-help.c | 10 | ||||
-rw-r--r-- | ted.cfg | 3 | ||||
-rw-r--r-- | ted.h | 4 |
5 files changed, 17 insertions, 3 deletions
@@ -259,6 +259,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}, + {"signature-help", &options_zero.signature_help, true}, {"lsp-enabled", &options_zero.lsp_enabled, true}, }; static OptionU8 const options_u8[] = { @@ -4,9 +4,7 @@ - hover - go to definition using LSP - find usages -- go through signature help capabilities - JSON syntax highlighting -- separate signature-help setting - check if there are any other non-optional/nice-to-have-support-for server-to-client requests - better non-error window/showMessage(Request) - document lsp.h and lsp.c. diff --git a/signature-help.c b/signature-help.c index 27f9203..3951c29 100644 --- a/signature-help.c +++ b/signature-help.c @@ -1,6 +1,8 @@ // deals with textDocument/signatureHelp LSP requests void signature_help_send_request(Ted *ted) { + Settings *settings = ted_active_settings(ted); + if (!settings->signature_help) return; TextBuffer *buffer = ted->active_buffer; if (!buffer) return; LSP *lsp = buffer_lsp(buffer); @@ -42,6 +44,9 @@ void signature_help_close(Ted *ted) { } void signature_help_process_lsp_response(Ted *ted, const LSPResponse *response) { + Settings *settings = ted_active_settings(ted); + if (!settings->signature_help) return; + if (response->request.type != LSP_REQUEST_SIGNATURE_HELP) return; SignatureHelp *help = &ted->signature_help; @@ -77,6 +82,10 @@ void signature_help_process_lsp_response(Ted *ted, const LSPResponse *response) } void signature_help_frame(Ted *ted) { + Settings *settings = ted_active_settings(ted); + if (!settings->signature_help) + return; + SignatureHelp *help = &ted->signature_help; if (help->retrigger) signature_help_send_request(ted); @@ -89,7 +98,6 @@ void signature_help_frame(Ted *ted) { if (!buffer) return; - Settings *settings = buffer_settings(buffer); u32 *colors = settings->colors; float border = settings->border_thickness; @@ -36,6 +36,9 @@ 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 +# display function signature help? (only with LSP running) +# this is the thing at the bottom of ted which shows the parameters to the function you're calling +signature-help = on # maximum editable file size. # ted will set the buffer to view-only if a file larger than this is loaded. # NOTE: ted is not really meant for absolutely massive files. @@ -172,6 +172,9 @@ typedef struct { } GlRcSAB; typedef struct { + // NOTE: to add more options to ted, add fields here, + // and change the options_<type> global constant in config.c + SettingsContext context; float cursor_blink_time_on, cursor_blink_time_off; u32 colors[COLOR_COUNT]; @@ -191,6 +194,7 @@ typedef struct { bool indent_with_spaces; bool trigger_characters; bool identifier_trigger_characters; + bool signature_help; bool lsp_enabled; u8 tab_width; u8 cursor_width; |