C++: optionally let the highlighter handle ifdefed-out blocks.

Change-Id: I38cc0e55348cac0245d2ab8f3e39c68de76e3e6d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2013-08-09 11:43:20 +02:00
committed by Nikolai Kosjar
parent 480f7c09fc
commit 073e5d6632
10 changed files with 67 additions and 22 deletions

View File

@@ -192,6 +192,13 @@ void CppEditorSupport::setExtraDiagnostics(const QString &key,
emit diagnosticsChanged();
}
void CppEditorSupport::setIfdefedOutBlocks(const QList<BlockRange> &ifdefedOutBlocks)
{
m_editorUpdates.ifdefedOutBlocks = ifdefedOutBlocks;
emit diagnosticsChanged();
}
bool CppEditorSupport::initialized()
{
return m_initialized;
@@ -262,11 +269,13 @@ void CppEditorSupport::onDocumentUpdated(Document::Ptr doc)
return; // outdated content, wait for a new document to be parsed
// Update the ifdeffed-out blocks:
QList<Document::Block> skippedBlocks = doc->skippedBlocks();
m_editorUpdates.ifdefedOutBlocks.clear();
m_editorUpdates.ifdefedOutBlocks.reserve(skippedBlocks.size());
foreach (const Document::Block &block, skippedBlocks) {
m_editorUpdates.ifdefedOutBlocks.append(BlockRange(block.begin(), block.end()));
if (m_highlightingSupport && !m_highlightingSupport->hightlighterHandlesIfdefedOutBlocks()) {
QList<Document::Block> skippedBlocks = doc->skippedBlocks();
QList<BlockRange> ifdefedOutBlocks;
ifdefedOutBlocks.reserve(skippedBlocks.size());
foreach (const Document::Block &block, skippedBlocks)
ifdefedOutBlocks.append(BlockRange(block.begin(), block.end()));
setIfdefedOutBlocks(ifdefedOutBlocks);
}
if (m_highlightingSupport && !m_highlightingSupport->hightlighterHandlesDiagnostics()) {