Commit Graph

535 Commits

Author SHA1 Message Date
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
David Schulz
4e02fba933 TextEditor: add inline suggestions
Change-Id: I8c670a2aee17e461da1e3882d5b642da935b3d7a
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-02-01 10:50:17 +00:00
Eike Ziller
e9b177db7d Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/libs/utils/filepath.cpp

Change-Id: I04761cf7c99ed67322a592cbd0ae48c1ae9c708a
2023-01-25 14:11:01 +01:00
David Schulz
f15cae2bac TextEditor: fix endless loop on adding cursor for selection
Since the find of QTextDocument is line based, it is not possible to
find selections spanning multiple lines in the editor. Triggering a find
on a search term containing a paragraph separator returnes an invalid
QTextCursor which always result in searching from the beginning of the
document in the add cursor for selection logic. Prevent that by checking
the selected text beforehand and add a safety net in the loop to verify
that we do not start over again on an invalid TextCursor.

Fixes: QTCREATORBUG-28709
Change-Id: I8c1b9d16e707fefbba6dc0a0a9ef21b8c82ebe19
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-01-23 09:58:25 +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
David Schulz
baa1e3c2e1 Editor: Allow to hide annotations for a group of text marks
The hiding is not persistent, so on the next Qt Creator start all
annotations are visible again. This is meant to quickly get rid of
annotations if there are to many irrelevant of a specific kind.

Change-Id: I4862e56e0f5624f30aadda26efc9dea672ab1f57
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-12 10:19:10 +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
David Schulz
e79a0ab49b Editor: increase text cursor visibility on indentation depth mark
Reduce the alpha of the marker if a cursor is at the same position as
the marker.

Fixes: QTCREATORBUG-28645
Change-Id: I01b1825fd3f393dcc75cc58d64a31f22e50e2648
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2023-01-03 10:21:02 +00:00
Eike Ziller
3f4c3a3db4 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/texteditor/texteditor.cpp

Change-Id: I9c8f1331be3f5442f1fd28aeb0a9bc07128629d1
2022-12-20 11:05:01 +01:00
Xavier BESSON
3f554f3837 TextEditors: Implement "Follow Symbol" for HTTP urls in string literals
Task-number: QTCREATORBUG-14967
Change-Id: I30923aa94d761b06edb1f67007fd7e2a67065ef0
Reviewed-by: Xavier BESSON <developer@xavi-b.fr>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-16 12:08:37 +00:00
David Schulz
1eb73e4eb3 Editor: prevent validating line number in unwrapped editor
Checking whether a position is inside the first line is also not for
free. Only check the line number of a cursor position if we expect the
editor to have multiple lines per block or in other words line wrapping is
enabled.

Change-Id: I0e3cb1fbd11c250677f7c11d1a5c780f60085ec2
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-12-16 11:34:02 +00:00
David Schulz
f87fccafc1 TextEditor: prevent shaping text for indent depth painting
QTextLines cursorToX indirectly calls shapeText which is not for free.
We just want to have the x position for the line so there is no need to
shape the complete text to get the position of the first cursor.

Change-Id: I0ae636ed8250385b7ac77c6f37d45922bbf2e9bf
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-12-16 10:31:11 +00:00
Eike Ziller
a3fe24d192 Merge remote-tracking branch 'origin/9.0'
Change-Id: I5298a6529921568ec32c0fe0c009c273263b0f5d
2022-12-14 14:25:38 +01:00
David Schulz
e0b1f694e3 Editor: Fix deleting with numblock delete in multi text cursor
Fixes: QTCREATORBUG-28584
Change-Id: Ib65a933b61536d9a6342e82c51779c2a91983ec8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-14 06:20:05 +00:00
Marcus Tillmanns
e7a2448681 TextEditor: Cache tabSettings
Change-Id: Ib44198b4763eac865ea46831e7a02924bf533475
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-13 07:32:21 +00:00
Mikhail Khachayants
81075b813c TextEditor: Fix wrong tooltip when split mode is used
It was possible to get a tooltip with cached text from other editor area

Fixes: QTCREATORBUG-28571
Change-Id: I4250856e6c165eed70ddb4a6c888e16b4a6b045d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-12 19:46:59 +00:00
Eike Ziller
af60fb8241 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/plugins/cppeditor/cppelementevaluator.cpp
	src/plugins/vcsbase/vcsbaseclient.cpp

Change-Id: I31e03b063240416280f5ca88c31f432911d5c67e
2022-12-12 11:07:15 +01:00
Jarek Kobus
b0e6943491 TextEditorWidget: Ensure non-null source is passed to insertFromMimeData
Detected by clazy analyzer. The possible context was
TextEditorWidget::dropEvent(). In some branches we ensure
that mime is not null, but later we call insertFromMimeData()
unconditionally.

Change-Id: Iee5138bc19d405050eafc9617d3c2ed123b767c7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-08 13:52:12 +00:00
Eike Ziller
b4fed03c27 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/plugins/cppeditor/cppeditorplugin.cpp
	src/plugins/docker/dockerdevice.cpp

Change-Id: I41747ff9490e4ab20340d4d4acb4655100aaa3d2
2022-12-07 10:47:47 +01:00
Jarek Kobus
f3ce23230e TextEditor: Init markWidth variable
Otherwise some overrides of extraAreaWidth() may leave passed
value unmodified and we may end up with uninitialized value.

Change-Id: Ica89019fc2cff93f0bc7d784624730ec9d8c0224
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-30 07:22:09 +00:00
Jarek Kobus
2e75492257 TextEditor: Replace qAsConst() with std::as_const()
See 8eb4d52342

