Skip to content

refactor: extract Monaco decoration management to useMonacoDecorations hook #134

Description

@bwyard

Summary

CodeEditorPanel.tsx manages three separate Monaco decoration types inline (active-line decorations, step badges, block highlights) via three useEffect blocks. Extracting these into a single custom hook would significantly simplify the component.

Task

Create:

packages/gui/src/renderer/hooks/useMonacoDecorations.ts

Signature:

export const useMonacoDecorations = (
  editorRef:       React.RefObject<MonacoEditorNS.IStandaloneCodeEditor | null>,
  monacoRef:       React.RefObject<Monaco | null>,
  decorations:     LineDecoration[]       | undefined,
  stepBadges:      StepBadge[]            | undefined,
  blockHighlights: BlockHighlight[]       | undefined,
): void

The hook owns all three deltaDecorations refs and effects. CodeEditorPanel calls it once.

Acceptance

  • Same visual behaviour — no decoration regressions
  • CodeEditorPanel.tsx drops ~80 lines
  • Hook has TSDoc block
  • Types pass (pnpm typecheck)

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersrefactorCode refactoring — no behaviour change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions