summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-27 13:04:50 -0500
committerpommicket <pommicket@gmail.com>2022-12-27 13:04:50 -0500
commit27b8b36aea3bb5913a600bc7e5b41f68557c2587 (patch)
tree1c03dfff45503c9ad2f745a66365a84cb7d2935d /ted.c
parent53451f331667180e4b30c1ac0bf33bb48beb37f0 (diff)
fixed previous issues, + "save as" should now work
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ted.c b/ted.c
index 825ab36..75a2246 100644
--- a/ted.c
+++ b/ted.c
@@ -95,6 +95,14 @@ Settings *ted_get_settings(Ted *ted, const char *path, Language language) {
return settings;
}
+LSP *ted_get_lsp_by_id(Ted *ted, LSPID id) {
+ for (int i = 0; ted->lsps[i]; ++i) {
+ if (ted->lsps[i]->id == id)
+ return ted->lsps[i];
+ }
+ return NULL;
+}
+
// IMPORTANT NOTE ABOUT CACHING LSPs:
// - be careful if you want to cache LSPs, e.g. adding a LSP *lsp member to `buffer`.
// - right now we pretend that the server has workspace folder support until the initialize response is sent.
@@ -134,7 +142,7 @@ LSP *ted_get_lsp(Ted *ted, const char *path, Language language) {
char *root_dir = settings_get_root_dir(settings, path);
ted->lsps[i] = lsp_create(root_dir, language, settings->lsp);
free(root_dir);
- return ted->lsps[i];
+ // don't actually return it yet, since it's still initializing (see above)
}
return NULL;