search: Show placeholder for some filters (CodeMirror)
Created by: fkling
Addresses https://github.com/sourcegraph/sourcegraph/issues/20662
This commit adds logic to render a simple placeholder when a filter has no value. I only added placeholders to filters for which we don't provided static suggestions. I think suggestions provide enough information about which value can be used. This way we also avoid some visual clutter (placeholder + suggestions visible otherwise).
Note that the filter will only be shown when the filter is currently "active", i.e. the text cursor is "inside" the filter (and there is no value of course).
We could also make it so that the placeholder is always shown, regardless where the cursor is positioned.
I chose placeholder text that seem reasonable to me but please make suggestions for improvements.
Caveat: Due to the placeholder not being part of the document and because we don't do line wrapping in the main query input, the placeholder text will be truncated at the end of the input. But I think that's an acceptable tradeoff.
Test plan
Type author:
, count:
, etc in the query input. A placeholder value should be shown as long as the filter has not value and "has focus". The placeholder value is not selectable.
App preview:
Check out the client app preview documentation to learn more.