Fix lsp bugs

- Fix: Incorrect setting of incremental edits for lsp and more
This commit is contained in:
2025-12-27 09:53:46 +00:00
parent bfaba81317
commit 6108f78be3
8 changed files with 145 additions and 44 deletions

View File

@@ -29,28 +29,33 @@ struct LSPInstance {
int pid{-1};
int stdin_fd{-1};
int stdout_fd{-1};
bool initialized = false;
bool incremental_sync = true;
std::atomic<bool> initialized = false;
std::atomic<bool> exited = false;
bool incremental_sync = false;
uint32_t last_id = 0;
Queue<json> inbox;
Queue<json> outbox;
Queue<std::pair<Language, Editor *>> open_queue;
std::unordered_map<uint32_t, LSPPending *> pending;
std::vector<Editor *> editors;
};
extern std::shared_mutex active_lsps_mtx;
extern std::unordered_map<uint8_t, LSPInstance *> active_lsps;
extern std::unordered_map<uint8_t, std::shared_ptr<LSPInstance>> active_lsps;
void lsp_worker();
void lsp_handle(LSPInstance *lsp, json message);
void lsp_handle(std::shared_ptr<LSPInstance> lsp, json message);
LSPInstance *get_or_init_lsp(uint8_t lsp_id);
std::shared_ptr<LSPInstance> get_or_init_lsp(uint8_t lsp_id);
void close_lsp(uint8_t lsp_id);
void request_add_to_lsp(Language language, Editor *editor);
void open_editor(std::shared_ptr<LSPInstance> lsp,
std::pair<Language, Editor *> entry);
void add_to_lsp(Language language, Editor *editor);
void remove_from_lsp(Editor *editor);
void lsp_send(LSPInstance *lsp, json message, LSPPending *pending);
void lsp_send(std::shared_ptr<LSPInstance> lsp, json message,
LSPPending *pending);
#endif