Commit Graph

1464 Commits

Author SHA1 Message Date
hjk
320a0da060 QmlJsEditor: Work around moc-produced 'using namepace'
... for QmlJsEditor::QmlJsEditor causing ambiguities.

Change-Id: If15a0cb0410093857848b871d7f99c84b1b35826
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2024-01-16 11:48:53 +00:00
hjk
53ebc15918 QmlJsEditor: Hide plugin class definition in .cpp
Change-Id: I7d6325059aedd92b34072de1fbb05bc72fc95efd
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-16 09:50:00 +00:00
hjk
63374fb34d QmlJsEditor: Don't export Internal classes
Export two functions doing the actual work instead.
Centralize some repeated code.

Change-Id: I7de674ef7ae5537663d1227d36cc556c4ee3ed74
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-09 16:17:37 +00:00
Xavier BESSON
90368e2bba QmlJsEditor: navigate from QML code to C++ code
Fixes: QTCREATORBUG-28086
Change-Id: I00acfe49b8e74aa057cb59d8c951d477f8ad487e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-12-20 15:03:39 +00:00
Alessandro Portale
fc3291afed Utils: Proliferate use of <utils/mimeconstants.h>
This deduplicates several mime type strings.

Change-Id: Ib1746387e233ca5b7134e65859b5ec1c7832b8e4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-12-19 09:38:10 +00:00
Christian Kandeler
3b7d29d2a1 Utils: Add formatting information to ChangeSet::EditOp
... and make use of that in TextEditor::RefactoringFile.
This allows calling code to have fine-grained control over which parts of
a refactoring should get re-formatted, while also providing sensible
default values that are "almost always" right, so things typically work
as expected out of the box.

Change-Id: I9200c2135b7477c33bc5a61c5d410b34853e4b61
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-12-13 12:29:08 +00:00
hjk
016936a450 Clean up some lambdas
Change-Id: Id947c0935b1aa4579e1c64d3e510db41103fbe27
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-12-12 10:55:32 +00:00
Artem Sokolovskii
62ea85ee6a SyntaxHighlighter: Move SyntaxHighlighter to separate thread
This change involves the relocation of SyntaxHighlighter processing
to another thread. The core idea is to create a duplicate of the
original TextDocument using SyntaxHighlighterRunnerPrivate::cloneDocument.
A new SyntaxHighlighter is then instantiated by SyntaxHighLighterCreator
for the cloned document. The entire SyntaxHighLighterCreator class is
moved to a new thread, where it performs highlighting on the cloned
document. Upon completion of the highlighting process, the resultsReady
signal is emitted, and the updated highlighting data is applied to the
original document.

This shift of SyntaxHighlighter to another thread enhances the user
experience by preventing UI slowdowns during the highlighting process.

- Introduction of BaseSyntaxHighlighterRunner as an interface class for
future *SyntaxHighlighterRunner.
- Inclusion of DirectSyntaxHighlighterRunner class for performing
highlighting in the main thread, suitable for syntax highlighters
that cannot be moved to another thread.
- Introduction of ThreadedSyntaxHighlighterRunner class for highlighting
in a separate thread, preventing UI blocking during the process.
- Addition of Result data to the SyntaxHighlighter class to facilitate
data exchange between threads.

Task-number: QTCREATORBUG-28727
Change-Id: I4b6a38d15f5ec9b8828055d38d2a0c6f21a657b4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-12-11 09:55:02 +00:00
Christian Kandeler
ba249a3514 QbsProjectManager: Add a language client
... and use it to follow symbols that QmlJSEditor does not know about.
For now, the only implemented case on the server side is getting to a
product or module via a Depends item.
More functionality will follow.

Change-Id: I597c7ab10f4bf6962684ed26357dfc0eef3a6c15
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-27 13:00:36 +00:00
Christian Kandeler
240748c106 TextEditor: Get rid of extra indent ranges in RefactoringFile
Having extra indent regions complicates the interface, the
implementation and the calling code.
Instead, derive the indent regions from the change set and let callers
opt out for the relatively few cases where indentation is not desired.

Change-Id: I49d2854830a51778534ef260fb5c9f2c7685554a
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-22 13:47:16 +00:00
Artem Sokolovskii
4bfc3476f4 SyntaxHighlighter: Move highlighter creating to TextDocument
Added setSyntaxHighlighterCreator function to TextDocument
which allows the creation of highlighters inside TextDocument.

