diff --git a/CodeHandler.cpp b/CodeHandler.cpp index 96eda5f..3b1b22c 100644 --- a/CodeHandler.cpp +++ b/CodeHandler.cpp @@ -22,12 +22,8 @@ namespace QodeAssist { -QString CodeHandler::processText(QString text, bool smartProcess) +QString CodeHandler::processText(QString text) { - if (!smartProcess) { - return text; - } - QString result; QStringList lines = text.split('\n'); bool inCodeBlock = false; diff --git a/CodeHandler.hpp b/CodeHandler.hpp index 747b1f4..dfc86b9 100644 --- a/CodeHandler.hpp +++ b/CodeHandler.hpp @@ -28,7 +28,7 @@ namespace QodeAssist { class CodeHandler { public: - static QString processText(QString text, bool smartProcess = true); + static QString processText(QString text); static QString detectLanguage(const QString &line); diff --git a/LLMClientInterface.cpp b/LLMClientInterface.cpp index d830215..370bb05 100644 --- a/LLMClientInterface.cpp +++ b/LLMClientInterface.cpp @@ -293,9 +293,11 @@ void LLMClientInterface::sendCompletionToClient( LOG_MESSAGE(QString("Completions before filter: \n%1").arg(completion)); - bool smartProcess = promptTemplate->type() == LLMCore::TemplateType::Chat - && Settings::codeCompletionSettings().smartProcessInstuctText(); - QString processedCompletion = CodeHandler::processText(completion, smartProcess); + QString processedCompletion + = promptTemplate->type() == LLMCore::TemplateType::Chat + && Settings::codeCompletionSettings().smartProcessInstuctText() + ? CodeHandler::processText(completion) + : completion; completionItem[LanguageServerProtocol::textKey] = processedCompletion; QJsonObject range; diff --git a/test/CodeHandlerTest.cpp b/test/CodeHandlerTest.cpp index c0864a9..570fc92 100644 --- a/test/CodeHandlerTest.cpp +++ b/test/CodeHandlerTest.cpp @@ -33,15 +33,6 @@ class CodeHandlerTest : public QObject, public testing::Test Q_OBJECT }; -TEST_F(CodeHandlerTest, testProcessTextNoProcessWithCodeBlock) -{ - QString input = "This is a comment\n" - "```python\nprint('Hello, world!')\n```\n" - "Another comment"; - - EXPECT_EQ(CodeHandler::processText(input, false), input); -} - TEST_F(CodeHandlerTest, testProcessTextWithCodeBlock) { QString input = "This is a comment\n"