Search backend: Enable multi-line matches
Created by: tbliu98
This PR introduces the MultilineMatch
type and transitions result.FileMatch
to use that instead of LineMatch
.
Change overview:
- Introduce the
MultilineMatch
type - Replace
FileMatch.LineMatches
withFileMatch.MultilineMatches
in the search backend - Provide methods
AsLineMatches()
,AsMultilineMatches()
, andMultilineSliceAsLineMatchSlice()
to convert betweenLineMatch
andMultilineMatch
, so other services which still rely onLineMatch
can remain unchanged for now - Fix result limiting, which previously did not limit symbol results at all
A noteworthy thing here is that we can birectionally convert between LineMatch
and MultilineMatch
. The important thing about this is that we can start using MultilineMatch
throughout the frontend
process without changing any of the APIs into or out of frontend
. That then allows us to merge this change independently from any changes to zoekt, searcher, gitserver, or search clients. Yay!
The next steps will be to update the search backends (particularly zoekt and searcher) to return multiline matches. Following that, we we update the GraphQL and streaming APIs to return multiline matches and deprecate the LineMatch
API.
This PR depends on a change to Comby, so cannot be merged until the sourcegraph deployment has been updated to use that version.
Test plan
Unit tests for new functionality. Manually verify correct preview and highlight range for multi-line structural and regex search results.