fix: Improve support for code blocks without language (#108)

This makes it possible to represent code blocks in models that emit
their suggestion immediately after the ``` characters.
This commit is contained in:
Povilas Kanapickas
2025-03-07 16:30:22 +02:00
committed by GitHub
parent 9a5047618d
commit f94c79a5ff
4 changed files with 265 additions and 88 deletions

View File

@ -28,9 +28,17 @@ namespace QodeAssist {
class CodeHandler
{
public:
static QString processText(QString text);
static QString processText(QString text, QString currentFileName);
static QString detectLanguage(const QString &line);
/**
* Detects language from line, or returns empty string if this was not possible
*/
static QString detectLanguageFromLine(const QString &line);
/**
* Detects language file name, or returns empty string if this was not possible
*/
static QString detectLanguageFromExtension(const QString &extension);
private:
static QString getCommentPrefix(const QString &language);