Commit Graph

26 Commits

Author SHA1 Message Date
David Schulz
0e4b0a26d3 Editor: move ownership of assist interface to processor
This way the base class can manage the lifetime of the interface object
and it doesn't need to be done in each implementation of perform.

Change-Id: Ie1ce742e31b688a337533ee6c57d376146e25ace
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-17 13:23:55 +00:00
David Schulz
09ee528c40 Editor: unify assist processor handling
Define the run type of the processor by its implementation instead of a
enum value of the provider. The execution of a processor inside the
assist now follows a unified procedure.

Change-Id: Ibe9fab324c6072e77702c2663946d7a9f562a085
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-14 13:02:51 +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
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
Marco Bubke
84c1d6572b Utils: Remove variant.h
Since we are now requiring macOS 10.14 we can remove our local copy of
std::variant and use for macOS std::variant too.

Change-Id: I589d03b35fc56878b7392ffa7047a439e588fe43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-23 09:51:43 +00:00
Eike Ziller
6a296ab68a Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/qmlprojectmanager/qmlprojectplugin.cpp

Change-Id: I14030f58303839e706af892dd12a67566e3bed68
2022-05-18 13:35:47 +02:00
Christian Kandeler
e2890aa1ff LanguageClient: Take quickfix range from cursor selection
We must respect the selection the user made, otherwise code actions
might not work correctly.

Change-Id: I39142047f90f3d7c85aefbfa960e59d413e4be38
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-16 07:52:20 +00:00
David Schulz
b2e2421d2d ClangCodeModel: remove duplicates from clangd quickfix assist
Do not report quickfixes with a diagnostic since those are already
collected by the ClangdQuickFixFactory as builtin quickfixes.

Change-Id: I8d29a08b823291f8beaa762c09b7d29a4b9d0384
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-13 14:19:13 +00:00
David Schulz
1bfd5da024 LanguageClient: Track quick fix assist processor
Same as for the completion and function hint processor, these processors
need to be tracked so they get cleaned up on client destruction.

Change-Id: Ib24eb8c652e7a44d8b79e1edddda9ad659d145a3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-13 12:59:55 +00:00
David Schulz
4452f71201 LanguageClient: avoid optional::value
Potentially throws std::bad_optional_access. Use operator* and
operator-> instead.

Change-Id: Idefa137da53f3663ea88961f1105b93402ec4777
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-24 12:04:38 +00:00
Christian Kandeler
0e7de92319 ClangCodeModel: Retrieve all kinds of clangd tweaks
Contrary to our expectation, the "quickfix" tweaks are not part of the
inline code actions after all.
User-observable effect: "Populate switch" becomes available.
Amends 8b63dfccc6.

Change-Id: I4f7fa25a58bb54dbdb470d7db064b4d804c34d26
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-02-04 14:23:24 +00:00
Christian Kandeler
8b63dfccc6 ClangCodeModel: Make clangd refactoring actions available
Introduce an assist processor that merges our built-in quickfixes with
refactoring actions from clangd ("tweaks").
For now, we make it clear which ones are coming from clangd, and we do
not filter duplicate functionality. In the future, we might want to
disable redundant built-in actions if clangd is enabled for the
respective file.

Change-Id: I04842132798c8635dfddf8cfc98cc7a6313fac09
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-02-01 11:02:53 +00:00
David Schulz
4324f3e8c1 Editor: pass AssistInterface to createProcessor
The interface can be used for checking the context of a codeassist
request to determine
the correct processor that has to be created.

Change-Id: I47ddb05c46399566e27bae21711f11a3a4132c3f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-09-16 08:25:36 +00:00
David Schulz
1d39465a1b LanguageClient: export code action quick fixes
Change-Id: I571378580a1f56bc649662c68eb306a081c0c091
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-30 12:29:52 +00:00
David Schulz
d7dda80ee2 LSP: prevent accessing already deleted client
Change-Id: Ifdafc77282079b8f99378047e89bbbe44599eebb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-17 08:10:37 +00:00
David Schulz
439bb9c4ae LanguageClient: manually track document version
Using the document revision causes issues for some servers.

Task-number: QTCREATORBUG-25766
Change-Id: Ic858e19c6fe39e57c9d3124913887aafee0a3cd0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-15 13:01:05 +00:00
David Schulz
e6d0ed3160 LanguageClient: support versioned diagnostics
Change-Id: Id182431f371201c7266fe0683e78fe56a8a9735b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-12 12:40:07 +00:00
David Schulz
dba4bff703 TextEditor: use Utils::FilePath as file member in AssistInterface
Change-Id: I3bf9b013b9350411f918efdb9d1a36a2c22bf972
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-04 10:14:21 +00:00
David Schulz
11ea89d936 LSP: Explicify API
Change-Id: Id208a420fd3e1e23d3279c4f1f19bdbed994a8d3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-15 08:31:30 +00:00
David Schulz
f3407bb0ca LSP: fix codeassists running check
Since MessageId is always valid (needs to be fixed separately)
use an optional to store whether we have a request running.

Change-Id: I7a1f136a09d776b33509bc914247d11076abeaa5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-14 09:46:55 +00:00
David Schulz
8bde432dfe CodeAssist: Fix leaking asynchronous processors
Currently the ownership of the processor is unknown to the codeassist
when running an async operation. Move the ownership of the processor to
the assist and delete the processor after the proposal was completed.

Change-Id: I6a2e023c47cbc876669dba866bee12b481447cb7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-12 08:24:41 +00:00
David Schulz
552ccd6a61 CodeAssistant: add cancel to asynchronous processors
Fixes crash when the processor reports a result after the code assistant
was destroyed.

Change-Id: I8588d3d6acad69f1ec6302e8ba09d642ebbb77f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-20 12:59:55 +00:00
David Schulz
f0ad5813b9 LanguageClient: more FileName to FilePath renaming
Change-Id: I803211d462b442b6881a02e870d2cd816675e0d9
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-17 08:15:40 +00:00
David Schulz
f0a3779513 LanguageClient: reset all assist providers
Instead of just unsetting the function assist provider and quick fix
assist provider reset it to the previous provider.

Change-Id: I46c5c2f14234e3da08480dd103e4634859447d57
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-11 07:37:17 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
David Schulz
c6415e2652 LSP: collect and execute quick fixes via shortcut
Fixes: QTCREATORBUG-21802
Change-Id: I611fac1c3fc5b094816441e36492ed57706c98b8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-12 12:57:31 +00:00