Commit Graph

370 Commits

Author SHA1 Message Date
David Schulz
a2dadb3d0b TextEditor: Snippet ranges refactoring
Parsed snippets are now reported in chunks of texts and variables. A
variable has a index that can be used to identify matching variables and
maybe a mangler that can be used to modify the variable when applying
the snippet.

This effictively moves the variable matching logic from the overlay to
the parser of the snippet, which is needed to implement the LSP snippet
parser.

Task-number: QTCREATORBUG-22406
Change-Id: I6999554c6c6d0f1887c98bf732473f01aa1f230c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-03 11:12:34 +00:00
David Schulz
ec2449cae4 TextEditor: move snippet overlay into own cpp file
Change-Id: I3343d9abf19e4edc7bd88077bf8fe6666a901e1b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-03 04:11:07 +00:00
David Schulz
c8f8513c8d Snippets: Split error messages out of the parsed snippet
Change-Id: Ic5d6664c86405c558e8bb133b854521e4eaef58a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-28 07:37:24 +00:00
David Schulz
a3c7adecd1 TextEditor: move ParsedSnippet out of snippet
Change-Id: I4e9c7d810fdd0904386f8d3b3481c0a4855c2021
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-26 11:48:47 +00:00
David Schulz
b3c2120dff Editor: add specialized snippet overlay
Split out the snippet functionality into a new derived
overlay implementation.

Change-Id: I2d7fffabe16ce6348ed067eb52ff221420a23285
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-22 04:14:19 +00:00
Eike Ziller
555dbac851 Merge remote-tracking branch 'origin/4.15'
Change-Id: I613b60f7d5cfca19ed611b3777548738d7bd7d67
2021-04-14 11:33:16 +02:00
David Schulz
005f0a3127 TextEditor: Fix highlighting search results at block start
Fixes: QTCREATORBUG-25570
Change-Id: I3450cfed49e07cf96c2a2a9cdfa9a0be7a05c49f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-12 07:27:03 +00:00
Eike Ziller
2800f3b51f Merge remote-tracking branch 'origin/4.15'
Change-Id: I0afcf51d354ffd73a8f2956a7f78b1e4f032677b
2021-04-09 12:42:03 +02:00
David Schulz
dde3fa12ac Editor: Fix RTL move line up/down
Fixes: QTCREATORBUG-25515
Change-Id: I865592938ce0f6c36a9f783e9a379ce5e07d6b88
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-08 04:22:31 +00:00
Eike Ziller
b213c87cf4 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp

Change-Id: I722a94f37bdd1d78625cfae503ba6d02ff083c63
2021-03-25 11:06:59 +01:00
David Schulz
9fcab76de6 TextEditor: Fix corrupted cursor after droping text
... by removing excess endEditBlock.

Fixes: QTCREATORBUG-25305
Change-Id: I81fd2ee57a7a470fcc8e78475f336bf2b651a14b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-03-24 05:31:10 +00:00
Alessandro Portale
93fbd5be02 Remove dead code "< QT_VERSION_CHECK(5, 14, 0)"
Qt Creator required Qt 5.14 or higher. Let's removed the #idef-ed code
for building against lower Qt versions.

Add a comment in porting.h where we still need such code for sdktool.

Change-Id: Ib330275208eec4a2f285b4b9f480530c171f538a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-18 19:12:39 +00:00
David Schulz
a52f468bc5 Editor: Fix crash when setting language id before document
Change-Id: I735484c7036f6c8b26142d114348295d9b12ae97
Reviewed-by: Knud Dollereder <knud.dollereder@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-17 14:26:28 +00:00
David Schulz
d187022892 TextEditor: update codeStyle after setting language id
This updates the tab settings to the correct one for the specific
language like C++ or QML. Only observable if the file is not part of a
project. Otherwise the project code style settings will set the language
specific tab settings.

Fixes: QTCREATORBUG-25485
Change-Id: I736646557a213369903fe495e3b5a3a950141961
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-17 10:35:21 +00:00
Jacopo Martellini
cc89f72fe5 TextEditor: Add option to prefer single line comments
Fixes: QTCREATORBUG-24017
Change-Id: Icf34710707b51ea9fbd348dd207950cffeedfdd3
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-02-08 08:36:50 +00:00
Jarek Kobus
e3ae92bc5f TextEditor: Use invokeMethod instead of singleShot timer with 0 delay
Use QCoreApplication::instance() as a context object for the
IAssistProposal deleter.

Change-Id: Idf8cd1955dca146a500da1ea036298455c8a5da1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-02-02 08:15:28 +00:00
Björn Schäpers
d9cd74f06d Texteditor: Add ability to get margin from indenter
And implement it in the clang-format plugin to use the ColumnLimit from
the style. This would be quite useful if you're working on different
projects with a different ColumnLimit. This way you get an visual
representation and do not only have to rely on clang-format.

