Previously it depended on QODEASSIST_QT_CREATOR_VERSION_* flags being
passed to cmake during build process. Making it standalone saves time
for the users.
Contructing LLMClientInterface in constructor of QodeAssistClient when
initializing base class severely limits what can be done. In particular,
no members can be referred to, because nothing of the class instance
itself has been initialized at that point of time.
The same call is several lines below.
Note that systemPrompt does not need label due to a similarly named
checkbox placed nearby. Thus users intuitively know what the text box is
for.
Tests should have "before" and "after" cases side by side, so that it's
possible to easily verify that full context is extracted correctly.
Also tests should consistently cover the same conditions in all the
different scenarios.
getContextAfter(int lineNumber, int cursorPosition) and
getContextBefore(int lineNumber, int cursorPosition) are currently not
tested. Thus as little logic as possible should live there.
This also specifies what exactly getContext*() functions do. Before this
commit linesCount was sometimes interpreted as exclusive of current
line, which was confusing as linesCount + 1 lines were being returned.
Currently the current line is duplicated in both "before" and "after"
context. This is due to DocumentContextReader::readWholeFileAfter()
picking the current line part of which has been already included into
the "before" context.
chore: Add unit tests for DocumentContextReader
The tests are based on GTest like some tests in Qt Creator itself, which
makes it easy to run as full Qt Creator does not need to be started.
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 a result of the following commands:
clang-format-19 --style=file -i $(git ls-files | fgrep .cpp)
clang-format-19 --style=file -i $(git ls-files | fgrep .hpp)
This will allow to add code conditional on the Qt Creator version to the
plugin codebase. The Qt Creator version will be passed from the build
script automatically. This will also allow to easily extend the Github
Actions job matrix to create releases for more than one Qt Creator
version.
Using QT_VERSION_CHECK allows to reuse existing Qt patterns of checking
versions.
Code has been tested by invoking QODEASSIST_QT_CREATOR_VERSION in code.
Currently on Linux most dialogs follow the following order of action
buttons: "OK", "Cancel" (left to right). However, several dialogs are
constructed explicitly and don't follow this convention.
This commit fixes this discrepancy.
Fixes: https://github.com/Palm1r/QodeAssist/issues/83
This commit is a result of the following commands:
clang-format-19 --style=file -i $(git ls-files | fgrep .cpp)
clang-format-19 --style=file -i $(git ls-files | fgrep .hpp)