search: pass language to structural search
Created by: rvantonder
Pass the values of lang
to searcher so that structural search can pick a matcher. The lang
parameter is traditionally used by Zoekt/literal/regex searcher to only filter files by extension. By passing the lang parameter to searcher
, comby
can use the lang parameter in a semantically meaningful way to force language-aware parsing.
Architecture note:
Structural search only works when indexing is active. This means that lang
and file
parameters in the query are honored and processed by Zoekt code first, always. For structural search, Zoekt returns files matching parts of the search pattern we care about, and these files are the only thing we are interested in (we no longer care about performing filtering on files using regular expressions, like \.c$|\.h$
, etc.). Thus: includePatterns
is wiped when isStructuralPat
is true, and we populate the includePatterns
with the file paths returned by Zoekt for structural search to process.
If and when structural search is activated for unindexed search (not currently supported), the logic will need to process regex file patterns. For now we don't need to worry about this because the Zoekt code is a required passthrough.