Change-Id: Ib0258e3fba6f45f0f46ce612f806527a47868ad9
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-29 17:03:07 +00:00
Eike Ziller
16d25a3cc8 Merge remote-tracking branch 'origin/4.14'
Conflicts:
	src/plugins/qmldesigner/assetexporterplugin/componentexporter.cpp

Change-Id: If742bcd843cf75cf55e07b489ecb7211f0cd9058
2021-01-18 11:50:32 +01:00
David Schulz
8526c7de77 TextEditor: Fix search result highlight for overlapping results
Fixes: QTCREATORBUG-25237
Change-Id: Ib95e49b4db57909b79295f2ff7729560ab45c8a9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-15 10:14:10 +00:00
hjk
206e9f95fb Core: Signal duplicated editors
FakeVim needs some notification even in cases where the
duplication is triggered outside the EditorManager as in
QmlDesigner's qml-editor.

Fixes: QTCREATORBUG-22344
Change-Id: Ia4950ff4b02d3f89779f03ff4c106a07ccff2106
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-14 08:31:44 +00:00
Jarek Kobus
12810caea1 Don't repeat the same code
Change-Id: Ied1d816481bef760a49a4572e9fda1f6ac538daa
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-12-14 14:51:59 +00:00
Alessandro Portale
a3857a996a Don't access static functions/fields via instance
Courtesy of readability-static-accessed-through-instance

Amends: b2a766a79a

Round #2: This time done with Qt Creator's Analyzer, which
found other occurences than run-clang-tidy.py

Change-Id: I479e280c7abcf2d24baccbb0af69ae4bda05198e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-27 13:26:07 +00:00
David Schulz
c5c3214cfb TextEditor: add action to paste without autoFormat
Fixes: QTCREATORBUG-20887
Change-Id: Iedc6b584c9c1cc48804025653d0749e054a406f8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-24 12:20:05 +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
David Schulz
6e846b6606 TextEditor: skip painting annotations for disabled text marks
Change-Id: Id05bfe5bd120b2bbb2e2b70fb29a99b8c430e459
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-27 07:38:30 +00:00
David Schulz
0ca9ea353c Editor: Do not use disabled code color for right margin highlight
Fixes: QTCREATORBUG-17174
Change-Id: I68729d5a44b23fe46b810054a1dc472ffd63e272
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-21 04:32:27 +00:00
David Schulz
f220cb0e23 Revert "Editor: Make line spacing adjustable"
This does not work with text wrapping since there are multiple
QTextLines inside a block but we can not adjust the line hight inside a
block. This needs to be addressed inside Qt.

This reverts commit dc64f3207b.

Change-Id: If6c28056da9891eeeb75f5939a42f08360013a80
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-20 04:35:42 +00:00
David Schulz
05ad4e3daa TextEditor: fix selection highlight
Also compare the anchor when looking for the selection. Otherwise we
might get a selection highlight that expands on adjacent extra
selections like code model warnings.

Change-Id: Ib8460c1089ed69d14b7a408ca70e7ac1f8642f6e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-19 04:16:13 +00:00
David Schulz
3c281aa483 Editor: Select moved text after drag and drop
Fixes: QTCREATORBUG-24245
Change-Id: I9da52424128825f729d5d20e2c7fd095120477c6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-06 07:54:27 +00:00
David Schulz
dc64f3207b Editor: Make line spacing adjustable
Fixes: QTCREATORBUG-13727
Change-Id: I3dbc3277795b339bced81dc6c5a048c828183cb6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-01 12:11:09 +00:00
David Schulz
f6b3f41d19 Editor: Skip auto inserted characters with tab
Fixes: QTCREATORBUG-12641
Change-Id: I9800b939118d1e46d202454a66729cd81d2c08b3
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-29 07:17:05 +00:00
Eike Ziller
bbe95b5733 Qt6: Various include, QPrinter, and QFlags adaptations
Task-number: QTCREATORBUG-24098
Change-Id: I7aca7d25a063c84d6eec14c2c5789357ce56a7b3
Reviewed-by: hjk <hjk@qt.io>
2020-09-28 15:51:21 +00:00
Eike Ziller
cc502e3667 Remove bool return value from IEditor::restoreState()
It's never used, and actually there wouldn't be any sensible thing to do
with it.

Change-Id: Id8a8df18c7db4b98e5abbc034240bb90dc1dcaa9
Reviewed-by: hjk <hjk@qt.io>
2020-09-24 13:02:56 +00:00
Eike Ziller
423ea729f8 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/mcusupport/mcusupportoptions.cpp