Change-Id: I454f800c878c48a154dad5abd68b7a4f9ceb378a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-20 14:52:20 +00:00
Christian Kandeler
78b9edd251 TextEditor: Rename class RefactoringChanges
... and remove outdated comment.

Change-Id: I6dcd0a38608192ccdd6734affd33e170d39e8299
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-20 14:37:19 +00:00
Christian Kandeler
e7073421cc TextEditor: Remove RefactoringChanges::createFile()
Dissolve into only caller.

Change-Id: I2eaac8bf31c0ecd2dfb863b7fae79af557ccad95
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-20 14:35:51 +00:00
Christian Kandeler
413a6a6fde TextEditor: Make RefactoringChanges::file() virtual
More preparation for de-virtualization of RefactoringChangesData.

Change-Id: Ib5f7782a8dcaa2ae093b62aebedbd7bae9d4c3f1
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-11-17 08:37:14 +00:00
hjk
6685f0255d Utils/all: Move mime constants into a central place
They are reasonably standardized, and generally usable cross-plugin,
so this can help to avoid a few cross-plugin compiletime dependencies.

Change-Id: Icb2b010c3e12dee69df54ab16f6f8e90d9cffba6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-11-08 09:59:26 +00:00
Eike Ziller
1058ece953 QmlJsEditor: Fix crash when updating outline view
If the outline view is set to not show all bindings, it can crash after
writing code that temporarily produces an element after the cursor that
is interpreted as the child of a NonElementBindingType. In the bug
report that is a temporary structure of

* Window (element)
  * ...
  * Rectangle (element)
    * ...
    * y (non-element binding)
      * y (element binding)
        * Text (element) <- this gets selected in the global outline

When an element is selected in the global outline, the outline view
searches for the first element in the parent hierarchy for which the
source index is successfully mapped to its filtermodel.
(QmlJSOutlineWidget::updateSelectionInTree)

Since filterAcceptsRow only explicitly filters out items that are non-
element bindings, the "Text" element in the above example is "not
filtered out", and is set as the selection in the outline view, even
though it is not visible because one of its parents is filtered out.
That leads to a crash later on.

Make sure that filterAcceptsRow explicitly filters out any item that has
a NonElementBindingType in its parent hierarchy.

Fixes: QTCREATORBUG-28862
Change-Id: I1091daae140f13ea7fea7bb637953f51348c3b63
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-11-06 15:15:08 +00:00
David Schulz
a18ea390e1 LanguageClient: Fix crashed client restart condition
Change-Id: I4b0195a512b6b1dcbcc6fd02f6014a27b4606ea0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-20 10:47:44 +00:00
Eike Ziller
a253a2aa95 Tr: Fix lupdate issues
Add missing `Tr::` and use some fully qualified namespaces where lupdate
fails to resolve it correctly.

Change-Id: Ied4ac7bf0438a9080d0b76a9a1f5033dbc94a163
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-18 11:21:52 +00:00
Tim Jenssen
85ea2758ac Merge remote-tracking branch 'origin/qds/dev' into 12.0
Conflicts:
	share/qtcreator/qmldesigner/connectionseditor/SuggestionPopup.qml
	share/qtcreator/themes/dark.creatortheme
	share/qtcreator/themes/default.creatortheme
	share/qtcreator/themes/flat-dark.creatortheme
	share/qtcreator/themes/flat-light.creatortheme
	share/qtcreator/themes/flat.creatortheme
	src/libs/utils/CMakeLists.txt
	src/plugins/CMakeLists.txt
	src/plugins/qmlprojectmanager/qmlproject.cpp
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp

Change-Id: Idd87c281e1aa7b7fd2702473ad55e18563cbfb21
2023-10-05 15:53:42 +02:00
David Schulz
80633a59aa LanguageClient: support additional goto targets in symbol support
Allow to follow to the symbol definition as well as to the type
definition for the symbol under the cursor position.

Change-Id: I8ff50b33a1e739f81b0832b1b28ffc525e1f7177
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-29 09:10:14 +00:00
hjk
7a4e66992c Utils: Streamline QtcSettings interface
Change-Id: Icd9592c0fca5df1e52bdafb570665d92deeb70bb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-28 07:00:05 +00:00
hjk
0eacd0190d All: Remove some unneeded #includes
Change-Id: If9a8fb5e0b32424e3b37ecf3adefc060f86b3630
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-27 13:50:38 +00:00
hjk
342e066886 Utils, all: Standardize on QtcSettings
Change-Id: Id222016f15b1c3bfe6710fe5d0297666d4565ef1
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-27 13:25:31 +00:00
Sami Shalayel
77b368045c qmljs: use qmlls for 'go to definition'
Use the language client in qmljseditorWidget to do 'go to definition'
aka 'findLinkAt', when the language client is enabled.

Also move static helper method getQmllsClient up in the file.

Task-number: QTCREATORBUG-29567
Change-Id: I4f9132ba5f6bffc5090f3b1f7f6ccfd0c7b40e2a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2023-09-20 12:59:27 +00:00
Aleksei German
949612c23e QmlJsEditor: Fix crash on mode switch after save
Task-number: QDS-10709
Change-Id: I0eceef3815b6358d88329828d199d5918a273edf
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
2023-09-19 17:00:46 +00:00
Tim Jenssen
1a3a8ecc96 Merge remote-tracking branch 'origin/qds/dev'
Change-Id: Id242ab4ca485527defdcc1555d204e12e50ddb7a
2023-09-14 17:37:24 +02:00
Eike Ziller
dab19c4a8c Use Nanotrace to generate startup performance report
Add various trace points to the code, including the plugin
initialization methods (centrally in plugin manager), code that is
scheduled on the event loop with QTimer::singleShot or
QMetaObject::invokeMethod during initialization, and code that is
triggered from ICore::coreOpened

Can be turned on by configuring with `BUILD_LIBRARY_NANOTRACE=ON`
Run with `-trace <file>` to write trace file. If Nanotrace is not built,
the added code expands to nothing.

Changes in Nanotrace:
- turned generated data to microseconds instead of nanoseconds, because
  that is what Chrome tracing expects
- fixed serialization of duration (needs to be an item of the event, not
  in a "arg" subitem)
- fixed shutdown() to reset the initEvent

Change-Id: I994de82023b820d771e1be0a859ebd8da0b73d4d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-12 07:32:07 +00:00
Sami Shalayel
25e1266c26 qmljs: add option to disable builtin codemodel
Add an option in the QML Language Server settings to disable the code
model, for now it allows to use qmlls for renaming and find usages
operations.
Some of the checkboxes in the qmlls settings were not making a lot of
sense, rephrased them to be easier to understand for the user.

TODOs for later commits:
* use qmlls for 'go to definition' aka 'follow symbol under cursor'
* add extra action to the context menu for 'go to type definition' and
  implement it using the language client
  * also, remove builtin codemode stuff from the context menu when the
    builtin model is disabled

Task-number: QTCREATORBUG-29567
Change-Id: I6283d99bd2b5dc8aef7df49994eb313bfbb854c6
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-09-07 07:11:34 +00:00
hjk
e0ebce5379 QtSupport: Split QtVersionManager in a early and late constructed part
Change-Id: Iccf3f0e6c927fba1d5a9065978cc545d96185060
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-06 09:46:31 +00:00
hjk
b9188fb747 QmlJSEditor: Remove unneeded indirection via qmljsicontextpane.h
Change-Id: I39989fdb697dc7078a01f9582b790ee91021e3ab
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-05 07:14:18 +00:00
hjk
c4f2c14aa2 QmlJsEditor: Delay construction of QuickToolBar
It's now apparently created when the first .qml file opens.

Change-Id: I4bcd84d29da268565ee6e771f8c56c8b07ecdaf3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-04 13:40:06 +00:00
David Schulz
4ee863060a Qmlls: only update latest qmlls if the setting is enabled
Change-Id: I0adb24db3a944c6a400cfd84e10974f9bdc0d560
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-04 12:29:26 +00:00
Sami Shalayel
79cc12ab8c qmljseditordocument: fix quickfix shortkey
QtC shows qmlls's warnings, but does not apply quick fixes to it when
using the quickfix shortkey. In quickFixAssistProvider, use the base
class implementation to detect running language clients and apply their
quickfixes, and fallback to the builtin qml code model quickfix if no
language client is running.

