taskgenius_taskgenius-plugin/docs/editor-extensions-refactoring-plan.md

4.4 KiB

Editor Extensions Refactoring Plan

Overview

This document outlines the refactoring of the editor-ext directory to improve organization, consistency, and maintainability of editor extension code.

Completed on: 2025-01-19

Changes Implemented

Directory Renaming

  • Old: src/editor-ext/
  • New: src/editor-extensions/
  • Reason: More complete and professional naming

New Directory Structure

src/editor-extensions/
├── autocomplete/       # Auto-completion and suggestion features
│   ├── task-metadata-suggest.ts  
│   └── parent-task-updater.ts    
│
├── task-operations/    # Task operations (status, cleanup, monitoring)
│   ├── status-cycler.ts          
│   ├── status-switcher.ts        
│   ├── completion-monitor.ts     
│   ├── mark-cleanup.ts           
│   └── gutter-marker.ts          
│
├── date-time/          # Date and time features
│   ├── date-picker.ts            
│   ├── date-manager.ts           
│   └── task-timer.ts             
│
├── ui-widgets/         # UI decorations and widgets
│   ├── progress-bar-widget.ts    
│   ├── priority-picker.ts        
│   └── workflow-decorator.ts     
│
├── workflow/           # Workflow features
│   ├── workflow-handler.ts       
│   └── workflow-enter-handler.ts 
│
└── core/               # Core editor functionality
    ├── markdown-editor.ts         
    ├── extended-gutter.ts         
    ├── regex-cursor.ts            
    ├── task-filter-panel.ts      
    └── quick-capture-panel.ts    

File Renaming Details

Autocomplete

Original New Reason
QuickCaptureSuggest.ts task-metadata-suggest.ts More accurate description of task metadata suggestions
autoCompleteParent.ts parent-task-updater.ts Clearly indicates parent task update functionality

Task Operations

Original New Reason
cycleCompleteStatus.ts status-cycler.ts Simplified name, kebab-case
taskStatusSwitcher.ts status-switcher.ts Kebab-case consistency
monitorTaskCompleted.ts completion-monitor.ts Simplified and clearer
taskMarkCleanup.ts mark-cleanup.ts Simplified name
TaskGutterHandler.ts gutter-marker.ts More accurate description

Date-Time

Original New Reason
datePicker.ts date-picker.ts Kebab-case consistency
autoDateManager.ts date-manager.ts Simplified name
taskTimer.ts task-timer.ts Kebab-case consistency

UI Widgets

Original New Reason
progressBarWidget.ts progress-bar-widget.ts Kebab-case consistency
priorityPicker.ts priority-picker.ts Kebab-case consistency
workflowDecorator.ts workflow-decorator.ts Kebab-case consistency

Workflow

Original New Reason
workflow.ts workflow-handler.ts More explicit name
workflowRootEnterHandler.ts workflow-enter-handler.ts Simplified name

Core

Original New Reason
markdownEditor.ts markdown-editor.ts Kebab-case consistency
patchedGutter.ts extended-gutter.ts More professional name
regexp-cursor.ts regex-cursor.ts Common abbreviation
filterTasks.ts task-filter-panel.ts More explicit name
quickCapture.ts quick-capture-panel.ts More explicit name

Benefits Achieved

  1. Clear Separation of Concerns: Each subdirectory now has a specific, well-defined purpose
  2. Consistent Naming: All files use kebab-case naming convention
  3. Improved Discoverability: Developers can easily find functionality based on category
  4. Better Maintainability: Related code is grouped together
  5. Professional Structure: The naming and organization follows modern best practices

Migration Impact

  • All import paths have been updated throughout the codebase
  • No functionality changes, only organizational improvements
  • Build succeeds with no errors
  • All tests continue to pass

Future Considerations

  1. Consider creating barrel exports (index.ts) for each subdirectory
  2. Add README files in each subdirectory explaining the purpose and contents
  3. Consider further splitting large files if they contain multiple responsibilities
  4. Add JSDoc comments to exported functions for better documentation