From 756a67854ac55058f1e6da496ade91f4255b5d02 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Mon, 30 Nov 2009 15:21:16 +0100
Subject: [PATCH] Highlight unused symbols.

---
 src/plugins/cppeditor/cppeditor.cpp     | 8 ++++----
 src/plugins/texteditor/basetexteditor.h | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 465c51a6d0a..8e177406bc6 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1934,7 +1934,7 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
     int line = 0, column = 0;
     convertPosition(position(), &line, &column);
 
-    QList<QTextEdit::ExtraSelection> allSelections;
+    QList<QTextEdit::ExtraSelection> unusedSelections;
 
     m_renameSelections.clear();
 
@@ -1955,16 +1955,16 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
 
         if (uses.size() == 1) {
             // it's an unused declaration
-            // highlightUses(uses, &allSelections);
+            highlightUses(uses, &unusedSelections);
         } else if (good) {
             QList<QTextEdit::ExtraSelection> selections;
             highlightUses(uses, &selections);
             m_renameSelections += selections;
-            allSelections += selections;
         }
     }
 
-    setExtraSelections(CodeSemanticsSelection, allSelections);
+    setExtraSelections(UnusedSymbolSelection, unusedSelections);
+    setExtraSelections(CodeSemanticsSelection, m_renameSelections);
 }
 
 SemanticHighlighter::Source CPPEditor::currentSource(bool force)
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index a9495b747e8..9a04cf6076f 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -471,8 +471,9 @@ public:
         ParenthesesMatchingSelection,
         CodeWarningsSelection,
         CodeSemanticsSelection,
-        OtherSelection,
+        UnusedSymbolSelection,
         FakeVimSelection,
+        OtherSelection,
         NExtraSelectionKinds
     };
     void setExtraSelections(ExtraSelectionKind kind, const QList<QTextEdit::ExtraSelection> &selections);
-- 
GitLab