Distinguish between prop source matchers (comprehensive, objective) and suggesters (ordered by importance, filtered by relevance: subjective)
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3555300. -->
Reported by: [wim leers](https://www.drupal.org/user/99777)
Related to !748
>>>
<h3 id="overview">Overview</h3>
<p><code>PropSourceSuggester</code> is too complex to understand. It needs to become simpler for maintainability. It should have a clear relationship to the various prop source types it may suggest, and the logic that it uses to find suggestions at all should be split out per prop source type.</p>
<p>@Wim Leers in <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3523446" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3523446</a></span>:</p>
<blockquote><p>
I propose the following next steps in a subsequent issue:</p>
<ol>
<li><code>JsonSchemaFieldInstanceMatcher</code> → <code>DynamicPropSourceMatcher</code> (or, if we do what you suggested in <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3548297" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3548297</a></span>, <code>EntityFieldPropSourceMatcher</code>)</li>
<li><code>\Drupal\canvas\ShapeMatcher\PropSourceSuggester::matchHostEntityUrlPropSources()</code> → <code>HostEntityUrlPropSourceMatcher</code></li>
<li><code>PropSourceSuggester</code> <em>uses</em> both of the above</li>
<li><code>PropShapeToFieldInstanceTest</code> → merged into <code>PropSourceSuggesterTest</code></li>
</ol>
</blockquote>
<p>(rationale: "matcher"s are for objectively true matches, "suggester"s are for inserting subjectiveness, such as order and what to omit vs not — see <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3551339" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3551339</a></span> for example)</p>
<p>WDYT? 😄
</p>
<p>@phenaproxima in #26 on that issue:</p>
<blockquote><p>
I do like the idea of separating matchers from the suggester, conceptually. A matcher deterministically answers the question "does X == Y?", and a suggester filters/sorts a (sub?)set of things that are matches, based on context.
</p></blockquote>
<h3 id="proposed-resolution">Proposed resolution</h3>
<p>Make it so.</p>
<p>FYI: <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3551339" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3551339</a></span> is an example of an issue where it's crystal clear that that is on the "suggesting" rather than the "matching" side.</p>
<h3 id="ui-changes">User interface changes</h3>
<p>None.</p>
issue