Open mike-r-mclaughlin opened 2 years ago
cc @rvantonder
I'm generally in favor of ergonomic adjustments to syntax to support this kind of thing, and maybe a |
operator on lang
is OK. In general though I hesitate to make an adjustment like this in the core language, and it might be better to support via a surface syntax (an implementation/design layer that doesn't exist right now).
This would still be nice, also for multiselection of other things. I think we could support this language-wise with a predicate like lang:in(Typescript, Javascript)
.
This could also be helpful for our query evaluation since right now we need to DNF the query before evaluating an OR. If we have a syntax construct that is essentially an OR but for a single filter type, that would be significantly easier to optimize.
Requested by: https://github.com/sourcegraph/accounts/issues/6716 via Slack
Feature request description
It would be nice to make searching across multiple specific languages. The way the query syntax works now requires you to use boolean
OR
logic like this:(lang:language1 OR lang:language2)
From the user:
Example use case
I often need to search across both
JavaScript
andTypeScript
files, so I use something like this:\bkeyword\b (lang:typescript OR lang:javascript)
Describe alternatives you've considered.
Create a personal search context, that adds
(lang:typescript OR lang:javascript)
and select that search context. This is a bit clunky. But it might help.Use search snippets.
/cc @sourcegraph/search-platform/search-core