NS8 slice: Implement formatting, code actions, organize imports, and format-on-save #54

Closed
opened 2026-06-21 09:12:14 +00:00 by tmk241 · 1 comment
Owner

OBJECTIVE: Formatting and mutating language actions work safely with source-profile defaults, provider identity, explicit ambiguity handling, and visible format-on-save policy.

AUTHORITY: Parent #43; KEYMAP.md Coding tools and language operations and Multiple providers; req: coding/006-007, governance/001-002, input/007, testing/001-004.

AGENT AUTHORITY:

  • Delivery authority: local-commit
  • Tracker authority: this issue may be commented and closed when acceptance passes; parent #43 may be commented/checklisted.
  • Handoff state: committed clean, tracker commented/closed.

PARENT: #43 via explicit issue link and parent checklist.

SCOPE: Space l f, Space l F/w, Space l o, Space l a, source-profile format-on-save policy, provider picker for ambiguous mutating operations, edit application, save integration, one-shot save-without-format path.

BOUNDARIES: No runtime config files or hidden installers. Do not silently choose between multiple mutating providers when no source-profile default exists. Do not apply edits that target stale document versions.

ACCEPTANCE:

  • Format current buffer applies provider edits safely and preserves cursor/undo/dirty semantics.
  • Format-on-save policy is visible in the rail/status and follows source-patched defaults.
  • A one-shot save-without-format path exists when format-on-save is enabled.
  • Organize imports and code actions show provider/source and affected scope before mutation.
  • Multiple providers trigger explicit selection unless a source-profile default applies.
  • Missing formatter/action provider, malformed edits, stale edits, overlapping edits, and file-write failures are reported without data loss.

VERIFICATION:

  • zig build test
  • Fake-provider tests for format, no-op format, stale edits, overlapping edits, provider picker, format-on-save on/off, save-without-format, organize imports, code action apply/fail.
  • zig build v1-smoke

BLOCKERS: none.

OBJECTIVE: Formatting and mutating language actions work safely with source-profile defaults, provider identity, explicit ambiguity handling, and visible format-on-save policy. AUTHORITY: Parent #43; KEYMAP.md `Coding tools and language operations` and `Multiple providers`; req: coding/006-007, governance/001-002, input/007, testing/001-004. AGENT AUTHORITY: - Delivery authority: local-commit - Tracker authority: this issue may be commented and closed when acceptance passes; parent #43 may be commented/checklisted. - Handoff state: committed clean, tracker commented/closed. PARENT: #43 via explicit issue link and parent checklist. SCOPE: `Space l f`, `Space l F/w`, `Space l o`, `Space l a`, source-profile format-on-save policy, provider picker for ambiguous mutating operations, edit application, save integration, one-shot save-without-format path. BOUNDARIES: No runtime config files or hidden installers. Do not silently choose between multiple mutating providers when no source-profile default exists. Do not apply edits that target stale document versions. ACCEPTANCE: - Format current buffer applies provider edits safely and preserves cursor/undo/dirty semantics. - Format-on-save policy is visible in the rail/status and follows source-patched defaults. - A one-shot save-without-format path exists when format-on-save is enabled. - Organize imports and code actions show provider/source and affected scope before mutation. - Multiple providers trigger explicit selection unless a source-profile default applies. - Missing formatter/action provider, malformed edits, stale edits, overlapping edits, and file-write failures are reported without data loss. VERIFICATION: - `zig build test` - Fake-provider tests for format, no-op format, stale edits, overlapping edits, provider picker, format-on-save on/off, save-without-format, organize imports, code action apply/fail. - `zig build v1-smoke` BLOCKERS: none.
tmk241 added the sliceready-for-agentgoal labels 2026-06-21 09:12:14 +00:00
Author
Owner

Implemented and committed #54 as 616eea6 Add language format and code action edits.

What changed:

  • Added provider edit rows for format, organize-imports, and code-action mutations with provider/source identity.
  • Wired Space l f, Space l F/w, Space l o, and Space l a into the existing language rail.
  • Added explicit provider selection for ambiguous formatters/actions and default format provider selection.
  • Added format-on-save and one-shot save-without-format behavior; ambiguous/stale format-on-save does not silently save unformatted.
  • Added edit safety: stale version, invalid range, overlap rejection, undo integration, and source-labelled action panels.
  • Updated KEYMAP implementation status for this slice.

Verification:

  • zig build test
  • zig build
  • zig build v1-smoke
  • zig build run -- --help
  • zig build run -- src/main.zig
  • redgate list /opt/repositories/mim/REQUIREMENTS.md
  • redgate lint /opt/repositories/mim/REQUIREMENTS.md && redgate health /opt/repositories/mim/REQUIREMENTS.md

Tests added:

  • regular formatter application + undo
  • format-on-save, ambiguous save guard, one-shot save without format
  • provider picker selection for format
  • organize-imports and code-action panels/apply path
  • missing provider, stale edit, overlapping edit adversarial cases
  • provider edit row parse/source/scope coverage
Implemented and committed #54 as `616eea6 Add language format and code action edits`. What changed: - Added provider edit rows for format, organize-imports, and code-action mutations with provider/source identity. - Wired `Space l f`, `Space l F`/`w`, `Space l o`, and `Space l a` into the existing language rail. - Added explicit provider selection for ambiguous formatters/actions and default format provider selection. - Added format-on-save and one-shot save-without-format behavior; ambiguous/stale format-on-save does not silently save unformatted. - Added edit safety: stale version, invalid range, overlap rejection, undo integration, and source-labelled action panels. - Updated KEYMAP implementation status for this slice. Verification: - `zig build test` - `zig build` - `zig build v1-smoke` - `zig build run -- --help` - `zig build run -- src/main.zig` - `redgate list /opt/repositories/mim/REQUIREMENTS.md` - `redgate lint /opt/repositories/mim/REQUIREMENTS.md && redgate health /opt/repositories/mim/REQUIREMENTS.md` Tests added: - regular formatter application + undo - format-on-save, ambiguous save guard, one-shot save without format - provider picker selection for format - organize-imports and code-action panels/apply path - missing provider, stale edit, overlapping edit adversarial cases - provider edit row parse/source/scope coverage
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tmk241/mim#54