Fixes: QTCREATORBUG-29557
Change-Id: I75262d13ab229f8d3b4069fc0003574d41cabab0
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-04 11:08:07 +00:00
hjk
8d0aa34bfc Plugins: A bit more Keys and Store
Change-Id: Iee55eeaa881dd9f2047fdbe95ad8d827f4ba34e0
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-25 08:00:02 +00:00
Marcus Tillmanns
73c5cf29c4 Utils: Add missing connections to validChanged
FancyLineEdit and PathChoosers valid state can be
asyncronously update, so users need to connect to the
validChanged signal to correctly update the UI and not
just to textChanged, or rawPathChanged etc.

Fixes: QTCREATORBUG-29525
Change-Id: I706fef61f6228af7dae9271a146cf739c3202cc7
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-08-22 13:45:46 +00:00
Ali Kianian
86d4fbab79 QmlDesigner: Import only mandatory libraries or directories
Only mandatory files are imported by the newly created component.
In the case that the import data is empty, All parent imports would be
included.

Task-number: QDS-9829
Change-Id: Ie96e2bc04a10e00b15ae12c5e58b5dc2392886ae
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-15 13:55:49 +00:00
hjk
1818236b2b Utils/QmlJS: Move contents of utils/json.{h,cpp} to qmljs
This is a special version of JSON only used in the QmlJSEditor,
demote it accordingly.

Change-Id: Id21ea16c022fb8554d87e9ba90c3494978e4cd80
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-08-15 07:11:07 +00:00
Jarek Kobus
8dd46d0399 Various Plugins: Simplify return FilePath statements
Change-Id: Ia9efb86f722caca1492b577d51442f1f23b804b4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-08-02 08:19:23 +00:00
Eike Ziller
a419670ff5 Build: Change plugin json.in files to CMake style
They were still using variables in qmake style.
Directly use CMake variables in the json.in files and remove the no
longer needed escaping of quotes.

Adds a fatal message if it detects the old style in a .json.in file for
easier porting.

Change-Id: I8de88d8db2da55781f0e9d72eda03f943723188e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-07-25 13:21:16 +00:00
Eike Ziller
77c7e26779 Tasks: Show tool tips with information about the categories
When hovering an entry in the filter menu in the Issues view.
Also remove some categories that shouldn't be there.

Change-Id: Ifb367d69b9396c2fdc45b83ec5ffd88ac2f0eda7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-13 06:09:27 +00:00
Eike Ziller
cd1b6a669b Tasks: Create a container class for category data
Reduce the number of arguments that need to be passed around.

Change-Id: I9fbfdcdf7b20f8f26e35f435bf8d65ba483e4114
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-12 06:34:25 +00:00
David Schulz
81e8c67686 Utils: add convenience function to ChangeSet
Creating a QTextCursor just for the ChangeSet gives no benefit for the
calling code, but reduces the readability.

Change-Id: I34acb6083b6f7ab54fce042e29cd6e80498338ef
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-07-04 10:46:40 +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
c35dca17b8 Some more tr fixes
- avoid manual line breaks
- fix plural
- add some translator comments
- explicitly name an output pane
- use imperative for placeholder text
- it is a Markdown editor nowadays, not a viewer

Change-Id: I8418cfe0294c028b7d873305db0af4c25bc1097f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-14 06:10:53 +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
Christian Stenger
c377794c35 QmlJSEditor: Change way of writing settings for static analyzer
Instead of writing out a binary blob use a string list when
reading or writing the settings.
The setting is introduced with QC11 the first time, so this
should not harm too much - therefore no transition of old
settings have been added.

Change-Id: Ica4654f49b71478cb07434dff9d42fd9562be87b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-06-12 07:05:12 +00:00
hjk
37d2240dfc Some more Qt deprecation
s/type/typeId/

Change-Id: I403af524146f0582709c1264e7517d8769dd723b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-09 09:38:20 +00:00
Jarek Kobus
deb74751fb Various plugins: Reuse QScopeGuard instead of ExecuteOnDestruction
Change-Id: I3341342bc763fade5ad9dcb854928e5499287472
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-07 10:34:41 +00:00
Eike Ziller
ee6789c523 Centralize a PluginManager::isShuttingDown() status
Instead of keeping track of this in plugins individually.

Change-Id: Ia2650f0f647d4a63d2010cef688aa56f6020c338
Reviewed-by: hjk <hjk@qt.io>
2023-05-23 07:19:42 +00:00
Jarek Kobus
c879aeb565 SearchResultItem: Introduce SearchResultItems
And reuse it.

Change-Id: Ia052297340f2bf2478fbfdb2427b45e30bd9d067
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-08 06:41:41 +00:00