{"record":{"id":"b5c52070dff8fb35","repo":"zed-industries/zed","slug":"is-a-splittable-editor","errorCode":null,"errorMessage":"Is a splittable editor","messagePattern":"Is a splittable editor","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/search/src/buffer_search.rs","lineNumber":1008,"sourceCode":"    // The query editor is an editor itself and would otherwise swallow this\n    // action without any visible effect, so relay it to the searched editor\n    // while keeping the focus in the search bar.\n    fn toggle_soft_wrap(\n        &mut self,\n        action: &ToggleSoftWrap,\n        window: &mut Window,\n        cx: &mut Context<Self>,\n    ) {\n        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| {","sourceCodeStart":990,"sourceCodeEnd":1026,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/search/src/buffer_search.rs#L990-L1026","documentation":"toggle_soft_wrap expects the active searchable item to expose itself as a splittable editor; the act_as_type lookup succeeded but downcast to SplittableEditor failed, a type-registration inconsistency in the searchable item implementation.","triggerScenarios":"Thrown at crates/search/src/buffer_search.rs:1008 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the item registers itself as SplittableEditor consistently with what act_as_type returns","Use a checked conversion that returns Option instead of expect","Verify the active item type supports the soft-wrap relay"],"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"}