Commit Graph

197 Commits

Author SHA1 Message Date
David Schulz
411100b037 TextEditor: remove text editor action handler
Give each editor a context and register editor actions individually for
that context. This removes the need to tell the action handler the
current editor. Additionally all actions are now available in editor
widgets outside of the EditorManager.

Change-Id: I0109866b180889762f8bd8aa07874d8d7c55bfa6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2024-04-09 10:52:26 +00:00
Christian Kandeler
3f457c158f TextEditor: Add type hierarchy infrastructure
We want to support more than one back-end in the future.

Task-number: QTCREATORBUG-28116
Change-Id: I72020c94b36072a297e13f44130e5e2482922cd4
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-03-12 13:22:51 +00:00
hjk
c6aeb2cde1 TextEditor: Fix initial loading of settings
Amends e784b1e58b.

Done-with: Orgad Shaneh
Change-Id: I727983a96ac9aae204974adfabfa7a794bf99907
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-02-15 10:00:48 +00:00
hjk
8b90a2b1cb TextEditor: Use more ActionBuilder
Change-Id: I959c973012873cb8d56442cfdfc86fac5db9faa0
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-02-07 08:02:47 +00:00
hjk
e784b1e58b TextEditor: Start moving settings pieces to standard patterns
Aspects would be nice in the long run.

Change-Id: I6f44fdef6c3eedf6a480d550bdf2c7f4dc1c0c27
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-02-01 13:37:46 +00:00
hjk
d4635d4389 TextEditor: Use new setup pattern for markdown and json editor
And remove the now-empty plugin pimpl.

Change-Id: Ie00b747a4a41bc6efc84ea43db81a71e8364df3d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-29 14:22:22 +00:00
hjk
524167a936 TextEditor: Use new setup pattern for the finders
The FindInFiles definition cannot go yet to the .cpp yet as there
are some exported functions.

Change-Id: I2d2f02ae80b560e3147f461fcbee0fa62b8085a3
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-29 13:01:39 +00:00
hjk
675e8a4757 TextEditor: Use new setup pattern for PlainTextEditorFactory
Change-Id: Iad3b8574a51db3baf6db74353e58968a2f6a4315
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-29 06:41:41 +00:00
hjk
d81fb53b74 TextEditor: Use new setup pattern for TextEditorSettings class
Change-Id: I8980f21a3ea156d45ab68bad66b94fbc5bbad641
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-29 06:40:10 +00:00
hjk
fca5c4fe96 TextEditor: Move BookmarkFilter class definition to .cpp
Change-Id: I6da2710afde7af153353e184de72df2325dc4644
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-26 13:50:08 +00:00
hjk
994e83b839 TextEditor: Move some functions from the plugin pimpl to the plugin
Since the plugin class is in the .cpp now pimpling is not really
useful, this goes a step into the direction of removing it.

Change-Id: Ia55d60749372d868a94884337f0e0f52ec2cc1b5
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-26 13:50:00 +00:00
hjk
610a110341 TextEditor: Move test creation closer to tested code
Change-Id: I0f132dddd405bf17161e0e032f9496a90cdc5ab9
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-22 15:57:17 +00:00
David Schulz
15a1fd6afc TextEditor: reduce complexity of bookmark requests
Since the book mark support is nowadays part of the text editor plugin
we can directly access the bookmark manager from within the editor
without the indirection over the TextEditorPluginPrivate.

Change-Id: I5c04679d6583c06d615d489d3891431adcb64834
Reviewed-by: hjk <hjk@qt.io>
2024-01-19 12:45:16 +00:00
hjk
c8bb7897f5 TextEditor: Use new setup pattern for BookmarkView
Change-Id: I934f1bd6cb3889c4199176cf8d15beaee805f86c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-18 07:21:05 +00:00
hjk
b7d646644d TextEditor: Move BookmarkManager instance closer to its code
This is similar to the recently promoted setupXXX() pattern, not
100% there, though.

Change-Id: Ia6b302af5c8b647ed073ec45179eb2413e988885
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-18 07:20:56 +00:00
hjk
ef8323ee96 TextEditor: Move bookmark related action setup
... to BookMarkManager. For less coupling.

