helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
31.77k stars 2.35k forks source link

Live feedback in prompt #3050

Open A-Walrus opened 2 years ago

A-Walrus commented 2 years ago

Describe your feature request

When using a commands, such as select:, search:, :theme, :set-option, etc... some inputs are invalid (invalid regex, theme/option that doesn't exist). It would be nice to have visual feedback while typing that indicates that what you are typing is invalid, for example marking your typed text or the prompt in the error color.

Kakoune for example makes the select: text red on invalid regex while you are still typing, which can be more useful than feedback only after you submit the command.

I feel like many commands could benefit from this sort of live feedback, but mostly the regex ones. image

the-mikedavis commented 11 months ago

https://github.com/helix-editor/helix/pull/7738 improved on this a little: we show tree-sitter-regex error highlighting in the prompt. We could improve this further by validating the regex with the regex-syntax crate which we already depend on transitively: we can merge highlight ranges for syntax error spans into the prompt line's highlighting. Maybe we could also show the syntax error message in the doc popup too.

kirawi commented 3 months ago

This can be done in https://github.com/helix-editor/helix/blob/e18b772654a51afd5c840e32456cb71640c3aa10/helix-term/src/ui/mod.rs#L75-L171