aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2019-07-31 18:05:53 +0200
committerAndré Hartmann <aha_1980@gmx.de>2019-09-10 08:05:18 +0000
commit92daed1f6c66a7f04b968a670947bf5904dc8271 (patch)
treed4b58a123daafc14e4ef99f144becb1d643d6118
parent845fd8d533f68383a80b27413f97bf26f2f0d774 (diff)
CppLocatorFilter: Fix highlighting in extra info column
Given the following example: typedef int value; void value_test(void) {} void test(value v) {} searching for "value" findes both candidates; and for the locator filters "m" and "." highlighting already worked fine. For the locator filter ":", however, the arguments are displayed in the extraInfo column. To get proper highlighting here, we have to repeat the regexp match in this column. While fixing that, make sure that full-qualified searches (separated by "::") are still highlighted properly. For the Clang Code Model, there is still a bug not addressed by this patch: Ctrl+K with ". value" -> "value" isn't highlighted yellow. Change-Id: Idd5eeeedb893151cd5c7f70f6b11397db788b706 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
-rw-r--r--src/plugins/cpptools/cpplocatorfilter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp
index aa85f8d33f..39965d3120 100644
--- a/src/plugins/cpptools/cpplocatorfilter.cpp
+++ b/src/plugins/cpptools/cpplocatorfilter.cpp
@@ -108,7 +108,12 @@ QList<Core::LocatorFilterEntry> CppLocatorFilter::matchesFor(
matchOffset = 0;
}
filterEntry.highlightInfo = highlightInfo(match);
- if (matchOffset > 0) {
+ if (matchInParameterList && filterEntry.highlightInfo.starts.isEmpty()) {
+ match = regexp.match(filterEntry.extraInfo);
+ filterEntry.highlightInfo = highlightInfo(match);
+ filterEntry.highlightInfo.dataType =
+ Core::LocatorFilterEntry::HighlightInfo::ExtraInfo;
+ } else if (matchOffset > 0) {
for (int &start : filterEntry.highlightInfo.starts)
start -= matchOffset;
}