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>
This commit is contained in:
Andre Hartmann
2019-07-31 18:05:53 +02:00
committed by André Hartmann
parent 845fd8d533
commit 92daed1f6c

View File

@@ -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;
}