> Why does the formatter need to solve this and not the editor? The editor has more information available to it, like the present screen space.
Because making the line wrapping nice requires deep syntax-aware editor integration. Most languages try to be at least somewhat plain-text-editor-friendly.