Skip to content

feat(toolbar): gate builds to root-level C and C++ sources #84

Description

@kbuffardi

Problem\n\nThe toolbar Compile and Compile & Run actions can currently be available when an opened folder cannot be built through the toolbar, including projects whose eligible sources exist only in subdirectories. Current source handling also excludes valid C and C++ extensions that users expect to work.\n\n## Confirmed behavior\n\n- Enable Compile and Compile & Run only when an opened workspace has at least one qualifying source directly in its root.\n- Qualifying extensions are .c, .cc, .cpp, and .cxx, matched case-insensitively.\n- A toolbar build compiles every qualifying root-level source, sorted deterministically.\n- Files in subdirectories are not toolbar compilation units and do not enable the buttons. Users compile those explicitly from the terminal.\n- Compile .c files with the existing C++ compiler mode.\n- Disabled actions must have a clear unavailable visual state and remain guarded against clicks and keyboard shortcuts.\n- Existing compiler lifecycle restrictions (loading, compiling, and preparing a run) continue to disable the actions.\n\n## Implementation plan\n\n1. Centralize case-insensitive source recognition and root-only toolbar source selection in src/ui/build-request.mjs. Reuse it for both button eligibility and implicit toolbar sourcePaths.\n2. Update src/ui/toolbar.js to compose workspace eligibility with compiler lifecycle state, preserve explicit terminal source paths, and prevent shortcut/click bypasses.\n3. Update src/ui/terminal.js to remove obsolete .c/.cc rejection for explicit terminal commands.\n4. Add disabled-state affordances in src/ui/styles.css.\n5. Update source-discovery and toolbar integration tests for extension handling, root-only selection, nested-source exclusion, terminal commands, lifecycle transitions, and non-bypass behavior.\n\n## Acceptance criteria\n\n- A root-level matching file enables both actions after the compiler is ready.\n- Only nested matching files leave both actions disabled and are absent from toolbar sourcePaths.\n- Multiple matching root files are compiled together; extension casing does not matter.\n- Explicit terminal commands can compile nested .c, .cc, .cpp, and .cxx files.\n- Buttons are visibly disabled and cannot compile while ineligible or busy.\n\n## Verification\n\n- npm run lint\n- npm run build\n- npm run test:e2e

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions