Commit Graph

37 Commits

Author SHA1 Message Date
David Schulz
5516188290 Docker: validate clangd version
Do not automatically setup a clangd that is too old and mark them as
invalid if they are manually selected.

Change-Id: Ie9662a8821df8fc678eabc4b8a08375723b4d1c3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-01-20 05:36:32 +00:00
Alessandro Portale
f7bcd4f574 CppEditor: Convert to Tr::tr
Change-Id: Ic4025e06e17c45eb6dc2162fb7f21f5b8aebe84d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-12 06:46:45 +00:00
hjk
4ddd28ae22 Utils: Rename QtcProcess::readAllStandard* to readAllRawStandard*
... and re-use the old QtcProcess::readAllStandard* names for
a QString-returning 'decoded' version.

For now, only use that in 'full Utf8' cases, to stay bug-compatible,
the plan is, however, to employ the QTextCodecs we have already
in the channel buffers. That will be one-by-one, though.

Change-Id: Id209e0671920d4ea4197918e872f441254112d52
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-10 12:08:53 +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
Orgad Shaneh
157f2bcd39 Merge remote-tracking branch 'origin/9.0'
Change-Id: I231d35f492713f317773b79478b5f7fb97a4fe50
2022-11-28 17:29:19 +02:00
Christian Kandeler
ed06978830 ClangCodeModel: Switch off clangd persistently
... after failed machine suitability check.

Fixes: QTCREATORBUG-28441
Change-Id: Ic0fb956168204d8023ff96f92ae3fcd7cea8b0e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-28 10:43:43 +00:00
Philip Van Hoof
55b8ab7846 cppeditor: make it possible to ignore patterns
Allows the user to ignore certain patterns so that these files wont
be indexed

Fixes: QTCREATORBUG-28313
Change-Id: I2a860a473ca1a267e9fab31436fc98b8f4004484
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-25 13:46:02 +00:00
Jarek Kobus
cd582faa7e CppEditor: Limit the usage of qMakePair and std::make_pair
Change-Id: I4c85edbaccb553320b5488d3dd2c2595fc2bd825
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-04 14:06:00 +00:00
David Schulz
e2352f1cc0 Clangd: add setting for index priority
Change-Id: I5f9ea8c31747d1cd1e1e6b77ab7c705a7f275cff
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-28 12:16:13 +00:00
Christian Kandeler
8beeea5b5e CppEditor: Add support for showing pre-processed source files
Fixes: QTCREATORBUG-4
Change-Id: I819709e69e604849264e745da98065829f7cb228
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-14 07:42:49 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +00:00
Eike Ziller
57745407de Clang/C++: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*
And instead of qgetenv.
Takes Qt Creator's setting at "Environment > System > Environment" into
account, which makes it easier on some platforms to set them (e.g.
macOS), can be configured differently in different settings paths, and
potentially can be changed at runtime (depending on usage).

Change-Id: I7678b8e429b5eff79f87eb637f6f2131be43d904
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-29 09:12:20 +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
Cristian Adam
de08f08a21 clangd: use QTC_CLANGD_COMPLETION_RESULTS as default value
If the user set the QTC_CLANGD_COMPLETION_RESULTS environment variable,
use that value as the default value for the settings page widget value.

Change-Id: I525e8bb4a5631b7d8461f18d1fc5c6972bd758cb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-03 09:15:56 +00:00
Cristian Adam
86b8f68f78 clangd: make --limit-results configurable in Preferences
The default value is the clangd default value: 100.

Fixes: QTCREATORBUG-27152
Change-Id: Icb6c67645b33325da591cb360c17b3dd55fc60ad
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-26 17:28:23 +00:00
Eike Ziller
91fb0cf123 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/plugins/qmldesigner/qmldesignerprojectmanager.cpp

Change-Id: I5106bb632c2a3a144287097137be45b0894b9ee4
2022-07-04 08:53:22 +02:00
Christian Kandeler
88956d1e9b CppEditor: Try to find clangd include path more generically
Linux distributions can get creative with the location of the clang
headers. So if we find a clang executable alongside clangd, ask it for
the base directory and try the hardcoded paths only as a fallback.

Fixes: QTCREATORBUG-27760
Change-Id: I9480b170df05598255c01be44be4b0312d0929f8
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-30 13:02:05 +00:00
Jarek Kobus
35e5520331 CppCodeModelSettings: Get rid of call to waitForStarted()
This is unneeded when followed by waitForFinished().

Change-Id: Ifc63feb2abbbc38bf4b119489ceb07320c383499
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-06-29 15:26:39 +00:00
Christian Kandeler
ea868c8b46 ClangCodeModel: Check system for clangd suitability on first run
Turn off clangd by default if we think the system does not have enough
memory. Inform the user and let them override our decision.

Task-number: QTCREATORBUG-19297
Change-Id: Ib9715c2f089c10d7a2a559a25180e9a943c118b1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-21 13:23:37 +00:00
David Schulz
21e254baca ClangCodeModel: return absolute path to fallback client from path
Change-Id: I9731aca47975e47756042fb8ed42c2f648e365ed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-16 10:26:53 +00:00
Thiago Macieira
0978d16093 CppEditor: Consider non-canonical path to clang includes
The include directory is under lib64/ on some systems.

