Commit Graph

20 Commits

Author SHA1 Message Date
Sami Shalayel 3a985babf9 qmlls: move into own private static library
Qmlls was completely implemented in the ./tools directory, which made
its code complicated to test and try out. Also, it required some "dirty"
hacks in the actual tests (including files from others targets to be
able to use them) and made testing new features for qmlls more
complicated.

To remedy this, the qmlls code was split into a tool (qmlls) and
a static library (QmlLSPrivate). The tool only contains
tools/qmlls/qmllanguageservertool.cpp (which has the qmlls main method)
and links to QmlLSPrivate, that contains all the other qmlls-related
code. This way, the tests can also link to QmlLSPrivate and test out
individual functions there without needing to include files from other
targets.

Also rename all the files to make syncqt happy (adding "_p" to headers
and prepending "q" to headers and files and includeguards), and use
QString::fromUtf8() to silence the QString()-constructor deprecation
warnings.

On the way, move tools/shared/qqmltoolingsettings.* into its own private
static library, instead of recompiling it for each tool that requires
it. Move the qqmltoolingsettings stuff into the qt namespace to be
usable.

Also, add qmlls as a dependency to the qmlls tests to avoid testing an
outdated qmlls-binary.

This commit prepares qmlls's code to implement the go-to and
find-usages features.

Task-number: QTBUG-109006
Change-Id: I91eed689c68a0c53fb88006de335b0f852cc1a83
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-02-07 19:23:13 +01:00
Amir Masoud Abdol c2d37f9646 Retire the qt_parse_all_arguments
Task-number: QTBUG-99238
Change-Id: Ia11c9cbd7c06347319ab3674ec0cd8da0214747e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-20 16:40:42 +01:00
Ulf Hermann d77169117f qmlls: Re-enable tests
The qmlls binary was moved back to bin.

Pick-to: 6.5
Change-Id: Ie14a8562df320b0b76902ce36f6228fda57d4b67
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-17 00:03:56 +01:00
Ulf Hermann aae67e762d qmlls: Output warnings as-is in tests
qmlls is quite chatty. To figure out what is going on, just pass the
warnings through rather than stringifying them all together.

Change-Id: If01bc75975b0d7b31c41c77529c3a5ccf87caefc
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-01-16 09:49:05 +01:00
Marc Mutz b30a49f2c6 Port away from deprecated _qs UDL
Use Qt::StringLiterals::_s instead.

Also reflow lines because stricter /Zc options coming in from a
qtbase update make MSVS barf on line-broken u"" ""_s expressions.

Change-Id: I95a2a3d878d2ac506d9c54bbdeb734cf5d94bb8b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-10-18 18:30:41 +02:00
Lucie Gérard 1b9808737a Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: Id89ed14990804a5024183e75382cc539d4293da1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-07 17:01:30 +02:00
Fawzi Mohamed 8e6dcc04fc qmlls: fix import as resolution
Import as resolution (i.e. finding a type that was imported with an import as)
was broken in two ways: the shortcut looking for types did look only to types
imported without as, and the normal lookup for symbols declared the ImportScope
as visited (to avoid loops) too early in one case and would skip it.
This was visible in qmlls completions of Controls.

Pick-to: 6.4
Change-Id: Ifc1e777973ddc251bd0685290e8d28bfb025f269
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-12 15:10:01 +00:00
Alexandru Croitor a8431a4067 CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers
Change-Id: I1cd769f85d5f82c43639d6787d98e536619249e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-28 14:58:42 +02:00
Fabian Kosmale 9c8e04f989 tst_qmllscompletions: Correctly handle test failures
testlib's VERIFY and COMPARE macros only work in the function directly
invoked by the test framework.

Temporarily use a copy of the upcoming QTEST_CHECKED marco from testlib
to check that the indirectly called functions actually behaved
currently.

Moreover, move the call to the clean function into a scope guard, so
that it also will be called when the callback returns early due to
failed testlib change – otherwise, we'll end up waiting until the
timeout in QTRY_COMPARE_WITH_TIMEOUT.

Pick-to: 6.4
Change-Id: I371c021f55f11e32950b12a57cf52ad0edb1fd7b
Reviewed-by: Moody Liu <mooodyhunter@outlook.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-07-26 22:31:42 +00:00
Moody Liu 0063be4ba1 qmlls: improve completion for functions
use return type for function "details" and add documentation
support by reading comments above a function declaration

Change-Id: I788a47fa574e8e3c4034dc0fa3c3b23c4de264f9
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2022-07-14 16:46:25 +01:00
Lucie Gérard 5a7b716474 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-07-08 10:41:06 +02:00
Moody Liu 0d48b7045a qmlls: append a colon with a space after property completion
this improves user's coding experience

Change-Id: I321fd635528bd9faec829ef7b8a592925119d56f
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2022-06-25 00:30:43 +01:00
Moody Liu 3b408c28a8 qmlls: de-duplicate the completion list of the 'import' statement
Task-number: QTBUG-103765
Change-Id: Id4cbd874e8c237f02c991cc60cc1d272c2eceb48
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-22 21:58:32 +01:00
Moody Liu 193f16ffd0 qmlls: tests: fix qmlls binary path
it's installed in libexec, not 'bin' since 399cdef52b

Change-Id: Id6aa6e76af6f265225d8a91aa6d386b1af384c15
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-22 20:58:24 +00:00
Lucie Gérard 0dc4fd240a Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-11 08:05:15 +02:00
Moody Liu f65fac1514 qmlls: use CompletionItemKind::Class for QML types
Change-Id: Ia121463cf4352bedc03475268f38ce32c0073d50
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-26 11:57:35 +01:00
Moody Liu 615e9b3348 qmlls: use proper completion item kind for properties
also add some tests to verify CompletionItemKind based
on current completion output.

Task-number: QTBUG-103765
Change-Id: I1ddf6cf5764f18fef28fe21d1a95d2f5c935ba9a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-25 08:21:07 +00:00
Fawzi Mohamed 97e6e5615d qmlls: completions for ids
Fix completions for ids and "." sequences in general.
At the moment does not add attached types and their completions.

Change-Id: Ia62adcf1264f570da43f532fd6679e99c63fe853
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-19 15:48:33 +02:00
Fawzi Mohamed f07c62d487 qmlls: add custom notification to set build directories
add an optional notification $/addBuildDirs to communicate
to qmlls the build directories connected to a give uri prefix.

Change-Id: Ic47b941f960195b63c17e26ca5de329d12fec362
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
2022-05-19 15:47:09 +02:00
Fawzi Mohamed 538600cf5a qmlls: completion support
Add support for completions to qmlls. This is a preliminary support
that uses QmlDom. For this reason it has some limitations, mainly
that it only uses QML types, no js completions are provided,
and no type propagation is kept into account.
On the plus side it is immediately up to date when dependencies
are updated.
The completion tries to find in which part of the qml file one is
and distinguishes mainly 4 parts:
* outside all QmlObjects
* in an import
* in a QmlObject, declaring a new binding
* in a script, or similar
It looks at the position in the editor and ts context, namely:
* the word before the cursor (which is used as filter in the client),
* the dot expression before that word
* the whole line before the cursor.

Change-Id: Iefd1332451c060d3d10c68bb427b26c1bc020666
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-19 11:03:39 +02:00