Commit Graph

43 Commits

Author SHA1 Message Date
Jarek Kobus
8b3aa900da Utils: Move SearchResultItem/Color into Utils
It's going to be reused inside FileSearch.

Change-Id: I8993d7158ff31c311c2283d32bc43465a8946a52
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>
2023-05-08 06:41:27 +00:00
Eike Ziller
2bc37de42b Merge remote-tracking branch 'origin/10.0'
Conflicts:
	src/plugins/python/pipsupport.cpp
	src/plugins/qtsupport/exampleslistmodel.cpp
	src/plugins/qtsupport/examplesparser.cpp
	tests/auto/examples/tst_examples.cpp

Change-Id: I00273622423fa99d41621969f6ecbbdaa0e18664
2023-04-13 15:59:08 +02:00
David Schulz
4d688c932b Clangd: do not modify the default replacement string
Fixes: QTCREATORBUG-28321
Fixes: QTCREATORBUG-28910
Change-Id: I4cfaf5ea3916a0ecbf0b0bae4d0c231513671c73
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-04-04 08:55:15 +00:00
hjk
3e7d93c788 ProjectExplorer: Move some not-fully-session related bits
... out of SessionManager.

The idea is to later move SessionManager into the Core plugin,
which both is sensible conceptually and also prerequisite to
merge the Bookmark plugin into TextEditor plugin.

Currently, only the interface is split, as the load/save
implemetations are non-mechanical to disentangle.

Change-Id: I31631db3094ea192825a2ccaa6add6188662940b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-01 09:26:50 +00:00
Christian Kandeler
0d909c353c Designer: Update C++ code model on an object name change in designer
We try to locate the old symbol name in the generated ui header and
rename the symbol in the background.

Task-number: QTCREATORBUG-1179
Change-Id: Iaf68e3922cd728cbc87d0dc97125e34b8bdaa6be
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-27 10:02:52 +00:00
hjk
77054c2fa3 LanguageClient: Tr::tr
Change-Id: Idbd7c5cdadba4f269b2033df91db0e05bb5281d5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-20 07:56:04 +00:00
Christian Kandeler
7b5c5b774f LanguageClient: Fix renaming with pre-set replacement symbol
If a caller passes in a fixed new symbol name, it must not be overwritten
with one derived from the old symbol name.
The problem can be verified with the "convert to camel case" quickfix.

Change-Id: I3d3aca692cb8e73535e1ef657608fd13d18ee5df
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>
2023-01-19 09:04:51 +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
David Schulz
5eeef19743 LanguageClient: resend rename request automatically on changes
Instead of asking the user to trigger the search again button before
being able to trigger the replace operation.

Change-Id: Ie2f0674255249b27d9435fc9df344e3f21bb886a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-16 09:12:01 +00:00
David Schulz
2d0456f085 LSP: Support remote LSP file paths
Change-Id: If3cf1b8d675ef091427dbcd703c7d14b384a1b3a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-15 09:49:48 +00:00
David Schulz
6d8f6ab395 LanguageClient: robustify renaming symbols
Guard against using a symbol support from a deleted client. Additionally
cancel active replace operations and provide a sensible error message.

Change-Id: I92ca0038fa5f6acbb8369a48c4e8051adfadb30e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-08 14:27:29 +00:00
David Schulz
fd17724597 LanguageClient: use reported rename placeholder
Using the reported range to create a usable placeholder if the
cursor ('|') is placed on the end of an identifier like in:

int global|;

Change-Id: I2ebacf3b9b54cff8f8887526479792374f67c881
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-21 11:47:52 +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
55a5216e25 LanguageClient: Inform document manager about renames
So that interested partied can react accordingly.

Change-Id: I0233413aa960b83965428671cebeb591d5ca12b9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-06 10:00:47 +00:00
Christian Kandeler
c46e5cef2d LanguageClient: Offer to rename matching files along with symbols
Like we already do in CppEditor and ClangCodeModel.

Change-Id: I9cd292950e40c499d99cc561fbf0ad99af477803
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-05 12:59:55 +00:00
Christian Kandeler
718086dea8 LanguageClient: Allow to pre-set the new symbol name
... when renaming.
There are contexts which provide the new name in advance.

Change-Id: I4bda689405060c343c0654d0aca274f10ee22752
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-05 09:03:11 +00:00
Christian Kandeler
eccbfc9459 LanguageClient: Allow to not pre-select non-project files for renaming
In alignment with what we already do in CppEditor/ClangCodeModel.

Change-Id: Ic68eca1879ed06887d3c5e39a09982bdd8c61065
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-04 13:11:43 +00:00
David Schulz
4f9a5ea896 LanguageClient: Inform user of failed prepareRename request
Also instantiate the search result window if we get an error and use it
to display errors.

Change-Id: I49dcdcc5ad2ace64391f8d2d849995b046032957
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-30 11:59:52 +00:00
Christian Kandeler
5c0cafa68e Core: Allow to pass a reason for a failed search
... and make use of it in the LanguageClient.