Fixes: QTCREATORBUG-27623
Change-Id: Iba16e8ea451b444ab213fffd16f49dae865cd60e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-03 08:03:15 +00:00
Christian Kandeler
760cf632af Move clang diagnostics config settings to clangd settings page
It was confusing to have both "Clang Code Model" and "clangd" project
settings pages, so we merge them.
Along the way, a lot of code dropped off.

Change-Id: I780850b716195c3729403ae59f0794c11b5c556d
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-05-23 12:15:40 +00:00
Christian Kandeler
affa2cda9e CppEditor: Tell users about clangd configuration files
It's not feasible to map every possible setting into our UI, so instead
teach people how to use the clangd configuration mechanism.

Change-Id: Id11e81e25b687a4f49af4e090203faca3a75722d
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-05-17 08:56:32 +00:00
Christian Kandeler
23fceb9ef3 CppEditor: Allow to retrieve clangd's internal include path
The code model will need to use this one instead of the one hardcoded at
build time.

Change-Id: Ibd89d32f99b9250c909473f9a4a66f9a8a5f4f07
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-05 08:38:33 +00:00
David Schulz
4a3c4dec09 ClangCodeModel: fix setting clangd to the fallback client
When manually defining clangd to the fallback clangd in the settings the
setting was not saved and after a restart the previous clangd was setup
again.

Change-Id: I6ce71d20d510c0cf6c605247563349b38c204e56
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 04:17:14 +00:00
Christian Kandeler
780f89b377 ClangCodeModel: Bump minimum clangd version
We need clangd >= 14 to get rid of the cumbersome compile_commands.json
creation.

Change-Id: I30c19a385e2d76e478985f3df64968d1cb3efe87
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-04 12:55:03 +00:00
Christian Kandeler
1f0ea9ef7f ClangCodeModel: Allow users to set a file size threshold for clangd
With huge source files it might not be so useful to continuously
recompile them while editing, which is basically what clangd does.
Let users opt out.

Change-Id: If3e95c1e286090606a84961d071179f8b40f9180
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-03-30 07:53:07 +00:00
Christian Kandeler
5c1dc40b6c CppEditor: Switch on clangd by default
Also change the corresponding settings key to force-enable it with
existing settings.

Fixes: QTCREATORBUG-22917
Change-Id: I3b5f54bf5d4261c6e4250245f44c4c360a911e5e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-27 10:47:35 +00:00
Christian Kandeler
cfae24a6e5 ClangCodeModel: Enable clangd's new "dirty headers" flag, if possible
This feature will be availabe with LLVM 14,
see https://reviews.llvm.org/D95046.

Task-number: QTCREATORBUG-26810
Change-Id: I0a6797a836c56f5b72cca34be8f2d3edf8ac7359
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-24 12:46:29 +00:00
David Schulz
655e64b2da clangd: fix saving clangd settings
amends 6cf6f1c230

Change-Id: Ib9007805783cfac258a73b81b7e1a401f9fbc2df
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-12-07 10:06:58 +00:00
Orgad Shaneh
6cf6f1c230 CppEditor: Save Clangd settings in human-readable form
in the global settings.

Change-Id: I2f90388c138c92f03f78044e225574ded640d4b9
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-06 11:42:18 +00:00
Christian Kandeler
0cc4617c78 CppEditor: Add settings for clangd session mode
Complete with (hidden) UI. Doesn't do anything yet, because some
assumptions about projects need to be adapted on the LanguageClient side
first.

Task-number: QTCREATORBUG-26526
Change-Id: I34c92555e34c3d3ed98462261d47b35dfc015ce0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-12-01 13:26:35 +00:00
Christian Kandeler
c97a144034 CppEditor: Move static variable to function
Following the principle of scope minimization.
Also, we got a reproducible crash-on-exit with MSVC with the original
code.

Change-Id: I465f4376fa7928de9bb878aee5faac992f75bf08
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-11 09:28:18 +00:00
Christian Kandeler
4dfdbf91f6 CppEditor: Do not use clangd < 13
We will shortly need to use a command-line option that is new in clangd
13. Rather than starting to add checks for versions that won't work as
expected anyway, we simply refuse to use clangd < 13 now.

Change-Id: I42ec679e0f58449a2593cf92b4be7ed3101fa787
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-01 14:19:27 +00:00
Christian Kandeler
2ecbbb126d ClangCodeModel: Do not let clangd insert header files on completion
... by default.
This feature often doesn't do what you'd want it to, so we make it opt-
in.

Change-Id: I631eae9c154ddcb0e8feeac44c5d5c0265706a67
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-27 10:17:39 +00:00
Christian Kandeler
575ca89b3e CppEditor: Do not save clangd file path in settings
... if it is the default value.

Change-Id: I5efde72abe5a1979144352d09d461642f936224a
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-20 09:03:53 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.

Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-01 14:53:58 +00:00