forked from qt-creator/qt-creator
ClangCodeModel: Fix displaying ifdef'ed regions
... that are started by an indented preprocessor directive. clangd potentially sends regions not starting at line boundaries (in this case erroneously, but potentially also on purpose), which TextDocument::setIfdefedOutBlocks() does not expect. Fixes: QTCREATORBUG-31204 Change-Id: I9126263b9501edbbab1fbc22cc59c5ee1ae814c2 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -259,7 +259,7 @@ void handleInactiveRegions(LanguageClient::Client *client, const JsonRpcMessage
|
||||
const QList<Range> inactiveRegions = params->inactiveRegions();
|
||||
QList<BlockRange> ifdefedOutBlocks;
|
||||
for (const Range &r : inactiveRegions) {
|
||||
const int startPos = r.start().toPositionInDocument(doc->document());
|
||||
const int startPos = Position(r.start().line(), 0).toPositionInDocument(doc->document());
|
||||
const int endPos = r.end().toPositionInDocument(doc->document()) + 1;
|
||||
ifdefedOutBlocks.emplaceBack(startPos, endPos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user