diff options
| author | Sami Shalayel <sami.shalayel@qt.io> | 2023-07-19 13:31:17 +0200 |
|---|---|---|
| committer | Sami Shalayel <sami.shalayel@qt.io> | 2023-08-17 13:55:33 +0200 |
| commit | cb8c2cdc5dfee2ba7da045e30ee6623724156b15 (patch) | |
| tree | dd6e3242cbff025162cdbf49ba342f68950f7ca4 /tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp | |
| parent | b6c89c0d1354f24e26c3df45a3524e363c4116bb (diff) | |
qmlls: disable features on invalid QML documents
Some features like "go to definition" or "find usages" or "rename
symbols" do not work like expected on invalid documents, so disable them
instead of showing outdated or incorrect information to the user.
Before this commit, these features would use the last known valid
document to perform their search, but that leads to weird behavior:
wrong locations are highlighted or jumped to, and rename might ask to
replace text at positions that do not exist.
An easy way to reproduce this is just to add a newline inside a keyword,
e.g. "property int helloProperty" -> "prop\nperty int helloProperty",
because then all the findings under the changed line will be off by one
line. It looks very weird and unprofessional and its not clear at all
for the user what causes this.
Therefore, when trying to find or rename usages, going to definitions or
type definition, print a warning in the IDE that these functionalities
do not work for invalid QML documents, and that they have to try again
after removing all the invalid QML code.
For reference: clangd seems to also disable its code navigation features
on invalid C++ code.
As a drive-by, to avoid code duplication, add a ResponseScopeGuard class
that sends a response at the end of the scope. It will also help in the
future with error-handling using its setErrorFrom()-methods that checks
a result for errors.
Change-Id: I460f3891df17b79bf49c9b6a5f5798165250a16b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp')
0 files changed, 0 insertions, 0 deletions
