{"record":{"id":"176d753fe399bd17","repo":"zed-industries/zed","slug":"is-an-editor","errorCode":null,"errorMessage":"Is an editor","messagePattern":"Is an editor","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/search/src/buffer_search.rs","lineNumber":1017,"sourceCode":"        let Some(item) = &self.active_searchable_item else {\n            return;\n        };\n        // A split diff editor picks which side to toggle and keeps both sides\n        // in sync, while its `act_as_type(Editor)` only exposes the RHS\n        // editor, so relay to the split editor itself when it is split.\n        if let Some(split_editor) = item.act_as_type(TypeId::of::<SplittableEditor>(), cx) {\n            let split_editor = split_editor\n                .downcast::<SplittableEditor>()\n                .expect(\"Is a splittable editor\");\n            if split_editor.read(cx).is_split() {\n                split_editor.update(cx, |split_editor, cx| {\n                    split_editor.toggle_soft_wrap(action, window, cx)\n                });\n                return;\n            }\n        }\n        if let Some(item) = item.act_as_type(TypeId::of::<Editor>(), cx) {\n            let editor = item.downcast::<Editor>().expect(\"Is an editor\");\n            editor.update(cx, |editor, cx| editor.toggle_soft_wrap(action, window, cx));\n        }\n    }\n\n    fn toggle_fold_all_in_item(&self, window: &mut Window, cx: &mut Context<Self>) {\n        if let Some(item) = &self.active_searchable_item {\n            if let Some(item) = item.act_as_type(TypeId::of::<Editor>(), cx) {\n                let editor = item.downcast::<Editor>().expect(\"Is an editor\");\n                editor.update(cx, |editor, cx| {\n                    let is_collapsed = editor.has_any_buffer_folded(cx);\n                    if is_collapsed {\n                        editor.unfold_all(&UnfoldAll, window, cx);\n                    } else {\n                        editor.fold_all(&FoldAll, window, cx);\n                    }\n                })\n            }\n        }","sourceCodeStart":999,"sourceCodeEnd":1035,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/search/src/buffer_search.rs#L999-L1035","documentation":"toggle_soft_wrap expects the active searchable item to be an editor (it downcasts via act_as_type(Editor) and asserts success); a non-editor searchable item (or a broken registration) triggers this panic while relaying the soft-wrap toggle.","triggerScenarios":"Thrown at crates/search/src/buffer_search.rs:1017 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check act_as_type registration for the active searchable item","Skip soft-wrap relay for non-editor items","Return early or log instead of asserting on item type"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}