summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c1
-rw-r--r--main.c2
-rw-r--r--signature-help.c10
-rw-r--r--ted.cfg3
-rw-r--r--ted.h4
5 files changed, 17 insertions, 3 deletions
diff --git a/config.c b/config.c
index 0b9c396..ecd1cb2 100644
--- a/config.c
+++ b/config.c
@@ -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[] = {
diff --git a/main.c b/main.c
index 9cd5d27..b73122f 100644
--- a/main.c
+++ b/main.c
@@ -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;
diff --git a/ted.cfg b/ted.cfg
index fd0efa1..a58888d 100644
--- a/ted.cfg
+++ b/ted.cfg
@@ -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.
diff --git a/ted.h b/ted.h
index 8952e76..befc4e2 100644
--- a/ted.h
+++ b/ted.h
@@ -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;