Commit Graph

24 Commits

Author SHA1 Message Date
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