forked from qt-creator/qt-creator
LSP: Fix positions for code completions
The columns are also zero based. All previously checked language server that were tested seem to ignore the fact that the completion was triggered outside of the line when triggering a completion on the last character in a line. Never the less this issue can easily be reproduced with other than the go language server when trying to complete code in the middle of a line. Fixes: QTCREATORBUG-21325 Change-Id: I1485f041a27b8fe8b85de4e13bac8bbb296dbf69 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -267,6 +267,7 @@ TextEditor::IAssistProposal *LanguageClientCompletionAssistProcessor::perform(
|
||||
if (!Utils::Text::convertPosition(interface->textDocument(), m_pos, &line, &column))
|
||||
return nullptr;
|
||||
--line; // line is 0 based in the protocol
|
||||
--column; // column is 0 based in the protocol
|
||||
params.setPosition({line, column});
|
||||
params.setTextDocument(
|
||||
DocumentUri::fromFileName(Utils::FileName::fromString(interface->fileName())));
|
||||
|
||||
Reference in New Issue
Block a user