Commit Graph

64 Commits

Author SHA1 Message Date
David Schulz
2b72ba66ce LanguageClient: add workspace configuration project settings
Change-Id: I9876773550f3dc566dec05b78f818ca49c930da1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-11 06:29:06 +00:00
David Schulz
95609551a1 Core: add aboutToSave and saved signal to IDocument
We need reliable signals that gets emitted when documents are saved to
inform the language server about the document state change.

Change-Id: I0a1e8a5317ae6984ff17d878952c74f69765e3f9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-15 07:19:39 +00:00
David Schulz
3541b692f5 LanguageClient: track clients scheduled for deletion
So report an async shutdown if we have clients scheduled for deletion
and wait until all clients have been fully deleted.

Change-Id: I40d35d3429003ab2a5c68cb81486c3e16b5f6f63
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-25 11:34:31 +00:00
Eike Ziller
ee6789c523 Centralize a PluginManager::isShuttingDown() status
Instead of keeping track of this in plugins individually.

Change-Id: Ia2650f0f647d4a63d2010cef688aa56f6020c338
Reviewed-by: hjk <hjk@qt.io>
2023-05-23 07:19:42 +00:00
Jarek Kobus
2839d019b8 LanguageClient: Use Q_DISABLE_COPY_MOVE
Change-Id: Iee54086810442b64cb8b7aa68a48341909481787
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-24 05:38:02 +00:00
Jarek Kobus
ed120516f6 DocumentLocatorFilter: Get rid of the arg from c'tor
It's always LanguageClientManager::instance().
Pimpl LanguageClientManager's filters, so that they are
constructed after the managerInstance is being assigned.

Change-Id: Ib1f6f0c96d57d0e4cb7332ce322f6c4e9ef9fdb1
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-18 09:03:14 +00:00
David Schulz
eb7ccfd889 LanguageClient: add action to open call hierarchy
Fixes: QTCREATORBUG-28839
Fixes: QTCREATORBUG-28842
Change-Id: Icb70412282c0c2c36241559d942a58ffddab5664
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-22 14:40:38 +00:00
Jarek Kobus
af84305f12 DocumentLocatorFilter: Make it more self-contained
Hide public DocumentLocatorFilter::updateCurrentClient()
method and remove
ClangdCurrentDocumentFilter::updateCurrentClient().
Connect DocumentLocatorFilter internally into a new
LanguageClientManager::clientInitialized() signal instead.

Change-Id: Ie74a112bda811525b7d226da1377e5624130e9ed
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-20 12:35:01 +00:00
David Schulz
f920ee217b LanguageClient: remove unused code
Change-Id: Iac6a0f02aa52d9d5d1699200b2dd328c00ea9f30
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-17 07:16:34 +00:00
David Schulz
d62d39642e LanguageClient: Add action to restart client to editor toolbar
Change-Id: Ib2fb0f6d9a5b3baeac937f298670887fa704ddce
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-09 14:12:22 +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
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
fc24f5c26d LanguageClient: use separate variable to save shutdown state
The LanguageClientManager might be already gone.

Change-Id: Ia674a8c76e0c1bb39e1503be9cffc20fd69120bb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-14 05:33:13 +00:00
David Schulz
1c05237820 LanguageClient: prevent accessing freed data on shutdown
Change-Id: I0d6e7abd653acb2ab7409a9cd5e58a2df3b1f259
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-22 10:07:53 +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
Christian Kandeler
5fcb459d6b LanguageClient: Add LanguageClientManager::clientAdded() signal
For consumption by interested parties.

Change-Id: I0cbecb4ce99cdd208fc3ff019d4f0ea672dcf752
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 10:21:47 +00:00
David Schulz
6c8605ced2 Python: automatically disable outdated pyls settings
Change-Id: I301c6df3fdd9cf634a1abff20c6f24b9bc5fc23b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-24 11:23:52 +00:00
Christian Kandeler
01ceb3a3cb ClangCodeModel: Switch to LSP-based UI header approach
Generating ui headers in a well-known path and then including that one
in the compilation database does not work in the presence of multiple ui
files with the same name.
As it turns out, we don't have to generate any files at all; instead, we
pass the file contents directly to clangd, which then uses them when
parsing includes of the respective header.
User-visible behavior change apart from the abovementioned bug fix:
Tooltips and "follow symbol" on the include directive now always use the
actual location of the header provided by the build system.

