diff options
author | pommicket <pommicket@gmail.com> | 2022-12-30 14:40:47 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-30 14:40:47 -0500 |
commit | f2c8a3a77fdd7f397e04edcaf5dae5e7777f03b6 (patch) | |
tree | 337883c076b415fa50983a2cf3b5335aafded2e9 /ted.c | |
parent | 91fc9b10e1700b482b13af1d25d95d80085a9b79 (diff) |
better ted_active_lsp, fix memory bug
Diffstat (limited to 'ted.c')
-rw-r--r-- | ted.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -144,8 +144,16 @@ LSP *ted_get_lsp(Ted *ted, const char *path, Language language) { } LSP *ted_active_lsp(Ted *ted) { - if (!ted->active_buffer) + if (!ted->active_buffer) { + char *root = ted_get_root_dir(ted); + for (int i = 0; ted->lsps[i]; ++i) { + LSP *lsp = ted->lsps[i]; + if (lsp_covers_path(lsp, root)) + return lsp; + } + free(root); return NULL; + } return buffer_lsp(ted->active_buffer); } |