diff options
author | pommicket <pommicket@gmail.com> | 2022-12-27 00:34:38 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-27 00:34:38 -0500 |
commit | 53451f331667180e4b30c1ac0bf33bb48beb37f0 (patch) | |
tree | 4bb3c933441ecde2e899f4486b7f32d84f5cbb22 /lsp.c | |
parent | 85ee81b8ae972d17f0e3dc78657077924c047ada (diff) |
better workspaceFolders idea ("withhold judgement")
Diffstat (limited to 'lsp.c')
-rw-r--r-- | lsp.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -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); |