Fixes: QTCREATORBUG-27584
Change-Id: I6b13e12cb3a365199567b0bc824d12b373117697
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-02 11:29:14 +00:00
David Schulz
0b6bc0d187 LanguageClient: Move the BaseMessage to JsonRpcMessage conversion
... to the client interface. JsonRpcMessages are the only messages used
so far and no other types of messages are currently used by any of the
supported Language Servers. If a client is going to need special message
parsing it can still implement a specialized client interface and
overwrite parseCurrentMessage. This is the preparation to move receiving
and parsing data passed to and from the language server out of the GUI
thread.

Change-Id: Ibd4cd95daab7efff947273ca9e7d457de0286f47
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-17 04:31:06 +00:00
David Schulz
d824c276df LanguageClient: constify createClient
Change-Id: I4b9aba1388a31b6d1531cb4a6346a394c5aab150
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:29 +00:00
David Schulz
1a88f26d8b LanguageClient: rename clientForSetting -> clientsForSetting
Change-Id: Idf4055769fba4c2551ac968c0232ddb3916acb6c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:24 +00:00
David Schulz
5924268568 LanguageClient: unify client container
Change-Id: I17b5e7ca4999cd5a9ca8e79577f29854082b6c6b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:17 +00:00
David Schulz
333374e6a9 LanguageClient: move remove project connection to client
Change-Id: I63ff089c7b72a4f72ddf65548dc8df1cc6763ff9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-01 05:39:08 +00:00
Christian Kandeler
d583dde17b ClangCodeModel: Force clangd restart on external changes
Neither we nor clangd can afford to watch all source files, which means
that after e.g. a branch switch we can easily end up in an inconsistent
state.
We alleviate this problem by restarting clangd if at least one open file
was changed externally.

Change-Id: I7e0d14835e3afbd7a64c3233614f2161282dddc0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-07 10:05:28 +00:00
Christian Stenger
752b967952 LanguageClient: Fix possible crash
If a restart for a client has been staged for restart the
shutdown of QC may coincide with the start of the client which
leads to a crash on exit. Correctly track clients that never
successfully started to clean them up on manager destruction.

Change-Id: I639a76318d1665653fbcd37841fcaf407f3d3a83
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-30 12:23:05 +00:00
Christian Kandeler
e0e8fda580 ClangCodeModel: Use clangd for completion and function hint
Change-Id: I80160f3a40da18ac178682afe6caba5e5af6e3eb
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-23 09:06:31 +00:00
Christian Kandeler
ecafdb7543 ClangCodeModel: Add experimental clangd support
If the user has enabled clangd (default is off), we start up one instance
per project when it is opened/changed (including build config switches),
and trigger background indexing.
So far, the index is used to provide results for locators and "Find
Usages".
Per-document functionality such as semantic highlighting and completion
is still provided by libclang.

Change-Id: I12532fca1b9c6278baab560e7238cba6189cde9f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-04-22 07:32:58 +00:00
David Schulz
166fce5036 LanguageClient: improve Server startup
Starting a client does not need to be done via
LanguageClientManager::startClient anymore but can be done via
Client::start()

Change-Id: I571e96b6ad7d64786a345edf5dbb38208b9a1d12
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-16 14:13:20 +00:00
David Schulz
b865fa5571 LanguageClient: Rename logger -> inspector
... to be able to add more features to this dialog.

Change-Id: If8692bee484e25c1ba5e4ea629a77d14ff5d92ab
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-15 14:33:15 +00:00
David Schulz
fa260e00ed LanguageClient: cleanup languageclientmanager
- sort includes
 - fix clazy and clang-tidy warnings
 - remove unused function
 - adjust naming ('interface' -> 'client')

Change-Id: I12ada223a7a04796f0e6ac992cedf83aefe2ecc0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-29 13:48:25 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
hjk
cf91b2c033 LSP: Do not accumulate connections during signal emission
Amends cdeac76df3.

During the execution of updateProject() triggered by a fileListChanged()
emission new connections to the fileListChanged() were added, effectively
making the emit never return and gobbling up all available memory.

Change-Id: I18a1ab9b32c2e797e990449385a5353782211560
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-25 07:54:42 +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
David Schulz
8f5109b6ee LSP: Robustify open documents
Use Client::openDocument if you just want to open a document and
activate it if it is not already used in another client.

Use LanguageClientManager::openDocumentWithClient if you want to make
sure a document is opened _and_ activated for a specific client.

