diff --git a/include/lspserv.h b/include/lspserv.h index 286c75b6c..d4b22dbda 100644 --- a/include/lspserv.h +++ b/include/lspserv.h @@ -175,6 +175,8 @@ namespace AsymptoteLsp unique_ptr symmapContextsPtr; unique_ptr>> fileContentsPtr; std::string plainFile; + + std::mutex onChangeMutex; }; class TCPAsymptoteLSPServer : public lsp::TcpServer, public AsymptoteLspServer diff --git a/src/lspserv.cc b/src/lspserv.cc index 328cf9e47..df3aa11ac 100644 --- a/src/lspserv.cc +++ b/src/lspserv.cc @@ -317,6 +317,7 @@ std::string wslUnix2Dos(std::string const& unixPath) void AsymptoteLspServer::onChange(Notify_TextDocumentDidChange::notify& notify) { + std::lock_guard lk(onChangeMutex); logInfo("text change notification"); auto& fileChange = notify.params.contentChanges;