summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-23 21:43:07 -0500
committerpommicket <pommicket@gmail.com>2022-12-23 21:43:07 -0500
commit8d96a4b0f0ebb059a63cc4c3193e0169ccf4f5b5 (patch)
tree7155b5d90b9eb8836fa637ed1db44f4e3304fdba /ted.c
parentaabe543ee93796330158fa7fd247fb1ebeb8e3bb (diff)
framework for having multiple/configurable LSPs
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ted.c b/ted.c
index c9ac007..8bc4f18 100644
--- a/ted.c
+++ b/ted.c
@@ -66,9 +66,15 @@ Settings *ted_active_settings(Ted *ted) {
return settings;
}
-LSP *ted_get_lsp(Ted *ted, Language lang) {
- // @TODO
- return ted->test_lsp;
+LSP *ted_get_lsp(Ted *ted, const char *path, Language lang) {
+ for (int i = 0; i < TED_LSP_MAX; ++i) {
+ LSP *lsp = ted->lsps[i];
+ if (!lsp) break;
+ if (lsp->language != lang) continue;
+ if (!str_has_prefix(path, lsp->root_dir)) continue;
+ return lsp;
+ }
+ return NULL;
}
LSP *ted_get_active_lsp(Ted *ted) {