Change-Id: I7e47a7419c7168c5e26709ae225e4887d4c5089b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-28 15:42:40 +00:00
David Schulz
1ee370df50 LanguageClient: check capabilities before find usage
Change-Id: I421c2f93c90e6b0b8198fcff5707e8a47e8022f2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-23 10:51:11 +00:00
Christian Kandeler
712311b20c LanguageClient: Optionally use a different default replacement string
... when renaming symbols.
Otherwise, the server might return an empty list of results, as renaming
a symbol to itself is a no-op.

Change-Id: I9ca808c4032458c9a2eec262feadd28212938c23
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-23 08:39:57 +00:00
Christian Kandeler
c2937f609e LanguageClient: Do not cancel search on empty result list
... for a rename request.
Instead, simply finish the search normally, leading to a "no matches
found" message rather than the misleading "search canceled".
But do cancel the search on an actual error.

Change-Id: I10401466bb4d81d53d26b8dc08bfed91db86cd5a
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-21 07:19:04 +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
Christian Kandeler
5693c518bc Utils: Rename ProcessLinkCallback to something less clumsy
Change-Id: Icce4995f4aa886524dc3eedb7cf9ba72adbe8783
Reviewed-by: hjk <hjk@qt.io>
2022-06-03 13:23:28 +00:00
David Schulz
7c86d1a195 LanguageClient: pimpl Client and cleanup includes
Change-Id: I653861e29baeaddcbcd21a5e738be6bd85514617
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-23 11:58:09 +00:00
David Schulz
a493970e05 LanguageServerProtocol: remove IContent
Do not pretend to support multiple message types, while no other
messages are actually implemented by us or even known to exist in the
wild.

Change-Id: I49ee2118b2e10f265ac641c195df8a9e5c97951c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-20 06:35:47 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
  utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
  wrappers, that also includes the "public" headers for MimeType et al
  from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
  utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
  back to utils/mimetypes/mimedatabase.h

Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 07:19:58 +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
92156cc1d6 LanguageClient: Indent code coming from the server
... if the client implementation requests it.
The server is not necessarily aware of our indentation style, so we
might have to apply it to the newly inserted code.

Change-Id: I43518575c7124568da42be3b04a28d7f352f6dc2
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-02-03 14:30:19 +00:00
Christian Kandeler
d52e7b9398 LanguageClient: Make sure to run callback in all code paths
... when receiving a reply for textDocument/definition.

Change-Id: I08f3a22f7c39a33b7b84539125a76d0c0d625692
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-01 11:40:38 +00:00
David Schulz
356bfcc9fd Utils: filepathify Link
Change-Id: Ie62500bde139158e776f9698ee0ea00c2a113f93
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-25 17:32:18 +00:00
David Schulz
8b7a90ac51 Utils: filepathify TextFileFormat
Change-Id: I6a4e2d38b0bbdec661a4a492901d9182a9f2e502
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-18 12:35:49 +00:00
David Schulz
f8ca730121 LanguageClient: Use Utils::FilePath to get file content
Change-Id: Iddb2eb5c02f3e6674f1f71bb61fb1f13dec22794
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-18 12:35:43 +00:00
Christian Kandeler
4890902abf LanguageClient: Allow for custom symbol search result handling
Change-Id: If19ce24b39820afbfd48c48493e07709f4b3633e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-03 11:07:08 +00:00
David Schulz
d17277b546 LSP: reduce error handling complexity
Instead of checking recursively every possible object just check the
required keys for an object and validate it on construction or
assignment from json.

This will reduce the implementation effort for protocol extensions and
also reduce the false positives we might get if the protocol gets
updated.

Change-Id: I3df24e62430d2c7575d26c1581e6a9606e7da4c1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-02 12:51:47 +00:00
Christian Kandeler
d3deefc3a4 Core: Streamline SearchResultWindow interface
That is, make SearchResultItem the one data type for adding search
results.
This will allow us to add additional properties to search results
without adding more and more parameters to a bunch of functions.

Change-Id: Ic2740477ae47449cee75caa2525727fe2b460f91
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-02-18 16:46:08 +00:00
David Schulz
7521334261 LSP: support WorkDoneProgressOptions in server capabilities
These options indicate whether a server provides extra messages to track
the status of specific requests.

Change-Id: I3fb78f7fa7144a5a9418b32cb5b33d55b668c484
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-15 13:19:56 +00:00
David Schulz
ac2c487e2e LSP: Use document contents to collect search result texts
Otherwise search results in modified files will get wrong line texts.

Change-Id: I7be4b27ebc5b250da3a3a0050de8646bcfcd010b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-15 06:56:38 +00:00
hjk
611a3bb68a Even more Qt6 porting
Task-number: QTCREATORBUG-24098
Change-Id: Ib6ef0e521483153c9716c9a1870072e836d6b026
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-23 11:24:44 +00:00
David Schulz
2b36770d07 LSP: add rename functionality
Fixes: QTCREATORBUG-21578
Change-Id: Iec54ebed6358453af4ef16a2a4e6aef0418faebe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 07:51:52 +00:00
David Schulz
4121eccf1e LSP: add symbol support class
Declutter the client and client manager by moving find usage and follow
symbol into this helper. This functionality was "temporary" put into the
client manager, but is more an implementation detail that shouldn't be
handled in that central place. Rename symbol will also go into this
helper class.

Task-number: QTCREATORBUG-21578
Change-Id: I56680f6ccbb8d244066561167178af7b341b8822
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-19 10:10:12 +00:00