Commit Graph

288 Commits

Author SHA1 Message Date
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
Petr Mironychev
ed55c829af
doc: Add Mistral AI and Google AI 2025-02-27 00:20:32 +01:00
Petr Mironychev
d651a246de chore: Upgrade plugin to version 0.5.0 2025-02-26 23:25:19 +01:00
Petr Mironychev
c8e0f3268e fix: End completion position in lsp answer 2025-02-26 23:12:26 +01:00
Petr Mironychev
84025ec843 feat: Separate system prompt for fin and non-fim models 2025-02-26 22:51:38 +01:00
Petr Mironychev
f6fd411b2d feat: Add moving to api key settings page if needed 2025-02-26 21:51:11 +01:00
Petr Mironychev
903eb50e7a fix: Current template description in General Settings 2025-02-26 13:39:49 +01:00
Petr Mironychev
e8f7f031b6 feat: Enabling Position Independent Code 2025-02-26 13:25:29 +01:00
Petr Mironychev
90ae6cd1c0 feat: Add checkbox for disabling chat 2025-02-26 13:18:30 +01:00
Petr Mironychev
2ad0117498 fix: Crash in open General Settings after another settings tab 2025-02-26 11:15:36 +01:00
Petr Mironychev
9d58565de3 feat: Add template description in general settings 2025-02-25 21:58:39 +01:00
Petr Mironychev
8dba9b4baa fix: Saving mistral and google keys to settings 2025-02-25 19:21:44 +01:00
Petr Mironychev
7ba615a72d feat: Add Google AI provider and template 2025-02-25 14:26:56 +01:00
Petr Mironychev
1b06a651f0 fix: Chat item code style 2025-02-24 19:37:29 +01:00
Petr Mironychev
912c3d8c04 feat: Additional marker for user message in chat 2025-02-24 16:54:45 +01:00
Petr Mironychev
e924029ec2 feat: Add filter templates for each provider 2025-02-23 01:41:47 +01:00
Petr Mironychev
d96f44d42c
refactor: Rework providers and templates logic 2025-02-22 19:39:28 +01:00
Petr Mironychev
bd25736a55 refactor: Optimize SystemPrompt for code completion 2025-02-16 16:53:03 +01:00
Petr Mironychev
60936f6d84 refactor: Improve code completion message for Instruct models
Some checks failed
Build plugin / ${{ matrix.config.name }} (map[artifact:Linux-x64 cc:gcc cxx:g++ name:Ubuntu Latest GCC os:ubuntu-latest platform:linux_x64]) (push) Has been cancelled
Build plugin / ${{ matrix.config.name }} (map[artifact:Windows-x64 cc:cl cxx:cl environment_script:C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat name:Windows Latest MSVC os:windows-latest platform:windows_x64]) (push) Has been cancelled
Build plugin / ${{ matrix.config.name }} (map[artifact:macOS-universal cc:clang cxx:clang++ name:macOS Latest Clang os:macos-latest platform:mac_x64]) (push) Has been cancelled
Build plugin / update_json (push) Has been cancelled
Build plugin / release (push) Has been cancelled
2025-02-12 02:05:37 +01:00
Petr Mironychev
7d23d0323f refactor: Improve system prompt and message 2025-02-12 01:47:52 +01:00