Change-Id: I3fd0d0a6a3ff30bb990da3dc0f78e69f9e1247ef
2020-09-23 10:11:44 +02:00
David Schulz
da2e8bbf7b Editor: fix hanging when using invalid printer page rect
Some printer seem to return an empty page rect for some configuration
which results in an invalide page count and a freezing ui. Do not print
anything and return in that case.

Fixes: QTCREATORBUG-24110
Change-Id: I42349bc97734e3f6a67502482d2b02959e865665
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-21 10:18:29 +00:00
David Schulz
d99e00c49f TextEditor: allow highlightings in selections
If the selection foregound color is undefined do not overwrite the
already applied highlighting.

Fixes: QTCREATORBUG-24656
Change-Id: Ia125e8e6b9efba73d5a13facc2446a793d59f5c3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-21 07:16:43 +00:00
Eike Ziller
20f51bc642 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	src/plugins/languageclient/languageclientcompletionassist.cpp

Change-Id: If12e1c532e5623ef063681309a918e7b51117b1c
2020-09-14 10:12:14 +02:00
David Schulz
3b23cab385 TextEditor: Use selection format from the setting
Overwrites the format generated by QPlainTextEdit::getPaintContext()

Amends 9182d4eda7.

Fixes: QTCREATORBUG-24479
Change-Id: Ia226a74442dbbdbae42e8da5dee9e4d7399b677c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-09-11 11:48:29 +00:00
Eike Ziller
7aa0b1ea6b TextEditor: Fix build with Qt6
Adapt to QStringRef and QAbstractItemView::viewOptions() removal

Task-number: QTCREATORBUG-24098
Change-Id: Ia2d446312f68bd60143796284d31f5bba56aa0ed
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-09-08 07:47:30 +00:00
David Schulz
dba4bff703 TextEditor: use Utils::FilePath as file member in AssistInterface
Change-Id: I3bf9b013b9350411f918efdb9d1a36a2c22bf972
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-04 10:14:21 +00:00
Eike Ziller
5183994a30 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: Ibb60b8a7ac531b239bb9c490da843d5cc1a6300a
2020-08-14 13:31:05 +02:00
David Schulz
462a0f5b5d Editor: add log for printing
Task-number: QTCREATORBUG-24110
Change-Id: Ic4fef2e268cf3adf852a3ce7b229cb98356bbc5e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-08-14 10:05:50 +00:00
hjk
d3d683ec63 Core/TextEditor: Replace QTimeline::setCurveShape
... by setEasingCurve().

Deprecation for 5.15.1/removal in 6 is looming.

Task-number: QTCREATORBUG-24098
Change-Id: Ic116cf78b8468f03f6b01e0b7af56584289589cc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-16 10:33:21 +00:00
David Schulz
9182d4eda7 Editor: Do not use the editor palette to store editor scheme colors
Otherwise all editor ancestors like scrollbars might get an incorrect
palette.

Fixes: QTCREATORBUG-24270
Change-Id: I133cd1dbe284282122972130666c280ea412ea1a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-08 04:17:04 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +00:00
Friedemann Kleint
2bc4d82d31 Fix crash opening UI files
Add a null check, amending
aaa1376576.

Fixes: QTCREATORBUG-24241
Change-Id: I63e76b9d2dd10034b637f8f3cac5001b15b35d30
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-06-25 05:26:14 +00:00
Christian Stenger
d47f8eaff2 TextEditor: Utils: Do not use invalid regular expressions
Having a search inside a document and switching the find options
to use regular expressions may end up in lots of warnings
regarding using an invalid expression for a match call.
Check beforehand to avoid this.

Change-Id: Ia929090ae3910ff3fa87b57a5718293d2b6ccd04
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-06-22 09:19:59 +00:00
Eike Ziller
7c5ed6f7d9 Move InfoBar to Utils
The only reason it was required to be in Core plugin, was its use of Id,
which now is available in Utils.

Change-Id: I66ce863c24924e6448d339b3422538a7fe167336
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-06-18 06:39:54 +00:00
David Schulz
aaa1376576 Editor: Allow setting the optional action mask per editor
Instead of just enable actions that were disabled from the beginning you
can no disable optional actions.

Change-Id: I986b8a72523a8aeec9f4ccf76cd4921018ffc003
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-17 09:47:44 +00:00
David Schulz
5f91985931 Editor: enable optional actions per editor
Use an additional action mask to enable actions like find usage and
rename symbol per editor instance.

Change-Id: Iabee1820d0f3c156ad30ba760bfce9f6181045e6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 07:51:35 +00:00