Commit Graph

573 Commits

Author SHA1 Message Date
David Schulz
28742774fe TextEditor: add rename symbol option to editor context menu
... if the action handler supports the rename option.

Change-Id: Ic1bad19a490aaccc8e96afd1f74741596bf6efc3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-08-28 07:52:52 +00:00
David Schulz
b128c585d9 TextEditor: render suggestion with the tab width of the editor
Fixes: QTCREATORBUG-29483
Change-Id: Id8da019130055ce40bd639d038eb1e74d9787884
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-10 13:37:33 +00:00
Christian Kandeler
099fe7d5d1 CppEditor: Let users fold/unfold all comment blocks
Fixes: QTCREATORBUG-2449
Change-Id: Ib090f1bb0d0866f14ddb6dfb10bf2ff2563585e0
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-08-08 08:52:55 +00:00
David Schulz
f0bb7e8bfa Editor: modernize line column label
This change contains various adjustments to the line column label:
 - Display the number of selected characters
 - Show the number of cursors instead of the position when multiple text
cursors are present in the current editor
 - show detailed information for each cursor in the line column tooltip

Fixes: QTCREATORBUG-29381
Change-Id: Ib4f36b290797f1d84f268deeb9556e78ae921c37
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2023-07-07 11:23:49 +00:00
David Schulz
b721d98476 Editor: optimize annotation cache cleanup
Looking up the last visible block is not for free since it calculates
the bounding rects for all blocks between the first and last visible
block. Avoid one calculation by postponing the annotation cleanup after
the paint event and only if we reach a certain amount of cached entries.

Change-Id: Ibfab49301f82237e16d5a69ce1531539907e7ed8
Reviewed-by: hjk <hjk@qt.io>
2023-07-04 06:41:09 +00:00
Eike Ziller
26e96bfad8 Merge remote-tracking branch 'origin/11.0'
Conflicts:
	src/plugins/debugger/debuggeritemmanager.cpp

Change-Id: I9d99d13feff9315f52eacbd84857c63cb69bf804
2023-07-03 10:24:09 +02:00
David Schulz
a207943f59 Editor: fix visual glitch after disabling overwrite mode
Change-Id: Ied85cf298a12a29cf448e6dec6c81f6a0a2dc4b7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-06-28 12:35:35 +00:00
Christian Kandeler
cf6bd7e012 Fix occurrences of the contains/insert anti-pattern
Introduce and make use of Utils::insert() for QSet with a return value
that indicates whether insertion actually happened.

Change-Id: I655e4bc3553b74fea5ae8956205e4d8070118d63
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-23 09:51:54 +00:00
Eike Ziller
6c601b8cd4 Merge remote-tracking branch 'origin/11.0'
Change-Id: I8d1c9720a868da02b3157a48954eb4e262539c84
2023-06-15 09:48:58 +02:00
David Schulz
827d6e66f8 Editor: only paint the preedit cursor
Task-number: QTCREATORBUG-29134
Change-Id: Ia44b0c8ddc88da7b64527fea806139726d57243a
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-06-14 10:05:16 +00:00
Eike Ziller
e7870f736d Merge remote-tracking branch 'origin/11.0'
Conflicts:
	src/plugins/clangformat/clangformatutils.cpp

Change-Id: Ide285cc25fca9101843ab9dca01c5a33644aca7f
2023-06-14 08:43:08 +02:00
David Schulz
37433c1897 Editor: do not set the viewport margins if they have not changed
Change-Id: I01adabc52e47e8a47aff0f5dc2b580066e51307c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-14 04:58:49 +00:00
David Schulz
c547c8615f TextEditor: optimize setting refactor markers
emitting requestBlockUpdate is not for free so limitting it to blocks
that have changed improve the performance notable for documents with a
lot of refactoring markers.

Change-Id: Ie288a367d1d1d6a9f4359e37ff8486a1dfe36752
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-06-13 11:52:00 +00:00
David Schulz
4481686909 TextEditor: improve performance of painting indent depth
Avoid asking the indenter for the visual indent depth since some
implementations are not cheap and might even cause file io. Fall back to
the default detection.

