Add settings for cache of changes

This commit is contained in:
Petr Mironychev
2024-09-11 01:59:25 +02:00
parent 2fb876ff00
commit 8e052ff45c
7 changed files with 32 additions and 10 deletions

View File

@ -19,6 +19,7 @@
#include "ChangesManager.h"
#include "QodeAssistUtils.hpp"
#include "settings/ContextSettings.hpp"
namespace QodeAssist {
@ -60,7 +61,7 @@ void ChangesManager::addChange(TextEditor::TextDocument *document,
} else {
documentQueue.enqueue(change);
if (documentQueue.size() > MAX_CACHED_CHANGES) {
if (documentQueue.size() > Settings::contextSettings().maxChangesCacheSize()) {
documentQueue.dequeue();
}
}

View File

@ -54,7 +54,6 @@ private:
ChangesManager &operator=(const ChangesManager &) = delete;
void cleanupOldChanges();
static const int MAX_CACHED_CHANGES = 50;
QHash<TextEditor::TextDocument *, QQueue<ChangeInfo>> m_documentChanges;
};