aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/languageclient
Commit message (Collapse)AuthorAgeFilesLines
* LSP: Use document contents to collect search result textsDavid Schulz2020-07-151-4/+21
| | | | | | | Otherwise search results in modified files will get wrong line texts. Change-Id: I7be4b27ebc5b250da3a3a0050de8646bcfcd010b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Core/Utils: Migrate further to Utils::Idhjk2020-07-063-6/+7
| | | | | | | | The coreplugin/id.h header is kept for downstream for now. Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66 (cherry picked from commit 430a33dcd9ac80ddb848e41f8f059102857c88aa) Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* LSP: Fix a compiler warning about signed/unsigned comparisonArtur Shepilko2020-06-231-1/+1
| | | | | Change-Id: Id7a7e2372fb968fab077a97e5f7660c1bd52dd20 Reviewed-by: hjk <hjk@qt.io>
* Even more Qt6 portinghjk2020-06-232-1/+4
| | | | | | Task-number: QTCREATORBUG-24098 Change-Id: Ib6ef0e521483153c9716c9a1870072e836d6b026 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* LSP: Compress document change notificationsDavid Schulz2020-06-223-17/+80
| | | | | Change-Id: Iaf6cb99784f4e1ed1291ace1f4cc18cf6af88672 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LSP: Fix and simplify log size restriction logichjk2020-06-191-3/+3
| | | | | | | | Do not subtract from unsigned (size) values. Amends d15d15efa28eacf7bb85b91da72a612453be53de. Change-Id: I9a8b09d3733b49ea646ae8a14caefcf5c908fad3 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* LanguageClient: Replace QRegexp by QRegularExpressionChristian Stenger2020-06-192-7/+12
| | | | | | Task-number: QTCREATORBUG-24098 Change-Id: Ic8259ded3f721957bd04aa00146b20bd90b41dcd Reviewed-by: hjk <hjk@qt.io>
* LSP: Remove a use of QLinkedListhjk2020-06-182-10/+10
| | | | | | Task-number: QTCREATORBUG-24098 Change-Id: Ia043284fa57e74ae1ca5f2aef6c3c363b0ca0715 Reviewed-by: David Schulz <david.schulz@qt.io>
* LSP: add rename functionalityDavid Schulz2020-06-174-16/+253
| | | | | | Fixes: QTCREATORBUG-21578 Change-Id: Iec54ebed6358453af4ef16a2a4e6aef0418faebe Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* All: Use Utils::SkipEmptyPartshjk2020-06-171-3/+6
| | | | | | Task-number: QTCREATORBUG-24098 Change-Id: Iab45de9a9c17ddc39a0e343b1175d4f6cb94b098 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LSP: Fix TextDocumentEdit member nameDavid Schulz2020-06-121-3/+3
| | | | | | | | The VersionedTextDocumentIdentifier can be acccessed under textDocument not id. Change-Id: I9b3531532ed92885147525fa580c62d4b52f9c4b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LSP: Do not accumulate connections during signal emissionhjk2020-05-252-4/+8
| | | | | | | | | | | 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>
* LanguageClient: Use a new ListModel convienience functionhjk2020-05-201-2/+2
| | | | | Change-Id: I5cf806f40264b5c10bb3b31c153a52760346d40d Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: Rename ListModel::forItems to ListModel::forAllDatahjk2020-05-201-1/+1
| | | | | | | | | This is more consistent with allData() and setAllData(). Adjust its only user. Change-Id: Idd5cea3f37c6a84d052bd56a4a413a35d80289ad Reviewed-by: David Schulz <david.schulz@qt.io>
* LSP: add symbol support classDavid Schulz2020-05-199-156/+275
| | | | | | | | | | | | 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>
* LSP: Robustify open documentsDavid Schulz2020-05-144-31/+29
| | | | | | | | | | | 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>
* LSP: fix codeassists running checkDavid Schulz2020-05-143-16/+18
| | | | | | | | 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>
* LSP: do not create empty function hint proposal modelDavid Schulz2020-05-141-3/+7
| | | | | | | | Fixes: SOFT ASSERT: "d->m_totalHints != 0" in functionhintproposalwidget.cpp Change-Id: Ibfda27bf1e02b60d624851995ce1f5f54f662182 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LSP: react on file list changed signal from projectDavid Schulz2020-05-134-7/+41
| | | | | | | | | | | | | | | | | 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>
* LSP: addDiagnosticsSelections should be static in Client.cppAlexis Murzeau2020-05-121-2/+2
| | | | | | | | | | | | 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>
* CodeAssist: Fix leaking asynchronous processorsDavid Schulz2020-05-125-0/+29
| | | | | | | | | 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>
* LSP: CompletionRequest: set triggerCharacter when possibleAlexis Murzeau2020-05-111-3/+8
| | | | | | | | | | | | When the completion request is triggered by an activation character, set the triggerCharacter accordingly. This can help the language server to propose more sensible items. Detected while trying cmake language server. It was throwing an error when triggerKind is TriggerCharacter and triggerCharacter is not present. Change-Id: Ifde578e39f2eebfc5c6551f08985f4408f6c7933 Reviewed-by: David Schulz <david.schulz@qt.io>
* LSP: Add setting to provide initializationOptions to the language serverAlexis Murzeau2020-05-114-1/+65
| | | | | | | | | | | 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>
* LSP: Always override the assist providers if the server supports themAlexis Murzeau2020-05-111-10/+18
| | | | | | | | | | | | | | | 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>
* LSP: allow non versioned text document in SemanticHighlightingParamsAlexis Murzeau2020-05-111-2/+11
| | | | | | | | | | | | | | | | 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>
* LSP: show tooltips for diagnosticsDavid Schulz2020-05-041-1/+10
| | | | | | Change-Id: I9625c77f87c31d3287ab17de42a507a8b068e118 Reviewed-by: Alexis Murzeau <amubtdx@gmail.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LSP: underline code with diagnostics from the language serverAlexis Murzeau2020-04-291-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* LSP: update semantic highlighting to use more colorsAlexis Murzeau2020-04-291-0/+4
| | | | | | | | | | | | | | The actual highlighting of the C++ code using clangd doesn't use many colors to differentiate symbols (for example, fields of a class). This commit makes symbols more visible for these categories: - static methods - preprocessor macros - struct and class fields - static fields Change-Id: I001325cf5e48aa07d7397b2b7ac98a65501e1d5d Reviewed-by: David Schulz <david.schulz@qt.io>
* LSP: Fix language server desynchronisation when whole file contents changeAlexis Murzeau2020-04-291-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* LSP: fix outline's selected item when writingAlexis Murzeau2020-04-291-0/+6
| | | | | | | | | | | | | | When receiving textDocument/documentSymbol or textDocument/symbolInformation, the outline widget and the outline combobox is cleared and updated with received symbols. This causes the selected index to become the first item of the list when writing text. Fix the issue by updating the selected index after having updated the outline widget and outline combobox. Change-Id: I52541940f8a979cbf130da4383db48c470fc94e1 Reviewed-by: David Schulz <david.schulz@qt.io>
* LSP: Fix completion assist that could be the wrong providerAlexis Murzeau2020-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | When a document is opened that uses a language server, it would not gain the completion assitance from the language server in some cases. Instead, the default completion assist provider is used, which in case of the TextEditor, will only provide basic autocompletion. The reason is that Client::activateDocument is not called if the document is not in LanguageClientManager::m_clientForDocument when Client::openDocument is called. The check is at the end of that function. When the issue happens, openDocument is called indirectly from LanguageClientManager::documentOpened. The fix is to change the order of instructions in LanguageClientManager::documentOpened so m_clientForDocument is updated before calling openDocumentWithClient. This way, the language server's completion assist is really used as it should. Change-Id: I0d2b3b8573e97c0c0c4bd517775668d41a4a797b Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: Replace FileChooser::path() by filePath().toString()hjk2020-04-091-1/+1
| | | | | | | | | | | Keep the old method for now to ease downstream porting. The change is kept mechanical, there's a lot of cleanup possible now on the user code side. Change-Id: I936baedd45b7ba057f1c789a1bec896886f48eff Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* LanguageClient: Resolve recursive includeDavid Schulz2020-03-262-1/+5
| | | | | Change-Id: I2d365afc71a07e08b26052798fec1ce2c1e63fe3 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LanguageClient: Fix setting trigger chars for function hint providerDavid Schulz2020-03-261-1/+1
| | | | | Change-Id: Ibd9f647ea6005638a06524aeac9ea64a0632b0d0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LanguageClient: Fix build with namespaced QtChristian Stenger2020-03-031-2/+0
| | | | | Change-Id: Id3daafa070aa2159f02cdac2cc8ed4348183b9aa Reviewed-by: David Schulz <david.schulz@qt.io>
* LanguageClient: Fix passing proposalsChristian Stenger2020-03-021-9/+8
| | | | | | | | Pass the real proposals around instead of a copied nullptr. Change-Id: I1a8678bcbd5838113f6416b6f63d92d6cceceb3f Reviewed-by: David Schulz <david.schulz@qt.io>
* LanguageClient: Add logging windowDavid Schulz2020-03-029-0/+469
| | | | | Change-Id: Ib86b70381b69df55d62a97abdf52b747f7f1c75e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LanguageClient: Request symbols in outline combo box constructorDavid Schulz2020-03-021-0/+2
| | | | | Change-Id: Ib7bc4f828b6e3abc4344ff96b7561015ac0cf66f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LanguageClient: request symbols for all compressed urisDavid Schulz2020-03-021-1/+1
| | | | | Change-Id: Ib6d08f7d4f1efaaa2b484af312599b8b338fbcf5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* LanguageClient: clear compressed uri after requesting symbolsDavid Schulz2020-03-021-0/+1
| | | | | Change-Id: I1247959d657c5449a37a9e2ac16380eb9b14afe0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CMake Build: Fix linking PythonPlugin in Debug mode with MinGWCristian Adam2020-02-261-1/+1
| | | | | | | | | | | | | | PythonPlugin depends on LanguageClient, which has a private dependency on LanguageServerProtocol. This fixes this error: src/plugins/python/CMakeFiles/Python.dir/pythonrunconfiguration.cpp.obj: In function `int LanguageServerProtocol::JsonObject::typedValue<int>(QString const&) const': src/libs/languageserverprotocol/jsonobject.h:134: undefined reference to `__imp__ZN22LanguageServerProtocol13fromJsonValueIiEET_RK10QJsonValue' Change-Id: I7cacbf68a00ff9ff2a6ab9618bc6ec371247a0aa Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* Editor: Fix crash in codeassistDavid Schulz2020-02-261-2/+5
| | | | | | | | | We have to report back to the code assistant even if we have no results. Otherwise the processors aren't correctly reset and may be called after deletion. Change-Id: Id7af2e0ee9f631efc00beb2a84bfe1824e138d24 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/4.11' into 4.12Eike Ziller2020-02-262-3/+7
|\ | | | | | | Change-Id: I8cc80483cdb10309bf73aba5cfab52c1d90e1bbc
| * LanguageClient: Fix client restart after crashDavid Schulz2020-02-252-1/+4
| | | | | | | | | | | | | | | | | | 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>
| * LanguageClient: Only send contentsChanged notification to reachable clientsDavid Schulz2020-02-251-1/+1
| | | | | | | | | | Change-Id: Id35b94d3c6f9b3b08b1e66b992ca5fe86cdab6d5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
| * LanguageClient: Only send position changed signals to reachable clientsDavid Schulz2020-02-251-1/+2
| | | | | | | | | | Change-Id: I0d387ea10aeba8f5f1be3d0ddb6a6ccb82e04e64 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Globally disable WindowContextHelpButtonHintKai Koehne2020-02-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | Do set the global application flag AA_DisableWindowContextHelpButton to avoid having to unset the default WindowContextHelpButtonHint in every single dialog. AA_DisableWindowContextHelpButton was added in Qt 5.10. Change-Id: I21fe8bc5ddfa4c01ec7a799b04bfb6ff1c9d6d86 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | CodeAssistant: add cancel to asynchronous processorsDavid Schulz2020-02-203-12/+39
| | | | | | | | | | | | | | | | 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>
* | LanguageClient: fix memory leak in client initializationDavid Schulz2020-02-201-6/+6
| | | | | | | | | | Change-Id: I30e4032cea5fff46ffd790336729cc6fbaf4b104 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | LanguageClient: fix soft assert for uninitialized serverDavid Schulz2020-02-201-1/+1
| | | | | | | | | | | | | | | | Do not send close documents notifications to an uninitialized server Fixes: QTCREATORBUG-23598 Change-Id: Iaabd082203a91a56ebcd60f93e6a0c97048e89c1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>