Skip to content

Commit

Permalink
LSP: Add mutex to on change to ensure changes are not done concurrently.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamievlin committed Apr 20, 2024
1 parent 4ba87c6 commit 7ed3444
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/lspserv.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ namespace AsymptoteLsp
unique_ptr<SymContextFilemap> symmapContextsPtr;
unique_ptr<unordered_map<std::string, std::vector<std::string>>> fileContentsPtr;
std::string plainFile;

std::mutex onChangeMutex;
};

class TCPAsymptoteLSPServer : public lsp::TcpServer, public AsymptoteLspServer
Expand Down
1 change: 1 addition & 0 deletions src/lspserv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7ed3444

Please sign in to comment.