mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-07-18 04:54:30 -04:00
refactor: Make DocumentContextReader usable outside Qt Creator context (#89)
This makes it possible to write simple unit tests for it without running full Qt Creator. Not coupling DocumentContextReader to TextEditor::TextDocument unnecessarily is also a better design in general.
This commit is contained in:
committed by
GitHub
parent
29a3939c64
commit
bcf7b6c226
@ -36,7 +36,8 @@ struct CopyrightInfo
|
||||
class DocumentContextReader
|
||||
{
|
||||
public:
|
||||
DocumentContextReader(TextEditor::TextDocument *textDocument);
|
||||
DocumentContextReader(
|
||||
QTextDocument *m_document, const QString &mimeType, const QString &filePath);
|
||||
|
||||
QString getLineText(int lineNumber, int cursorPosition = -1) const;
|
||||
QString getContextBefore(int lineNumber, int cursorPosition, int linesCount) const;
|
||||
@ -58,6 +59,8 @@ private:
|
||||
private:
|
||||
TextEditor::TextDocument *m_textDocument;
|
||||
QTextDocument *m_document;
|
||||
QString m_mimeType;
|
||||
QString m_filePath;
|
||||
CopyrightInfo m_copyrightInfo;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user