on master help sign in
better panic messages for when you're missing selection scopes (#608)
commit59e0ceef8c764950199a7e6874e15150ba329af3 authorKirawi <67773714+kirawi@users.noreply.github.com> dateSat 21 Aug 2021, 22:15 (5 years ago) parentf9375f4
1 file changed+4−2
helix-term/src/ui/editor.rs+4−2
helix-term/src/ui/editor.rs+4−2
@@ -195,7 +195,9 @@ impl EditorView {
195195 .find_scope_index("diagnostic")
196196 .or_else(|| theme.find_scope_index("ui.cursor"))
197197 .or_else(|| theme.find_scope_index("ui.selection"))
198− .expect("no selection scope found!");
198+ .expect(
199+ "at least one of the following scopes must be defined in the theme: `diagnostic`, `ui.cursor`, or `ui.selection`",
200+ );
199201
200202 doc.diagnostics()
201203 .iter()
@@ -220,7 +222,7 @@ impl EditorView {
220222
221223 let selection_scope = theme
222224 .find_scope_index("ui.selection")
223− .expect("no selection scope found!");
225+ .expect("could not find `ui.selection` scope in the theme!");
224226 let base_cursor_scope = theme
225227 .find_scope_index("ui.cursor")
226228 .unwrap_or(selection_scope);