Change-Id: I6b790f15e17335ce2dc8981a04d2cd571b22b66b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-14 09:51:26 +00:00
David Schulz
cdeac76df3 LSP: react on file list changed signal from project
Fixes opening projects that lazy load their file lists. For example
CMake projects open without a file list. This list will be generated
after a successful configuration of the project.

When a session is loaded that contains an open document from a project
the document and project open signal is triggered when there is still no
connection between these two. So recheck the project for documents after
the file list got updated.

Also add documents that are already opened before they are assigned to a
project.

Change-Id: I6f2bde0edf88a505116b05efe5564318f2cfb892
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-13 10:58:25 +00:00
David Schulz
821f073f15 LanguageClient: Add logging window
Change-Id: Ib86b70381b69df55d62a97abdf52b747f7f1c75e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-02 13:38:46 +00:00
David Schulz
73161356d5 LSP: take account of resolveTarget when checking for links
Return a link to the word under cursor when the target should not
get resolved. This results in a highlight of the text the mouse cursor
is positioned on when pressing ctrl to follow a link.

Change-Id: Iaf1ba289644ed3e3fc062b418dd2fa3bfa8da6ad
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-28 14:05:05 +00:00
David Schulz
28c3f0c31e Python: Add info bar entry to enable pyls
Show an editor info bar entry displaying that the language server for
the current python is disabled and a button to quickly enable the pyls.

Change-Id: I3adb2e7cbfb1a32e35413b0b06dfbe66a0b214af
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-10-18 05:23:29 +00:00
David Schulz
57749e91e8 LanguageClient: allow adding settings via the manager
This adds the possibility to configure language servers
from other plugins.

Change-Id: I33c7d637ddd73dcfc0d02c366b8b9749ac1c2b98
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-23 09:51:41 +00:00
David Schulz
f7453adda2 LanguageClient: export manager, client and settings
Change-Id: I8827fb1c36a41ab76b9509cdbf008e9f2309fd6c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-19 08:54:06 +00:00
David Schulz
468f604900 LanguageClient: have one active client per open document
open a document in all clients supporting the document, but have just
one client that provide functionality like highlights, completions, and
find usages.

Change-Id: I6bd72eb022005ed643fefd1da139d482f4dd5279
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-19 08:53:47 +00:00
David Schulz
d3c94edd93 LanguageClient: only send contents of TextDocuments to the server
Change-Id: Ifdcd6ba161336814744c51f15e35a756960cb199
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-12 10:53:57 +00:00
David Schulz
332031d677 LanguageClient: open a document in just one client
Also show a menu when triggering the language client toolbar button that
allows you to manage and switch between different language clients. The
default language server used to open a specific file type is determined
by the order of the servers inside the settings.

Change-Id: Ib1b21dd2c04d4559f538705e6ba229af043e02ae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-09 13:29:33 +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
7ad5313c3b LanguageClient: add locator filters for symbols in workspace/project
Implement locator filter that is using the workspace/symbol request to
search for symbols in a project. In total three filters were added:
 ':': searches for all kind of symbols
 'c': searches for classes and structs
 'm': searches for methods and functions

Fixes: QTCREATORBUG-21915
Change-Id: Id62c9e0b1bcb29112e35b926b1a5cf04357751c4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-05-14 08:53:34 +00:00
David Schulz
0c5837a111 LanguageClient: Fix crash after disabling client setting
Change-Id: I0f9ec02edc645726764fc9ea9ea1832e40bbef80
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-05-09 11:07:34 +00:00
David Schulz
69e880c050 LanguageClient: add current document locator filter
Change-Id: I20442a254e4e016088b2da845d87af6e9f836731
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-30 05:19:31 +00:00
David Schulz
0ea840c2bd LanguageClient: add option to start client per project
Some server like rust or haskell require a project at server startup.
Add option that postpones the server start until we can assign a project
to an open file.

Change-Id: Iaa475289e833b27a730a90ea228f5d85ecc30338
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-29 09:52:02 +00:00
David Schulz
5c7d8a20c7 LanguageClient: move setting client relationship to manager
Change-Id: I9bf712227d44eada28abb18bbf641a2bfa835914
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-24 09:01:11 +00:00
David Schulz
ad703e108b LanguageClient: move current settings to manager
In preparation to have relationship between clients, settings and
project to one another in the manager.

Change-Id: I00ae15abe03c54b4a58e429d67d6ff939662cce6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-23 06:44:12 +00:00