Change-Id: Ic85d134fc29a0599768ac05c306b8593e83db327
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-06-13 09:05:21 +00:00
Eike Ziller
375db16ac4 Merge remote-tracking branch 'origin/11.0'
Change-Id: I87b22a73427cf9fc1b96075dc0db769ed3d3621c
2023-06-09 11:24:29 +02:00
Jarek Kobus
abb85b073a QScopeGuard: Make all usages of QScopeGuard consistent
Change-Id: Icfc35ecbdbdee8dadbb1b17789694093427c3ed9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-07 10:35:01 +00:00
Eike Ziller
967c53696c Merge remote-tracking branch 'origin/11.0'
Conflicts:
	tests/manual/subdirfileiterator/tst_subdirfileiterator.cpp

Change-Id: I6fa8fbed152efc4033fa69e1ab67ced7e2ad35bc
2023-06-06 16:50:22 +02:00
Jarek Kobus
b14c07eed6 TextEditor: Reuse qScopeGuard instead of ExecuteOnDestruction
Change-Id: I2ca7d4676bb4f34fbf59fd45bcd01d7857cb7e4e
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-05 08:35:14 +00:00
Jarek Kobus
bd48121a88 TextEditor: Reuse searchInContents()
Change-Id: I08403d05830232becf7e5329339aaecf288894b7
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-30 08:22:32 +00:00
Jarek Kobus
a78720060e FindFlags: Move it into Utils lib
It's going to be reused in filesearch.h API.

Change-Id: I7ef133368536a647e19949ba8623134cf078a87d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-26 07:59:41 +00:00
David Schulz
9bb126c0d6 Utils: make column of convertPosition 0-based to merge it into Position
Change-Id: I239b3cb33b8ad59ac4097c919155ab5ca7d57b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-24 11:53:28 +00:00
Tim Jenssen
1b6c0ff56c Merge remote-tracking branch 'origin/qds/dev'
Conflicts:
  coin/instructions/build.yaml
  doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc
  share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl
  src/libs/CMakeLists.txt
  src/libs/advanceddockingsystem/dockmanager.cpp
  src/libs/advanceddockingsystem/workspacedialog.cpp
  src/plugins/coreplugin/manhattanstyle.cpp
  src/plugins/qmldesigner/CMakeLists.txt
  src/plugins/qmldesigner/components/formeditor/toolbox.cpp
  src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimporter.cpp
  src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp
  src/plugins/qmldesigner/designercore/projectstorage/qmltypesparser.h
  src/plugins/qmldesigner/qmldesignerexternaldependencies.cpp
  src/plugins/qmldesignerbase/qmldesignerbaseplugin.cpp
  src/plugins/qmldesignerbase/qmldesignerbaseplugin.h
  src/plugins/qmlprojectmanager/qmlproject.cpp
  src/tools/qml2puppet/CMakeLists.txt
  tests/unit/unittest/CMakeLists.txt

Change-Id: I2c5f18c4fca49471d02713ce5859032232cf7756
2023-05-22 21:13:40 +02:00
David Schulz
3f2832289d Utils: move TextPosition/Range to textutils
Change-Id: Id94a7a96f3b0f978e94850d67eb4b8fba6c18fe2
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-10 09:32:39 +00:00
Jarek Kobus
936086745a FileSearch: Get rid of FileSearchResult
Use SearchResultItem instead.
This change should reduce the remaining freeze described in
a9eb732ce6 even more.

Change-Id: I102b82ed5677360ccd9e425dd0bdd941d87116f0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-09 11:03:48 +00:00
Marcus Tillmanns
9f0919c4a3 FakeVim: Block Suggestions
Block suggestions when FakeVim is enabled and the mode
is not "Insert" or "Replace".

Change-Id: I778eb25d9570b76e42652f9d938a8c580033c462
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-05-02 06:04:53 +00:00
Tim Jenßen
9c2a73b1c8 Merge remote-tracking branch 'origin/10.0' into qds/dev
Change-Id: I51801c3bec7e29f7c7384d86d79b4fcabb4f99c1
2023-04-27 20:30:00 +02:00
Eike Ziller
c9696fbabb Merge remote-tracking branch 'origin/10.0'
Change-Id: I8b36c1812b61dbe08fe3e7930f950e6b8e8a7079
2023-04-24 08:52:35 +02:00
Eike Ziller
5125ccf03f Merge remote-tracking branch 'origin/9.0' into 10.0
Change-Id: Ifbb14e33104b39de8ca2e1495301a53e71496ef9
2023-04-24 08:10:39 +02:00
Ali Kianian
151423ab16 QmlDesigner: Remove transient scrollbars
The concept of the transient scrollbar still exists, but all used cases
are removed.

Task-number: QDS-9735
Change-Id: I16c57635a5eeb114b906ab74bbf24a8693897557
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2023-04-21 05:21:20 +00:00
Thiago Macieira
d1d893f098 Fix dangling references, found by GCC 13
Lifetime extension via const-ref only applies to functions that return
by value. For those that already return by reference (such as
QList::constLast()), no extension happens and we end up with a dangling
reference.

cmakebuildconfiguration.cpp:1473:25: warning: possibly dangling reference to a temporary [-Wdangling-reference]
cmakebuildconfiguration.cpp:1473:61: note: the temporary was destroyed at the end of the full expression ‘ProjectExplorer::BuildStepList::steps() const().QList<ProjectExplorer::BuildStep*>::constLast()’

Change-Id: I3b169860d8bd41e9be6bfffd1757167b7348be9b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-04-20 14:29:31 +00:00
Marco Bubke
79b5a9f03e TextEditor: Return BaseTextEditor for duplicate
Because the type is always a BaseTextEditor we can return a
BaseTextEditor type. C++ is allowing to change the overload return type
so long it is compatible.

Change-Id: Ib4c88faaa6fdfb97fd03c51a120de0fa0c2d00cd
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-19 10:17:56 +00:00
Ali Kianian
795aae8e7c QmlDesigner: Enable transient ScrollBars for StudioStyle
- Transient scroll bar is available for StudioStyle.
- Some changes are applied to slider style, because scrollBar and
sliders have some common usages within the style.

Task-number: QDS-9283
Change-Id: I7a8b7997cf4d20142a0524c4a071b93dfd06321d
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
2023-04-19 06:48:25 +00:00
Marcus Tillmanns
45c2e3fe58 Copilot: Add insert next word action
Fixes: QTCREATORBUG-28959
Change-Id: Ied53ad5676133e2eb71988ecfcce90c5ad77e3c3
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-04-06 12:52:55 +00:00
Eike Ziller
b635e99086 Merge remote-tracking branch 'origin/10.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	src/libs/utils/multitextcursor.cpp

Change-Id: I54b00ea5e6953078beed7673b5de31114f983bfa
2023-03-31 15:58:09 +02:00
David Schulz
7046890bcc Editor: ensure that the outline is the left most toolbar widget
Fixes: QTCREATORBUG-28765
Change-Id: Ifc43ed64ab4906af2d669ff372d8b66d59203048
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-03-31 09:32:04 +00:00
David Schulz
73c645820f TextEditor: use QScopeGuard instead of ExecuteOnDestruction
Change-Id: I2d7c04d69ad49a121b157af2750eaed26bab9480
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-30 08:00:19 +00:00
David Schulz
6ab923c39f Copilot: add copilot suggestion tooltips
These tooltips allow to switch the currently visible suggestion as well
as applying it using
the mouse.

Change-Id: I30b9a76ae57c66887f4e1b1311e1a7248ed0f194
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-29 07:43:28 +00:00
David Schulz
8a1e34f084 TextEditor: introduce text suggestion interface
And also a copilot suggestion implementing that interface that allows
reverting all changes done to a suggestion as well as applying it.

