Skip to content

search: Refactor CodeMirror query input suggestions

Warren Gifford requested to merge fkling/cm/suggestions-2 into main

Created by: fkling

Depends on #33295

This PR refactors the suggestions CodeMirror integration. Because CodeMirror makes it easy to use multiple autocompletion sources, suggestions are now implemented as four sources for default suggestions, dynamic symbol suggestions, static filter value suggestions and dynamic filter suggestions. Most importantly, autocompletion for regex filter values (e.g. repo:^git) now work, by instructing CodeMirror to not filter the values (filter: false) (fixes #33005 (closed)).

searchQueryAutocompletion now accepts an arrow of suggestion sources, making it easier in the future to extend the autocompletion behavior (e.g. to provide better support for completion inside predicates).

As an experiment I'm also rending filter suggestion slightly differently (bold) to make them easier to distinguish from symbol suggestions (this will likely change with more design input and better support for icons).

https://user-images.githubusercontent.com/179026/161617202-383703d0-248f-40fa-9602-233a5852e8d3.mp4

Test plan

New unit test: I ported the relevant existing autocompletion tests to the new implementation.

App preview:

Merge request reports

Loading