From 92daed1f6c66a7f04b968a670947bf5904dc8271 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Wed, 31 Jul 2019 18:05:53 +0200 Subject: 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 --- src/plugins/cpptools/cpplocatorfilter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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 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; } -- cgit v1.2.3