Change-Id: I236c1fc5e5844d19ac606672af54e273e9c42e1c
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-29 07:43:19 +00:00
David Schulz
eb7ccfd889 LanguageClient: add action to open call hierarchy
Fixes: QTCREATORBUG-28839
Fixes: QTCREATORBUG-28842
Change-Id: Icb70412282c0c2c36241559d942a58ffddab5664
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-22 14:40:38 +00:00
David Schulz
d6c5cf5934 TextEditor: only paint selections in the first block of a suggestion
Fixes highlighting of matching parentheses or errors of the code model
in every line of the suggestion.

Change-Id: I223cb567ee8ce95badd91c4819417310a0e28cff
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-21 10:24:51 +00:00
David Schulz
bcd4c3f360 TextEditor: Adjust extra selections when suggestions are visible
Change-Id: Id914ce544b2289bff5403c8a673dceebbc517b54
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-17 09:45:00 +00:00
David Schulz
65e1baf5f7 TextEditor: set the cursor to the widget before closing the edit block
This will make sure that code reacting on the document change signal can
get the final cursor position from the widget. More specificly this
fixes requesting copilot suggestions when automatic text is inserted
like closing parentheses when typing "if ("

Change-Id: I01a13e67e72b89010fe39de3d0def0622a9b08b8
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-17 09:44:42 +00:00
David Schulz
8247d578c7 TextEditor: skip auto completion while suggestion is visible
The use can still explicitly request completions in that case via the
keyboard shortcut.

Change-Id: I4ed47232a24288c540d1357c0f876a1cdfcfec08
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-16 11:56:02 +00:00
David Schulz
7f56ccaa9e TextEditor: avoid painting annotations over suggestions
Blocks with suggestions are longer than without the suggestion. So we
have to calculate the annotation start position based on the reaplcement
and not the actual document layout.

Change-Id: I32ce81134e1146dd28ae11a70356a98c75529236
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-16 11:55:56 +00:00
David Schulz
7cb585af87 TextEditor: support inline suggestions
Change-Id: I70924a37f9078c5b33c1703e099fc9ddc0b1ae9a
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-15 05:06:28 +00:00
David Schulz
18364db94a Editor: ensure block is layouted when painting it
The painting of an editor assumes the block is layouted properly. This
was done implicitly when calculating the block bounding rect previously.
With the option to replace the block layout with another document this
is not the case anymore, so we need to explicitly make sure that a block
was layouted before painting.

Change-Id: If6947a3a5c13a03310e0cab0f6fcbd4ff8078b1b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-02 11:08:01 +00:00
Eike Ziller
2f5aed6c78 Merge remote-tracking branch 'origin/10.0'
Conflicts:
	src/plugins/clangcodemodel/clangdlocatorfilters.cpp

Change-Id: If91f26625ea9620fb9fdbf45705b32f37cb7f158
2023-02-10 10:43:06 +01:00
Artem Sokolovskii
8491441257 TextEditor: Speed up updateCurrentLineHighlight
Only update the changed blocks and use sets instead of lists to
store the info and create the diff.

Change-Id: I08d81b326ceebdc6bf2ba322886b7bf5671b2769
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-09 14:05:28 +00:00
Artem Sokolovskii
db720d271d MultiTextCursor: Optimize multitextcursor
- Use map for merging intervals instead 2 times list iteration.
- Time complexity O(nlogn) instead O(n^2)

Change-Id: If65391999e1ff191752447935602fcc9847243fe
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-09 14:05:12 +00:00
David Schulz
6908130c83 Editor: Add replacement helper to document layout
More inline with the other text block user data members and cleaner on
the client side. Additionally add some & for const arguments and remove
test function call.

Change-Id: I19e646aa204eedf447c02a2f76b89c3430280169
Reviewed-by: hjk <hjk@qt.io>
2023-02-02 05:26:46 +00:00