Export two functions doing the actual work instead.
Centralize some repeated code.
Change-Id: I7de674ef7ae5537663d1227d36cc556c4ee3ed74
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
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>
... 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>
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>
... 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>