Change-Id: I51c88fc9ee9a3456b1075bbe4c7ad039fc6f1889
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-18 06:51:36 +00:00
hjk
fca33684a7 TextEditor: Simplify setup of line number filter
Change-Id: Ida977fc959f3fe6052151ba8e2461a64699d0a41
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-17 12:00:21 +00:00
hjk
a5d165aa82 TextEditor: Setup TextMarkFactory more canonically
Change-Id: Iaa360615c47ed7c4c3e2ace95ad53006e99aa2d0
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-17 11:59:46 +00:00
hjk
a9621ef1fd TextEditor: Hide plugin class definition in .cpp
Change-Id: Ib796333a0c46311fbead63de0e4562918d14a59f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-17 11:59:38 +00:00
hjk
f662009bca TextEditor: Move test setup closer to tested code
Change-Id: Ib6edee42b20830a322d47fc1ba071d3cdf2d7538
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-17 11:59:26 +00:00
hjk
cac955f2d7 TextEditor: Move OutlineFactory setup closer to new pattern
This is quite special due to the extra signal, but at least that's
hidden in the implementation now.

Change-Id: Id1130669fd1fdfb631d89460cfb884fb53858eec
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-01-10 09:41:32 +00:00
hjk
b442ca3873 Core: Rename ActionBuilder::setOn* to addOn*
There could be multiple connections.

Change-Id: I7dbca9d24599f776b7d1f1bfa11826e3eeb5640a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-12-13 13:00:00 +00:00
hjk
e17f0b6164 Core: Rename ActionBuilder::setContainer to addToContainer
An action/command can be used in several places.

Change-Id: Ifa26f64f7d200d93ada13f272de0fa833f886997
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-12-13 08:37:10 +00:00
Artem Sokolovskii
b26c43f133 SyntaxHighlighter: Move static functions to other namespace
- Created HighlighterHelper namespace and static functions
were moved there from the highlighter class

Change-Id: Ib93785a3819317d7c1d5cc480652d4635cb9339b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-11-20 16:04:59 +00:00
hjk
ab8ba7f264 Core: Replace new "Action" by an "ActionBuilder"
This needs not be stored somewhere but does its work latest
at destruction automatically.

Change-Id: If929f5a5ccc15b085f110d8d9db8f72ff2a5fac5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-11-10 14:33:15 +00:00
hjk
792d88aa05 Core: Introduce Menu and Action classes
Idea is to have a bit more "object { propertySetter }" kind of pattern
for common cases and to couple actions and menus only via Ids, not
real objects.

In a LayoutBuilder context this might later look like

    Menu {
        id(BOOKMARKS_MENU),
        title(Tr::tr("&Bookmarks")),
        container(Core::Constants::M_TOOLS)
    }

in the end.

Overall line count increases but I claim it reduces complexity on the
user code side.

Change-Id: I166e0c8c6b3036430dc464fd652fb37ded21c09a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-11-09 08:00:37 +00:00
Eike Ziller
c2a470e853 Revert "TextEditor: Hide LineNumberFilter implementation"
Fixes missing "Line in Current Document" locator filter.
Locator filters need to be created during startup.

This reverts commit 8af6d16b6c.

Change-Id: I53ec1c1079b4a719169e8db95b6d77f703264b65
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-10-17 07:46:02 +00:00
hjk
8af6d16b6c TextEditor: Hide LineNumberFilter implementation
One of the two non-standard items exposed in the TextEditorPlugin class
interface.

Change-Id: I89755c6a2b168f31b69d3904d6d043273b462ea6
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-10-09 12:23:25 +00:00
hjk
963ff4381d Bookmarks: Merge plugin into TextEditor
Change-Id: I4c9438f3596daff2c18680a731764bf5010e1e25
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-28 11:03:02 +00:00
hjk
2e5805d4b0 TextEditor: Hide part of OutlineFactory implementation
Change-Id: Ifb1c743ba53e2e55605b78336b57c993c12ead3e
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-04 12:13:05 +00:00
David Schulz
ddb4aa0151 TextEditor: add json indenter
Use an EditorFactory that sets up a custom indenter for json files.

Change-Id: Id5ade9f9f551835131a62e381a972f0b6032e7c0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-08-28 08:18:59 +00:00
Christian Kandeler
b92ac9a941 TextEditor: Introduce a per-project variant of the comments settings
These settings can clearly differ per project.
Note that the classes have to live in the ProjectExplorer plugin, which
has a (questionable) dependency on TextEditor.

