Commit Graph

37 Commits

Author SHA1 Message Date
Christian Kandeler
8577ab8bcb ClangCodeModel: Bump minimum clangd version
... and throw away old workarounds.
The current clangd version, to be shipped with Qt Creator 14, is 18.1, so
we can safely bump the minimum version to 17.

Change-Id: I74fd5997196d774b6c47dcb522284953ef82ad9c
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-05-24 07:58:22 +00:00
Christian Kandeler
cc763c80d7 ClangCodeModel: Improve debug output for semantic highlighting
Previously, the final highlighting results we showed were incomplete and
out of order.

Change-Id: If18062cc5a7f3156d6bb0b282aed33906cdef910
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-02-29 13:27:47 +00:00
hjk
570344b066 LSP: Avoid running strlen() on json keys
This feels better when stepping through the code but doesn't
really make a difference in the profile.

Change-Id: I2c30578bf1e990b039caadb8b8ce532f009b775d
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-12-18 10:30:30 +00:00
hjk
e2a370f280 LSP: Use 8-bit keys in Json wrapper
Sufficient, smaller, faster.

Change-Id: I0d740785109538e04fc674c11d578ded8d2815fb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-15 07:11:31 +00:00
Christian Kandeler
7b8117ba2f TextEditor: Add dedicated text style for C++ concepts
Fixes: QTCREATORBUG-29286
Change-Id: Ifc89bad0b84dfdbcac0720fc59799edd461c00bb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-20 08:15:50 +00:00
Christian Kandeler
f0a1591035 ClangCodeModel: Adapt to new "inactiveRegions" notification in clangd
See https://reviews.llvm.org/D143974.

Change-Id: Iff6cc39f7c567feee1953fde1ca96a9aefec75d4
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-06-08 11:06:15 +00:00
Christian Kandeler
24df1f1183 ClangCodeModel: Support new clangd semantic token for labels
See https://reviews.llvm.org/D143260.

Task-number: QTCREATORBUG-27338
Change-Id: I26eb3688f311d93c966901a6639931fec944dd49
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-06-07 14:00:37 +00:00
David Schulz
270972c7bb ClangCodeModel: report highlight results in one batch again
... with Qt 6.6

Change-Id: Ic3ebb5cee4deeebf87a0d8e0ab33bcdc1c92c3a2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-02 05:37:50 +00:00
David Schulz
9bb126c0d6 Utils: make column of convertPosition 0-based to merge it into Position
Change-Id: I239b3cb33b8ad59ac4097c919155ab5ca7d57b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-24 11:53:28 +00:00
Eike Ziller
0d8d4322b4 Merge remote-tracking branch 'origin/10.0'
Change-Id: Ie591b7130b33a042509e56701384f8ff4d9cb7f8
2023-03-16 11:57:01 +01:00
Christian Kandeler
25f1a4804a ClangCodeModel: Consider concepts in semantic highlighting
We highlight concepts as types for now, as it's a pretty good fit. We can
always introduce a dedicated concept highlighting type later if there is
demand.

Task-number: QTCREATORBUG-28887
Change-Id: I405db5ca4351efd565b968e765fe8bca976a2800
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-03-14 13:03:02 +00:00
Jarek Kobus
d6f5d07639 ClangCodeModel: Use QtConcurrent invocation for async run
Change-Id: Id404d3a7699f12cdbc1e51390b3e5218ab3459b6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-03-09 11:21:33 +00:00
Christian Kandeler
e771560ec7 ClangCodeModel: Do not traverse the AST in the semantic highlighter
... with clangd >= 17. We do not need to look at AST nodes anymore;
everything comes from the server.

Change-Id: I46eb91f26515e31b752020edbc32f1b23c1d79c7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-03 14:07:56 +00:00
Christian Kandeler
d7308cc7a6 ClangCodeModel: Ignore built-in types
... in the semantic highlighter. The syntax highlighter already handles
these.

Change-Id: Ib1e80ec194021dbd2b4eca7a300db869ccddb7b0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-03 10:59:41 +00:00
Christian Kandeler
7c6a00b4e7 ClangCodeModel: Ignore number literals
... in the semantic highlighter. The syntax highlighter already handles
these.

Change-Id: I26f6bca06c4fc648ffe59bd9e3639d81d2265755
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-03 09:33:55 +00:00
Christian Kandeler
c31522731c ClangCodeModel: Ignore boolean and pointer literals
... when doing semantic highlighting. The syntax highlighter already
handles these.

Change-Id: I048e033eda5b72d2e6eafaaccdb66040a00afe6a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-02 13:36:16 +00:00
Christian Kandeler
209e3d0e66 CppEditor: Fully handle raw string literals in the syntax highlighter
As of a3af941adf, the built-in highlighter
can properly handle multi-line raw string literals, so we don't need to
abuse the semantic highlighter for this anymore.

Fixes: QTCREATORBUG-26693
Fixes: QTCREATORBUG-28284
Change-Id: If644767dfa8a97294e84a541eea44143e8d1bb88
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-02 09:52:55 +00:00
Christian Kandeler
be9a01252d ClangCodeModel: Make use of new semantic token in clangd
... for angle brackets.
See https://reviews.llvm.org/D139926.

Change-Id: I17be843005e290a8aec91573d9ed4bd0727e2dab
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-02-01 11:06:54 +00:00
Eike Ziller
2688a9629c Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/libs/utils/pathchooser.cpp
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp

Change-Id: I7ae3f91618c4a4ccb088679caea72b2a81590960
2023-01-13 09:16:25 +01:00
David Schulz
91b5274276 ClangCodeModel: do not highlight tokens as Text
Fixes: QTCREATORBUG-28639
Fixes: QTCREATORBUG-28637
Change-Id: Idfcfc6c61db9d5449ab14eda566ce704160bac54
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-11 09:29:27 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Christian Kandeler
8d17762bb0 ClangCodeModel: Use newly implemented clangd support for operators
We now get a semantic token "operator" from clangd;
see https://reviews.llvm.org/D136594.
As a side effect, this results in the following subtle changes in what
exactly gets highlighted, both of which make sense:
    - The type part of a conversion operator is now highlighted as
      a type, not an operator.
    - We no longer add special highlighting for the brackets in
      operator new[] and operator delete[].

Change-Id: Ic149487496768762728a712c9fbcde5c9516529c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-13 09:38:34 +00:00
Christian Kandeler
918c7ca52d ClangCodeModel: Make use of new clangd token type "modifier"
See https://reviews.llvm.org/D137943.

Change-Id: I313576b32fff1c9ba44e3753e3f02cdd34e2ea3e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-23 09:52:33 +00:00
Christian Kandeler
f93c316b73 ClangCodeModel: Adapt to new upstream feature
See https://reviews.llvm.org/D130015.

Change-Id: I2c2590265f2d7a2c2b5e966b0dc65ceff6b1b3e6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-08 14:21:25 +00:00
Christian Kandeler
72c1c891fa ClangCodeModel: Adapt to new highlighting modifier in clangd
See https://reviews.llvm.org/D134728.

Change-Id: I2bcfb09736b6eabc54cd986b0c096c8fa5869b8e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-24 10:08:49 +00:00
Christian Kandeler
0759f55c00 ClangCodeModel: Make use of clangd's new "definition" modifier
See https://reviews.llvm.org/D127403.

Change-Id: I791b2396266810bfb3610a9f37565e4f01d67879
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-19 10:09:16 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Christian Kandeler
c1e6307545 ClangCodeModel: Catch exceptions in semantic highlighter
I've repeatedly encountered std::bad_alloc recently, and would like to
get more info about where it is triggered. The crash comes from Qt,
apparently after the original thread has alresdy finished, so the
original location is not found in the stack trace.

Change-Id: I7bbdcce6534ea0c846a69af33ad8634c3415572d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-27 07:55:49 +00:00
Eike Ziller
9d745e0f53 ClangCodeModel: Fix compiler warning
Change-Id: I68648ffe4ae3aa8bdfdf2706c1a65eb2269eaa1f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-14 07:57:56 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Christian Kandeler
1c0ef80861 ClangCodeModel: Fix semantic highlighting for __func__
This is a local variable, not a macro.
Also take into account the new upstream support for this (see
https://reviews.llvm.org/D131175), which required us to fix our
assumption that "static" always means "static member".

Change-Id: I69f3c98737571cbd55f9c64c02292426acb6031b
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-19 12:23:54 +00:00
Christian Kandeler
038835b024 ClangCodeModel: Remove redundant clangd version check
This was forgotten in 780f89b377.

Change-Id: I645e96bafcb2d431e74a7f203e911bbb062fb747
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 12:04:59 +00:00
Christian Kandeler
c9b1e3a744 ClangCodeModel: Remove ClangModelManagerSupport::instance()
Not needed.

Change-Id: I46ee3a493ddb59c4b5f0e3eb4443d7f348a6b074
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 10:22:08 +00:00
Christian Kandeler
2f169bdfcb ClangCodeModel: Make some ClangModelManagerSupport methods static
Change-Id: Ie34a89ae01783631c6482cff8d4866595e757be5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-08-02 11:21:16 +00:00
Christian Kandeler
9cbe2439dd CppEditor: Do not highlight macros as preprocessor statements
Macros are used like identifiers; there is no reason why they should need
to have the same highlighting as a preprocessor directive.

Fixes: QTCREATORBUG-23548
Change-Id: I186befc06ccb36a00451fd707c41e3687a84af14
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-29 09:08:27 +00:00
Christian Kandeler
b1e73ca45d ClangCodeModel: Try harder to catch bogus AST ranges
String literals that are adjacent after preprocessing are reported as a
single AST node, leading to potentially wrong highlighting.
We can catch this condition at least for the case where there are
semantic tokens in between the string components.

Fixes: QTCREATORBUG-27601
Change-Id: If023d06db74bd6cfefa670649f0e733ceaaede2d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-31 11:38:41 +00:00
Christian Kandeler
51b6aa7649 ClangCodeModel: Move highlighting code into its own set of files
No functional changes.

Change-Id: If6e5da7e79bf39e564f0f38520ae088f76543642
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-31 11:15:13 +00:00