Commit Graph

307 Commits

Author SHA1 Message Date
Povilas Kanapickas
8a1fd5438e
chore: Add tests for LLMClientInterface (#131) 2025-03-10 21:54:17 +01:00
Povilas Kanapickas
78f69e82a5
chore: Checkout submodules when building (#133) 2025-03-10 19:17:30 +01:00
Povilas Kanapickas
3d770f91c7
refactor: Reduce dependency on TextDocument in ContextManager (#128) 2025-03-10 18:06:19 +01:00
Povilas Kanapickas
c724bace06
refactor: Move document access out of prepareContext() (#129) 2025-03-10 17:54:03 +01:00
Povilas Kanapickas
719065ebfc
refactor: Extract document reading to separate class (#127)
This decouples LLMClientInterface from Qt Creator text editor
implementation and allows to write tests
2025-03-10 17:42:40 +01:00
Povilas Kanapickas
a218064a4f
refactor: Introduce base class for RequestHandler (#125)
This will make it possible to write a mock implementation.
2025-03-10 17:29:45 +01:00
Povilas Kanapickas
13cd12b00a
chore: Add 3rdparty/inja dependency (#126) 2025-03-10 17:28:25 +01:00
Povilas Kanapickas
ed59be4199
refactor: Extract performance logging to separate class (#124)
This should not be responsibility of LLMClientInterface. Extracting this
class also adds flexibility to silence logging output in tests.
2025-03-10 17:10:01 +01:00
Povilas Kanapickas
7dd8b3d085
fix: Make build CMakeLists.txt standalone (#123)
Previously it depended on QODEASSIST_QT_CREATOR_VERSION_* flags being
passed to cmake during build process. Making it standalone saves time
for the users.
2025-03-10 17:00:07 +01:00
Povilas Kanapickas
3839d6896c
refactor: Pass LLMClientInterface to QodeAssistClient (#122)
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.
2025-03-10 16:56:27 +01:00
Petr Mironychev
6b86637dcb
doc: Add llama.cpp description to README.md 2025-03-10 12:07:39 +01:00
Povilas Kanapickas
58c3e26e7f
refactor: Decouple LLMClientInterface from ProvidersManager (#120)
This will be needed for tests.
2025-03-10 10:40:51 +01:00
Povilas Kanapickas
98e1047bf1
refactor: Decouple prompt template manager from their users (#115)
This makes it possible to test the user classes
2025-03-10 02:13:10 +01:00
Petr Mironychev
b6f36d61ae
fix: Replace ubuntu-latest to ubuntu 22.04 (#119) 2025-03-10 01:33:03 +01:00
Petr Mironychev
f2f453ccc8 chore: Upgrade plugin to 0.5.1 2025-03-10 01:00:33 +01:00
Petr Mironychev
1bcfd749d5 fix: Change OpenAI model parser conditions 2025-03-10 00:47:16 +01:00
Petr Mironychev
e66f467214
feat: Add llama.cpp provider and fim template (#118) 2025-03-09 22:57:33 +01:00
Povilas Kanapickas
c9a3cdaf25
refactor: Reuse extractFilePathFromRequest() more (#117) 2025-03-08 16:18:44 +01:00
Povilas Kanapickas
7c483f89cd
chore: Replace deprecated FilePath::toString() with toFSPathString() (#116)
This solves a number of deprecation warnings during build.
FilePath::toFSPathString() has been available since couple of years ago.
2025-03-08 16:08:33 +01:00
Povilas Kanapickas
6c323642e4
refactor: Inject settings into LLMClientInterface (#114)
This reduces reliance on global state and makes it more possible to test
the code.
2025-03-08 15:08:15 +01:00
Povilas Kanapickas
3a494d5254
chore: Remove duplicate label setting for systemPromptForNonFimModels (#111)
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.
2025-03-08 10:40:22 +01:00
Povilas Kanapickas
44b3b0cc0c
refactor: Don't use global state in ContextManager::isSpecifyCompletion (#112)
Using global state makes testing things way harder.
2025-03-08 10:38:52 +01:00
Povilas Kanapickas
3aae923d43
feat: Improve describe recent changes in system prompt (#113)
Co-authored-by: Petr Mironychev <9195189+Palm1r@users.noreply.github.com>
2025-03-08 08:58:28 +01:00
Povilas Kanapickas
f94c79a5ff
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.
2025-03-07 15:30:22 +01:00
Povilas Kanapickas
9a5047618d
chore: Silence Qt warnings during tests (#110) 2025-03-07 01:58:09 +01:00
Povilas Kanapickas
90beebf2ee
Revert "refactor: Move all processing logic to CodeHandler::processText()" (#109) 2025-03-07 01:57:13 +01:00
Povilas Kanapickas
521261e0a3
refactor: Move all processing logic to CodeHandler::processText() (#107)
This will become useful once more processing modes are available
2025-03-06 18:49:28 +01:00
Povilas Kanapickas
5536de146c
chore: Remove dead code in RequestHandler (#106) 2025-03-06 14:19:01 +01:00
Povilas Kanapickas
81ac3c71fb
chore: Add tests for CodeHandler (#105)
* chore: Extract test utils to separate file

This makes it possible to reuse the utils in other test files.

* chore: Add tests for CodeHandler
2025-03-06 13:45:12 +01:00
Povilas Kanapickas
61ca5c9a1b
fix: Properly omit copyright information (#103)
This commit ensures that copyright information is always excluded and
that context is always split into prefix and suffix at correct position.
2025-03-06 13:00:15 +01:00
Povilas Kanapickas
8a167bf248
chore: Expand DocumentContextReaderTest to cover more conditions (#102)
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.
2025-03-06 12:08:57 +01:00
Povilas Kanapickas
ab97f39ea4
chore: Fix pretty printing for QString (#101)
Previously QString was printed symbol by symbol. E.g.:

reader.readWholeFileAfter(3, 1)
    Which is: { "i", "n", "e", " ", "2", "
", "L", "i", "n", "e", " ", "3" }
2025-03-06 12:08:16 +01:00
Petr Mironychev
0d3493e7f6
feat: Change linux build base to ubuntu 22.04 (#99) 2025-03-06 11:55:04 +01:00
Povilas Kanapickas
1d062e1fe4
chore: Use zero-based line numbers in tests (#100)
This makes the line index arguments passed to functions match the actual
test data, thus tests are less confusing.
2025-03-06 11:53:27 +01:00
Povilas Kanapickas
5dceb5cd19
fix: Bring back old behavior of readStrings{After,Before}Cursor setting (#97) 2025-03-05 20:27:16 +01:00
Povilas Kanapickas
69a8aa80d9
refactor: Make DocumentContextReader::prepareContext() testable (#96) 2025-03-05 20:18:59 +01:00
Povilas Kanapickas
e218699e64
refactor: Reuse getContext{Before,After}() instead of duplicating logic (#95)
getContextAfter(int lineNumber, int cursorPosition) and
getContextBefore(int lineNumber, int cursorPosition) are currently not
tested. Thus as little logic as possible should live there.
2025-03-05 19:43:51 +01:00
Povilas Kanapickas
3dc0d910bf
fix: Fix off by one errors in getContext{Before,After}() (#94)
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.
2025-03-05 19:32:53 +01:00
Povilas Kanapickas
f9f2a86cea
fix: Correctly pick whole file context (#85)
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.
2025-03-05 19:17:51 +01:00
Povilas Kanapickas
247256d4a4
chore: Add unit tests for DocumentContextReader (#90)
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.
2025-03-05 15:01:52 +01:00
Povilas Kanapickas
bcf7b6c226
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.
2025-03-05 01:53:02 +01:00
Povilas Kanapickas
29a3939c64
chore: Add Github Actions job for checking formatting (#92) 2025-03-05 01:46:17 +01:00
Povilas Kanapickas
cb3464170e
chore: Run clang-format over the codebase (#91)
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)
2025-03-05 01:45:15 +01:00
Povilas Kanapickas
ca0fb5efbb
fix: Make plugin registration be compatible with Qt Creator 16 (#80)
This introduces changes needed after the following commit in Qt Creator:

ba5e4b7eff

Core: Provide settings categories centrally
2025-03-04 11:29:30 +01:00
Povilas Kanapickas
d8a01504a3
chore: Add support for Qt Creator version to the plugin build script (#87)
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.
2025-03-04 11:17:19 +01:00
Povilas Kanapickas
3b188740e8
fix: Make settings dialogs button order consistent (#84)
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
2025-03-03 19:12:01 +01:00
Povilas Kanapickas
0d22e1866e
fix: Add tooltip about where log messages can be seen (#86) 2025-03-03 19:00:25 +01:00
Povilas Kanapickas
61196cae90
chore: Run clang-format over the codebase (#82)
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)
2025-03-02 22:44:20 +01:00
Povilas Kanapickas
102bb114a1
refactor: Remove duplicate constants from SettingsConstants.hpp (#81)
These are duplicated in QodeAssistConstants.hpp. This prevents inclusion
of both files into any source file anywhere in the project.
2025-03-02 22:25:25 +01:00
Petr Mironychev
e507d7ee17
doc: Add discord link with description 2025-02-27 11:39:57 +01:00