The temporary containers are needed in some places because the content of the containers change
while iterating over them.
partially reverts: cf010911f7
Change-Id: I4d6df987b9e5382b6b18fa659b1174ca6919a02e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
General messages pane should only be opened on direct user interaction.
Task-number: QTCREATORBUG-24430
Change-Id: I526659110fc67c627cb60fe56e1f709f064667c2
Reviewed-by: David Schulz <david.schulz@qt.io>
Instead of working on a Client member IContent now returns an optional
response handler that consists of an id, a name and a callback.
Change-Id: I5ca7dd4eaa7ae37f333f99c9fe60339db03ebf2c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Unconditionally reset the assist provider even to a null pointer
Change-Id: Ie8f87802ab26b4a686704b792adc726a50f98bab
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
The coreplugin/id.h header is kept for downstream for now.
Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
The coreplugin/id.h header is kept for downstream for now.
Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
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>
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>
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>
That function should really be static, it is not meant to be used
elsewhere.
Also, replace duplicate "uri.toFilePath()" with just set filePath
variable.
Change-Id: I11e6cd2133d8999b34ed24b774ab13036f2b9fc8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
When the language server is initialized, the Initialize request can contain
user provided data in initializationOptions field.
Allow the user to set data inside. This can be required to let the
language server have some context.
Change-Id: Ib057fdb940c21b3fd032853fb84253d42ad1e321
Reviewed-by: David Schulz <david.schulz@qt.io>
When the default assist provider is not DocumentContentCompletionProvider
because of some plugin that also provide an assist provider, this would
fail.
If the user has configured a language server, assume is prefer that and
always propose the server's assist providers when available.
This the case for CMake files but probably C/C++ files too if the CppEditor
plugin is configured to handle them.
Change-Id: I641d73466c8b520beb494dae8e6b274debd2881f
Reviewed-by: David Schulz <david.schulz@qt.io>
The proposal of SemanticHighlighting uses a versioned text document
identifier, but there is a suggestion to be more coherent with other
existing requests and use text document identifier instead (non versionned).
See here: https://github.com/microsoft/vscode-languageserver-node/pull/367/files#r225879268
The clangd language server implements the non versioned version.
Existing code was returning errors with clangd because
SemanticHighlightingParams::isValid would return false because of the
missing version field.
Change-Id: I1c36151342437adad2405118ca6b303db0936e41
Reviewed-by: David Schulz <david.schulz@qt.io>
When the language server reports diagnostics, it also reports to which
part of the code the diagnostic applies.
That part of the code wasn't emphasized before, there is only an icon
next to the line and part of the diagnostic message in the text editor,
but no exact clue of which word is targeted by the diagnostic.
This commit add information about the affected code by diagnostics using
extra selection of type CodeWarningsSelection as other plugins do (like
the clang code model).
If a diagnostic has no severity or is not Error, Warning is used (the word
will be underlined in yellow).
Diagnostics can be either Error, Warning, Information or Hint.
For example, clangd uses Hint for remarks and Information for notes.
Notes can be related to a warning or an error, for example
when a function call has an incorrect number of argument, the call site
will have an error diagnostic with red color and the called function
declaration will have a Hint diagnostic with a yellow color.
Change-Id: Ifa433553be95a4913541d5570a2758ac213e7075
Reviewed-by: David Schulz <david.schulz@qt.io>
When the whole file contents are changed, for example because of changing
the highlight definition when there is several candidates, the language
server will behave as if the file's content was the result of
concatenating two times the file's content (leading to duplicate
declarations errors for C++).
The issue is that when this happens, the didChange message indicate
only the added portion of the change without the removal of the whole file
beforehand (ie: the range is empty and the text is the whole file content).
This is because charRemoved and charAdded are equal to the length of the
document which is not exactly the number of /visibles/ characters, but also
including some invisible formating characters according to QTBUG-80662.
This causes the QTextCursor to ignore the second setPosition because of
invalid position out of range.
Fix this using the same code as QWidgetTextControlPrivate::_q_contentsChanged
that is to use qMin to ensure the end position is not after the end of
the document according to QTextCursor.
For charsAdded, document->textAt takes care of that itself, via
Utils::Text::textAt.
See also: QTBUG-32583, QTBUG-80662
Change-Id: If781707d42253f4659005754efa73d872577f738
Reviewed-by: David Schulz <david.schulz@qt.io>
Do not clear open documents but disconnect and deactivate them,
so they can be correctly reopened once the server is restarted.
Change-Id: I0f61a5461c020865e61d9808e8c645ea842f64ad
Fixes: QTCREATORBUG-23648
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Do not send close documents notifications to an uninitialized server
Fixes: QTCREATORBUG-23598
Change-Id: Iaabd082203a91a56ebcd60f93e6a0c97048e89c1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This saves a roundtrip when reporting bugreports where an unexpected
error shows up.
Change-Id: Id2e7cbd86a456ea794f0791199077f931cab03c5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
It won't be set again when restarting the server.
Task-number: QTCREATORBUG-23497
Change-Id: I28b4c4f9169a2de94d7ea7f6712c3900fd7099ee
Reviewed-by: Christian Stenger <christian.stenger@qt.io>