summaryrefslogtreecommitdiff
path: root/lsp.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-27 00:34:38 -0500
committerpommicket <pommicket@gmail.com>2022-12-27 00:34:38 -0500
commit53451f331667180e4b30c1ac0bf33bb48beb37f0 (patch)
tree4bb3c933441ecde2e899f4486b7f32d84f5cbb22 /lsp.c
parent85ee81b8ae972d17f0e3dc78657077924c047ada (diff)
better workspaceFolders idea ("withhold judgement")
Diffstat (limited to 'lsp.c')
-rw-r--r--lsp.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/lsp.c b/lsp.c
index e5bec71..a3e07e7 100644
--- a/lsp.c
+++ b/lsp.c
@@ -357,21 +357,14 @@ LSP *lsp_create(const char *root_dir, Language language, const char *analyzer_co
}
bool lsp_try_add_root_dir(LSP *lsp, const char *new_root_dir) {
+ assert(lsp->initialized);
+
bool got_it = false;
SDL_LockMutex(lsp->workspace_folders_mutex);
- if (!lsp->initialized) {
- // pretend we have workspace folder support until we get initialize response
- // (it's totally possible that this would be called with lsp->initialized = false,
- // e.g. if the user starts up ted with multiple files in different projects)
- // we'll fix things up when we get the initialize response if there's no actual support.
- arr_add(lsp->workspace_folders, lsp_document_id(lsp, new_root_dir));
- got_it = true;
- } else {
- arr_foreach_ptr(lsp->workspace_folders, LSPDocumentID, folder) {
- if (str_has_path_prefix(new_root_dir, lsp_document_path(lsp, *folder))) {
- got_it = true;
- break;
- }
+ arr_foreach_ptr(lsp->workspace_folders, LSPDocumentID, folder) {
+ if (str_has_path_prefix(new_root_dir, lsp_document_path(lsp, *folder))) {
+ got_it = true;
+ break;
}
}
SDL_UnlockMutex(lsp->workspace_folders_mutex);