forked from qt-creator/qt-creator
LocatorFilterEntry: Add linkForEditor
Make it of std::optional<Utils::Link> type. Use it for: 1. Removing duplicates 2. Showing link inside editor Before, QVariant internalData was used in above cases. Rationale: 1. Removing duplicates between results from different ILocatorFilter makes only sense if accept() overload for these filter types are the same (i.e. the implementation is repeated). Otherwise, we are loosing some functionality when some result is removed. Taking into account that original intention was to eliminate duplicates for filters where we do BaseFileFilter::openEditorAt() inside accept(), we store linkForEditor in 3 cases (instead of storing internalData): - BaseFileFilter - FileSystemFilter (only existing file case) - OpenDocumentsFilter We don't save a linkForEditor where we stored QString inside internalData in the following cases: - JavaScriptFilter - FileSystemFilter (non existing file case) Before, in above cases, we could have filtered out some results unintentionally. This patch should fix it. Now, we remove duplicates only for enties that have value for linkForEditor. 2. Use directly linkForEditor, if exists, for opening editor. This patch aims to decrease the number of different responsibilities of internalData by 1. Make 3rd arg of LocatorFilterEntry c'tor default. Change-Id: I144c58661d7456bb5991f8077dc103272dfab194 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -50,7 +50,7 @@ QList<Core::LocatorFilterEntry> MacroLocatorFilter::matchesFor(QFutureInterface<
|
||||
}
|
||||
|
||||
if (index >= 0) {
|
||||
Core::LocatorFilterEntry filterEntry(this, displayName, QVariant(), m_icon);
|
||||
Core::LocatorFilterEntry filterEntry(this, displayName, {}, m_icon);
|
||||
filterEntry.extraInfo = description;
|
||||
filterEntry.highlightInfo = Core::LocatorFilterEntry::HighlightInfo(index, entry.length(), hDataType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user