Esempio n. 1
0
void CppEditorSupport::onDocumentUpdated(Document::Ptr doc)
{
    if (doc.isNull())
        return;

    if (doc->fileName() != fileName())
        return; // some other document got updated

    if (doc->editorRevision() != editorRevision())
        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()));
    }
void CppEditorSupport::onDocumentUpdated(Document::Ptr doc)
{
    if (doc.isNull())
        return;

    if (doc->fileName() != fileName())
        return; // some other document got updated

    if (doc->editorRevision() != editorRevision())
        return; // outdated content, wait for a new document to be parsed

    // Update the ifdeffed-out blocks:
    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);
    }