Change-Id: Ic96065a4bda4c9658d88bbab2e916e8f2525bcb2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-24 06:01:03 +00:00
David Schulz
0e4b0a26d3 Editor: move ownership of assist interface to processor
This way the base class can manage the lifetime of the interface object
and it doesn't need to be done in each implementation of perform.

Change-Id: Ie1ce742e31b688a337533ee6c57d376146e25ace
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-17 13:23:55 +00:00
Eike Ziller
ae67799eb3 Merge remote-tracking branch 'origin/9.0'
Change-Id: I2123e09f75199a63af6e8505fb8889e7f9d025d2
2022-11-16 09:40:34 +01:00
David Schulz
f297b3f1b5 Editor: always configured assistant
A code assistant is not usable without a text editor widget and is
always created as part of one, so make the dependency obvious by require
it in the construction of the code assistant. This removes a bunch of
functions and cheks.

Change-Id: I96556430082ff729d99d2ae2516599f9b8cbc704
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-16 05:24:06 +00:00
David Schulz
4b126550c1 Editor: completely repaint annotations on changed bounding rects
If the rectangle of an annotation changes we need to completely redraw
the annotation since the content might have shifted and the eliding
character is now at a different position.

Fixes: QTCREATORBUG-28411
Change-Id: I41b0f38a73b287e6a5d5318ba797aac6e2ff71b0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-11-15 06:50:59 +00:00
Jarek Kobus
1a1d4780b8 TextEditor: Always use the same 'x' char for width
Introduce charWidth() helper method.

Change-Id: I1a643f0ecbcba1fd9659e02d48f76c57496fa8f1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-11 13:26:18 +00:00
Eike Ziller
63c1bc572a Merge remote-tracking branch 'origin/9.0'
Change-Id: Ie24672b00aae6c0afa5931d87e6e1c24fb841161
2022-11-07 12:59:28 +01:00
Marcus Tillmanns
7e0d545e64 Utils: Allow mimetype deep-scan for remote files
Text editors need to know the actual mimetype of a file to be able to
open the correct editor view. Just checking the extension is not
enough. Especially on linux there are many text files without
an extension.

Change-Id: I7e5c935b0619f5d86e97f10bfd7ff9b65da62f4b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-11-04 09:52:15 +00:00
Tim Jenssen
aa33927651 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
	src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp
	src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp
	src/plugins/qmldesigner/qmldesignerprojectmanager.cpp
	src/plugins/qmldesigner/qmldesignerprojectmanager.h

Change-Id: Ib029a830ee99190bc4ea2ad75d9300bfa86b42d9
2022-10-25 19:02:15 +02:00
David Schulz
0944bfb7f0 Editor: Fix find usage position in context menu
Do not add the find usage action to an editor context menu if it is
already there.

Change-Id: I0a98d81ae0e08be69ca2579af5701b5fbc8ccbda
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-25 15:05:38 +00:00
Christian Kandeler
13f40f5471 Utils: Add sorted() function
For simpler calling code.

Change-Id: Ia0a16a28770fd172f74d06a626148248bf5d3c0c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-25 14:29:45 +00:00
Jarek Kobus
edd16c7047 UnifiedDiffEditor: Fix visible wrap column
Take m_visibleIndentOffset into account when drawing
right margin.

Fixes: QTCREATORBUG-26601
Change-Id: I50839098953181c667a5fe0e5fac7dfa5bc95327
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-24 07:00:40 +00:00
David Schulz
42481ced35 Editor: fix extra area width update
Do not missinterpret the new block count after a document change as the
requested extra area width.

Fixes: QTCREATORBUG-27267
Change-Id: Id724f68d223741bc36e4566e51e5d1d051f6cca3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-21 10:55:14 +00:00
Jarek Kobus
243f66f97d UnifiedDiffEditor: Fix indent visualization
Add TextEditor::setVisualIndentOffset() protected helper.

Change-Id: I0755a732d07dec651c090dd6afd87d293453f0e1
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-21 07:38:04 +00:00
Eike Ziller
3bdb1a3edf Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
	src/plugins/vcsbase/vcscommand.cpp

Change-Id: I2d33113bfb2ea7134550cda1de4e2c21e6711778
2022-10-18 16:51:36 +02:00
Eike Ziller
ea5a050c5c Merge remote-tracking branch 'origin/8.0' into 9.0
Conflicts:
	src/plugins/mcusupport/mcusupportsdk.cpp
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
	src/plugins/qmldesigner/components/materialbrowser/bundleimporter.cpp
	src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp

Change-Id: I9317da0fc1243b9ce6d87f577aa843c51f132ad7
2022-10-18 10:48:46 +02:00
David Schulz
93c15f48dc Editor: ensure cursor is visible after handling backspace
Fixes: QTCREATORBUG-28316
Change-Id: I1e8c9229704c700ad76f6906b1a220948c819c1b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-10-18 06:49:31 +00:00
David Schulz
b2dbc0965c Editor: Fix double click in editor behind content
Fixes: QTCREATORBUG-28083
Change-Id: Ie198c2f1c9911ec85ee555ff1058d2528f9e6b7d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-13 12:11:58 +00:00
David Schulz
bf5a8835ee Editor: improve visual indent depth for empty blocks
Use the indenter based visual indent only for the cpp qt style indenter
since it gives accurate results. In all other casess Look for the next
and previous not empty lines and use the minimum indent depth of those
lines as the visual indent depth for empty lines.

Task-number: QTCREATORBUG-28179
Change-Id: Ic456fba5adfb2a12f20e2bd4fc663010c752b65c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-10-10 08:36:07 +00:00