on master help sign in
better panic messages for when you're missing selection scopes (#608)
59e0ceeKirawi
helix-term/src/ui/editor.rs+4−2
@@ -195,7 +195,9 @@ impl EditorView {
195 .find_scope_index("diagnostic")
195 .find_scope_index("diagnostic")
196 .or_else(|| theme.find_scope_index("ui.cursor"))
196 .or_else(|| theme.find_scope_index("ui.cursor"))
197 .or_else(|| theme.find_scope_index("ui.selection"))
197 .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+ );
199
201
200 doc.diagnostics()
202 doc.diagnostics()
201 .iter()
203 .iter()
@@ -220,7 +222,7 @@ impl EditorView {
220
222
221 let selection_scope = theme
223 let selection_scope = theme
222 .find_scope_index("ui.selection")
224 .find_scope_index("ui.selection")
223− .expect("no selection scope found!");
225+ .expect("could not find `ui.selection` scope in the theme!");
224 let base_cursor_scope = theme
226 let base_cursor_scope = theme
225 .find_scope_index("ui.cursor")
227 .find_scope_index("ui.cursor")
226 .unwrap_or(selection_scope);
228 .unwrap_or(selection_scope);