Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
db9a390e
Commit
db9a390e
authored
Oct 05, 2009
by
Roberto Raggi
Browse files
Highlight unused symbols.
parent
64ccdc7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
db9a390e
...
...
@@ -908,7 +908,6 @@ void CPPEditor::renameSymbolUnderCursor()
QTextCursor
c
=
textCursor
();
m_currentRenameSelection
=
-
1
;
m_renameSelections
=
extraSelections
(
CodeSemanticsSelection
);
for
(
int
i
=
0
;
i
<
m_renameSelections
.
size
();
++
i
)
{
QTextEdit
::
ExtraSelection
s
=
m_renameSelections
.
at
(
i
);
if
(
c
.
position
()
>=
s
.
cursor
.
anchor
()
...
...
@@ -980,10 +979,9 @@ void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
QList
<
QTextEdit
::
ExtraSelection
>
*
selections
)
{
bool
isUnused
=
false
;
if
(
uses
.
size
()
==
1
)
{
if
(
uses
.
size
()
==
1
)
isUnused
=
true
;
return
;
// ###
}
foreach
(
const
SemanticInfo
::
Use
&
use
,
uses
)
{
QTextEdit
::
ExtraSelection
sel
;
...
...
@@ -1882,7 +1880,6 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
// only set the background, we do not want to modify foreground properties set by the syntax highlighter or the link
m_occurrencesFormat
.
clearForeground
();
m_occurrencesUnusedFormat
.
clearForeground
();
m_occurrenceRenameFormat
.
clearForeground
();
}
...
...
@@ -1944,7 +1941,9 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
int
line
=
0
,
column
=
0
;
convertPosition
(
position
(),
&
line
,
&
column
);
QList
<
QTextEdit
::
ExtraSelection
>
selections
;
QList
<
QTextEdit
::
ExtraSelection
>
allSelections
;
m_renameSelections
.
clear
();
SemanticInfo
::
LocalUseIterator
it
(
semanticInfo
.
localUses
);
while
(
it
.
hasNext
())
{
...
...
@@ -1961,11 +1960,18 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
}
}
if
(
uses
.
size
()
==
1
||
good
)
if
(
uses
.
size
()
==
1
)
{
// it's an unused declaration
highlightUses
(
uses
,
&
allSelections
);
}
else
if
(
good
)
{
QList
<
QTextEdit
::
ExtraSelection
>
selections
;
highlightUses
(
uses
,
&
selections
);
m_renameSelections
+=
selections
;
allSelections
+=
selections
;
}
}
setExtraSelections
(
CodeSemanticsSelection
,
s
elections
);
setExtraSelections
(
CodeSemanticsSelection
,
allS
elections
);
}
SemanticHighlighter
::
Source
CPPEditor
::
currentSource
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment