Commit Graph

1332 Commits

Author SHA1 Message Date
Christian Kandeler
5f15e1f066 ClangCodeModel: Relax check for const-ness
... when detecting output arguments with clangd.
This should lead to fewer false positives. We plan to handle false
negatives on a case-by-case basis (rather than the other way around).

Change-Id: I541b418927dc410c2ea4ea9f6c1b5a7bd291a1a8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-12-10 08:40:34 +00:00
Christian Kandeler
fc3b7f7ac5 ClangCodeModel: Fix access type categorization for functions
... with clangd.
The code is starting to look rather hacky and might need to be rewritten
completely at some point. Let's see how far we get with it.

Change-Id: I506dd410831970b9f9291b005129b4d70f397de0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-12-10 08:39:57 +00:00
Eike Ziller
d422b408e0 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I32991a77e52831dd2e24cf4a51ec252998c2d743
2021-12-09 12:04:32 +01:00
Christian Kandeler
92e3eb722a ClangCodeModel: Another clangd cursor adjustment
This time for the case where we are after the last character of a
function call argument.

Fixes: QTCREATORBUG-26638
Change-Id: I634fa91e87103a7ae82e3a43246dfbc7069dbbdc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-07 16:08:28 +00:00
Christian Kandeler
7ffaa89f02 ClangCodeModel: Work around clangd cursor issue, part 2
Amends 825c9ea64f to work also for member access via pointer.

Change-Id: I8ee68d0f6d93c65c2f82a63bce5baef2aa2159de
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-12-07 14:00:18 +00:00
David Schulz
2405ccb271 clangd: Assert on generating tooltip for deleted client
Text marks for diagnostics should be deleted when the client dies. If
they somehow survive assert when creating a tooltip for those text
marks.

Task-number: QTCREATORBUG-26585
Change-Id: Iaebf0d2aba66d2a6c250f8dad7856ef03b1dcacd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-07 13:54:34 +00:00
Christian Kandeler
49c421e5c4 ClangCodeModel: Prevent duplicate "/Tx" options
Those trigger code model warnings.

Fixes: QTCREATORBUG-26664
Change-Id: I0ed6b9edeeb94c8597b30c0be514d2b34dbedc49
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-12-07 10:08:09 +00:00
David Schulz
7552c9958f TextEditor: move setIfdefedOutBlocks to TextDocument
The location of the blocks to marked ifdefed out are not tied to a
specific editor instance, but just depend on the document content.

Change-Id: I837730dc00e1d6060dd46bbb2cfccbfa5f72e6ce
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-06 05:17:51 +00:00
Christian Kandeler
825c9ea64f ClangCodeModel: Work around clangd cursor issue
If the cursor is right before the "." in a member access expression,
clangd interprets it as belonging to the member instead of the base
expression, which leads to unexpected behavior.
Work around this by sending a cursor position one to the left of the
real one to clangd in such cases.

Change-Id: I429ee9189760ccb02d231acfcb94ab6cfde3cd8d
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>
2021-12-03 11:17:17 +00:00
Christian Kandeler
0f9aa307a3 ClangCodeModel: Highlight Q_PROPERTY declarations with clangd
We re-use the moc parser for this purpose.

Change-Id: Ib0ef4f727d1f0b862a202a95a3ae9c551cb502a5
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>
2021-12-03 10:10:10 +00:00
Christian Kandeler
b2d63bf79e Fix various compiler warnings
Change-Id: Ib64f04f154b2c44dad3248ef038449c2ac628686
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2021-12-02 15:48:52 +00:00
Alessandro Portale
df1876f0d0 Remove nested margins in project panel wigets
While maintaining the margins in the respective option pages.

Change-Id: Ia7c0e9f68ab196be0d68632117041eca9f4b15f5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2021-12-02 08:08:14 +00:00
Eike Ziller
d62d0f305b Merge remote-tracking branch 'origin/6.0'
Change-Id: I71b19dd8ecd96a7a2a58622f68283b8635264e48
2021-12-01 09:24:05 +01:00
Christian Kandeler
1f2e25dd48 ClangCodeModel: Tighten the check for ambiguous calls
... when doing "Follow Symbol" with clangd. Not every call to a virtual
function is ambiguous.
Amends 4fe5be2565.

Change-Id: I7c31644510ca85d430a3e18b2ccad97548f71d54
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-25 09:29:13 +00:00
hjk
56009b8b15 Merge remote-tracking branch 'origin/6.0'
Change-Id: I0eae76ecff1a315877e4fdd471f0de3a3a55f180
2021-11-24 11:37:12 +01:00
Christian Kandeler
153dd2fe0b ClangCodeModel: Fix overly simplistic check
... when doing function call completion with clangd.
We did not take default arguments into account. E.g. the following
declaration:
    void func(int i, int j = int());
was mis-detected as taking no arguments, causing to the cursor to be at
the wrong location afterwards.

Change-Id: I522921721b0cb347ed593c43ed285ca6d02ccfee
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-24 10:00:20 +00:00
Christian Kandeler
0c53c2daef CppEditor: Do not overwrite extra selections from language client
The broken libclang-based implementation used to remove the correct
results we got from clangd.

Task-number: QTCREATORBUG-26339
Task-number: QTCREATORBUG-26596
Change-Id: I9b7c1214c376b616fe204986ed37c287e2307f81
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-23 16:44:37 +00:00
Christian Kandeler
7498b5523a ClangCodeModel: Fix another mis-highlighting with clangd
Output parameter marking strikes again.

Change-Id: Id98e07e87824a9db435d09482235d56c6808d42e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-23 16:43:37 +00:00
Christian Kandeler
c53e3f4893 ClangCodeModel: Treat function-like macros like functions
... when completing with clangd.

Change-Id: I8ffc0ff7a4a0f819f2ae48aabbb16609eb178178
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-23 16:42:23 +00:00
hjk
4de74a67ee Merge remote-tracking branch 'origin/6.0'
Change-Id: I773141d47e3f2b773da51f2e26ef53b93bb28f90
2021-11-22 13:18:08 +01:00
Christian Kandeler
f4070c4b43 ClangCodeModel: Do not report symbol references from non-existing files
... which we get from clangd's textDocument/references.
This works around https://github.com/clangd/clangd/issues/935.

Fixes: QTCREATORBUG-26574
Change-Id: I3933f30fdaca024a6e240bd0962de3d97acd0dbf
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-22 09:56:59 +00:00
Christian Kandeler
799ffe7e0e ClangCodeModel: Fix possible crash in clangd test
Change-Id: Ifb68b62f1076fa6b086717d7a5db939e52e5e9f2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-22 09:50:56 +00:00
David Schulz
897fbd8317 ClangCodeModel: show specific client name in diagnostic
Task-number: QTCREATORBUG-26585
Change-Id: I5edbe3ab40e91e2e5f8455b7a8d484a82c5cf6e6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-19 12:29:00 +00:00
Eike Ziller
eba4115b82 Merge remote-tracking branch 'origin/6.0'
Change-Id: I3bab4e31bc5993c59c7025ebde0846bf6c75810e
2021-11-19 10:44:15 +01:00
Christian Kandeler
037d2b3889 ClangCodeModel: Fix clangd highlighting of string literals
... passed to macros defined in a different file.
This amends e77e57420a. Contrary to our expectation, it is possible that
AST nodes that are marked as belonging (only) to a header file can
contain child nodes that belong to the main file.

Fixes: QTCREATORBUG-26553
Change-Id: I4d1d877d8e1e2dcf7d81b63aa98e1149b5514e3f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-17 14:46:37 +00:00
Christian Kandeler
03e6351c0e ClangCodeModel: Provide clangd memory usage in language inspector
Change-Id: I8a87cb5f267571584b2eecac06be65b841592c7a
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-17 13:43:59 +00:00
Christian Kandeler
5769dbe0aa ClangCodeModel: Force clangd re-highlighting on font settings change
Change-Id: Ie449a5329bd49eac116751e66a07602f316e147d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-15 14:35:02 +00:00
Eike Ziller
ff5bfe6f0f Merge remote-tracking branch 'origin/6.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I366a1a0e378811dfc9b4e6f42ec96426dbb15356
2021-11-15 13:14:24 +01:00
Christian Kandeler
76d3ffa57a ClangCodeModel: Clean file paths resulting from "follow symbol"
Apparently, libclang can give us non-cleaned paths, which we never
noticed until ea215d612d.
We also restore the previous behavior of TextDocument::setFilePath() in
order to prevent similar regressions elsewhere.

Fixes: QTCREATORBUG-26561
Change-Id: I218ed29600e9fb6b299aa2ba0b9d1464f475c06b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-11-12 14:38:25 +00:00
Christian Kandeler
95e8afabba ClangCodeModel: Handle UI header updates with clangd
We need to manually refresh the documents that include the generated
header, as clangd does not know about it.

Change-Id: I8c4303ac029bbb56c01aa99b7950dcc651701678
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-12 14:37:51 +00:00
Christian Kandeler
0c60370f3e ClangCodeModel: Fix Qt header completion with clangd < 14
The problem is fixed upstream, but this must work now.

Fixes: QTCREATORBUG-26482
Change-Id: I3b2e863efec0edf7eaa74d73eb94705aa28723cf
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-11-11 13:15:11 +00:00
Eike Ziller
164aae53d2 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	src/libs/utils/theme/theme_mac.mm
	src/plugins/android/androiddeployqtstep.cpp
	src/plugins/debugger/lldb/lldbengine.cpp

Change-Id: I5f2c62e0bce6c91a53a554b3278dbe23ff7dde36
2021-11-11 13:04:42 +01:00
Christian Kandeler
084dced9be ClangCodeModel: Provide signal/slot icons for clangd completions
Fixes: QTCREATORBUG-26555
Change-Id: I3b647f6fdbeed69bc453d64a69fb57731d92231e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-11 10:09:12 +00:00
Christian Kandeler
af647841cf ClangCodeModel: Fix erroneous marking of lambda parameter
... as output argument when using clangd.

Change-Id: I35ef2da235cb317bb7eb1f08b865ea62c27d3b76
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-11 09:27:08 +00:00
Cristian Adam
9d6b8727ee ClangCodeModel: Enable big object flags for building on Windows
Fixes problems with debug builds that link too many symbols into
the binary.

Change-Id: I6e95d6abd99a4f2a9a78764d8155a6e7b7fa8571
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-10 15:37:09 +00:00
Christian Kandeler
397cbd77ab ClangCodeModel: Fix highlighting problem with template types
With clangd, we mis-detected variables of template types as output
parameters in certain contexts.

Change-Id: I906abd489f987351793f4ef676e4af59cdfdbf97
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-10 09:04:52 +00:00
Christian Kandeler
35e57ca748 ClangCodeModel: Make sure not to overwrite macros with their expansion
... when highlighting with clangd.

Change-Id: I89ec8bf5a1ed4d43e0e9a398b26705df00ca9a46
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-08 13:55:15 +00:00
Christian Kandeler
9a16eb5fe6 ClangCodeModel: Inform clangd about changes to non-open files
That is, project-wide changes done from Qt Creator, such as search/
replace or quickfixes.

Fixes: QTCREATORBUG-26523
Change-Id: Ide4e56a7a1300eb6f25cabf1cfd94624d66e7e4e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-08 09:32:02 +00:00
Eike Ziller
3b9b9bdc0b Merge remote-tracking branch 'origin/6.0'
Change-Id: Ia7fc255ee8680e6beac5d4d878f446fe40873183
2021-11-08 09:46:57 +01:00
Christian Kandeler
a6a1423421 ClangCodeModel: Fix assertion in clangd timing logger
Change-Id: If5134e5160b8278b2d0ef7037a00abe3b4b035ad
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-04 13:24:47 +00:00
Eike Ziller
e6d31c2b37 Merge remote-tracking branch 'origin/6.0'
Change-Id: I560583b200db8f180574256d6d851a867be11c37
2021-11-04 13:52:30 +01:00
David Schulz
4d55fc911d clangd: disable lsp snippets
We have some additional handling with the completion items that might
interfere with the snippets.

Change-Id: I86405ec67af189d01c8a4dfa468f56035e6e69c4
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-04 12:07:18 +00:00
Christian Kandeler
4022043792 ClangCodeModel: Ignore redundant semantic tokens
This can now happen due to the newly implemented refresh support.

Change-Id: If64feede84b044140f7ec04e317289d3f493aa53
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-04 09:54:02 +00:00
Christian Kandeler
33b5fa25a8 ClangCodeModel: Do not mark the LHS of assignments as output parameters
... when using clangd. Amends a1f088376a.

Change-Id: Ief442d978e1cf3027dcba5a3c75b66c0f4ae8809
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-04 09:20:30 +00:00
David Schulz
426fde79d6 LanguageClient: support semanticTokens/refresh
Fixes: QTCREATORBUG-26499
Change-Id: Icd5879609bb856797fa223394357a1f15554d2cf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-11-03 07:46:50 +00:00
Eike Ziller
195abefe7d EditorManager: Remove QString openEditor(At) overloads
In favor of the FilePath/Link ones.

Change-Id: I5caf9e0f8de304ff4ee12329557aa50a6f3a0c69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-02 08:11:14 +00:00
Christian Kandeler
f08d0e3d3e ClangCodeModel: Prevent restarting the same clangd client more than once
Change-Id: Ifd81a26506e48817b97c8ed1e5fa16ebb31d8c69
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-01 14:20:02 +00:00
Christian Kandeler
bcebf65bb1 ClangCodeModel: Make sure clangd sends all results
... for textDocument/references. The --limit-results option was recently
split up; we have to set --limit-references as well now.

Change-Id: I979aa21a11a08e829b6e843c0c135098aac7d3f5
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-01 14:19:46 +00:00
David Schulz
a2cb1edb69 clangd: assert on starting client for project that already has a client
Change-Id: Ia50662063f7f7bdc26e5a842f7c25af4f4f4efdf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-11-01 12:56:48 +00:00
Christian Kandeler
6e5ec9a939 ClangCodeModel: Prevent indexing with fallback client
There is no project to index.

Change-Id: I6d3ad2f894a45e2a7934cfb3c10c525299bfd34b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-01 09:38:31 +00:00