Change-Id: I7e3816da30cecd1ccb66549a2226b44dc0a26cb4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-08-08 12:50:58 +00:00
David Schulz
bae8e28fee TextEditor: Add tests for the generic highlighter
Change-Id: I5a5092ed0a997800bf6653ab25d69f08f4aa0c37
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-07 06:20:42 +00:00
David Schulz
95b4da9ba9 TextEditor: add tests for the code assistant
Task-number: QTCREATORBUG-28989
Change-Id: Id76d5df589ab50c7deb96b8ad29d1f29bc368e59
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-05-31 13:38:13 +00:00
hjk
dce7025969 MarkdownView: Merge into TextEditor
Make it a bit more compact, too.

Change-Id: I448164371c5a1d6969a292feba17caa2826f58c3
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-21 07:17:29 +00:00
hjk
118b84ffd6 Use simpler Plugin::initialize() when feasible
Change-Id: I567965d266f20526bda9f823e31a04b354d53fb1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-20 12:13:10 +00:00
hjk
17b20e0622 TextEditor: Tr::tr
Change-Id: I28aa68e25c53c3a4d1c370074d7b3318944dc45a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-18 07:02:12 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Jarek Kobus
131ecdd3ec TextEditor: Pass context object to lambda connections
Remove some unneeded lambda () brackets.
Glue lambda brackets with parameters brackets.

Change-Id: I66da839573a1633104f689834740bc2953f5868f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-12 06:54:59 +00:00
Jarek Kobus
4c1f410881 TextEditorPlugin: Limit the usage of std::make_pair
And qMakePair.

Change-Id: Id92a662fa0674b9e9f835280bb9378c8d00549e8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-30 11:25:19 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Ihor Ivlev
6f7e7980d2 Display parent functions in the Find Usages menu
To display the parent function, first we find it in displayResults and
store the information to SearchResultItem, then
SearchResultTreeItemDelegate gets the information and renders it.

Similar approach is applied to ClangdClient, in addSearchResultsForFile.

This change also adds default style for containing function highlight in
the search.
Default foreground and background colors are same as usual text colors.

Task-number: QTCREATORBUG-27550
Change-Id: Id1251afa192f8d1232524742b7c211770bcb83fb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-25 15:05:25 +00:00
Eike Ziller
dc5717bd06 Move File System view to Core plugin
So it can be accessed from a wider range of places.

Change-Id: I282883addecf7bb070a65d9f4f7b8e6e2e4b5e47
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-27 09:02:23 +00:00
David Schulz
d03f723060 TextEditor: add macro variable containing the word under cursor
Fixes: QTCREATORBUG-24836
Change-Id: Ib872fd12e5842bdb752dd3969ef9c5eb9dd2f650
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-11 12:44:40 +00:00
Alessandro Portale
b2a766a79a Don't access static functions/fields via instance
Courtesy of readability-static-accessed-through-instance

Change-Id: I71f54244f1e091315dac2943d9e1bfad6efa56a9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-19 08:42:14 +00:00
Christian Kandeler
4376bc1e39 Core: Allow different highlight colors in search result window
... and make use of that in CppTool's "Find Usages" by assigning
different colors to read and write accesses.

Fixes: QTCREATORBUG-12734
Change-Id: I067db2c8d693bb2c5be44249931ee4f0269f7e52
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-09-18 09:33:07 +00:00
Christian Kandeler
7938320291 TextEditor: Introduce shortcut for forcing a function hint proposal
... and support it in the ClangCodeModel.
This allows users to get function signature(s) displayed regardless of
where exactly the cursor is on the function call.

Fixes: QTCREATORBUG-19394
Change-Id: I033e8774db93680bfc3ee52610b817e0ef8ccc76
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-08-11 10:10:08 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
hjk
299d34d547 Remove apparently unneeded QtPlugin includes
Change-Id: I511c0318a72dbf2a92e4749dee02eabfc9826139
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-12 16:03:37 +00:00
Christian Kandeler
5f845a02cd FancyLineEdit: Make completers triggerable via Ctrl+Space
In particular, this allows to trigger the completer without providing a
leading character, thus showing all history entries.

Task-number: QTCREATORBUG-17891
Change-Id: I8ae900d196de2e5083a626faa757648637b325ae
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-30 08:53:20 +00:00