summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-08 17:17:35 -0400
committerpommicket <pommicket@gmail.com>2023-09-08 17:18:51 -0400
commit100859239a28c2709bb3e2cdce347300a2b763e2 (patch)
treeb45486fe7c2a3318d9702adbe17ce17b672a78d1 /ted.c
parent49f22fb75ae7ec5ffa98532c060d81e18d71575c (diff)
LSP over TCP initial draft
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ted.c b/ted.c
index ec04e0b..a21c317 100644
--- a/ted.c
+++ b/ted.c
@@ -245,7 +245,8 @@ LSP *ted_get_lsp(Ted *ted, const char *path, Language language) {
for (i = 0; i < TED_LSP_MAX; ++i) {
LSP *lsp = ted->lsps[i];
if (!lsp) break;
- if (!streq(lsp->command, settings->lsp)) continue;
+ if (lsp->command && !streq(lsp->command, settings->lsp)) continue;
+ if (lsp->port != settings->lsp_port) continue;
if (!lsp->initialized) {
// withhold judgement until this server initializes.
@@ -266,11 +267,12 @@ 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???
- if (*settings->lsp) {
+ if (*settings->lsp || settings->lsp_port) {
// start up this LSP
FILE *log = settings->lsp_log ? ted->log : NULL;
char *root_dir = settings_get_root_dir(settings, path);
- ted->lsps[i] = lsp_create(root_dir, settings->lsp, settings->lsp_configuration, log);
+ ted->lsps[i] = lsp_create(root_dir, *settings->lsp ? settings->lsp : NULL,
+ settings->lsp_port, settings->lsp_configuration, log);
free(root_dir);
// don't actually return it yet, since it's still initializing (see above)
}