Skip to content

1.10 Implement the config service #11

Description

@goofmint

Part of Phase 1 — Core skeleton (tasks.md Task 1.10).

Summary

Implement configuration loading, layering, schema registry, and live reload.

Details

  • Tolerant JSONC parser (comments + trailing commas → JSON.parse), with line/column error positions surfaced via the status sink.
  • Layering: defaults (from contributes.configuration schemas + core defaults) ← user ~/.config/tecode/settings.json ← workspace .tecode/settings.json. tecode.config.get(key) reads the merged view.
  • Schema registry fed by contributes.configuration (types + defaults; validation is best-effort MVP).
  • fs.watch on both settings files and keybindings.json: on change re-parse, diff keys, fire onDidChangeConfiguration({ affectsConfiguration }), notify dependent services (hooks for theme/keymap; wired in later tasks).
  • Broken file → keep last good configuration, surface the parse error.
  • Path resolution behind a paths module (~/.config/tecode/ on POSIX, %APPDATA%\tecode\ on Windows).

Completion requirements

  • JSONC edge cases tested (line/block comments, trailing commas, strings containing //)
  • Layer merge tested: workspace overrides user overrides defaults, per key
  • Watch-triggered reload fires onDidChangeConfiguration with a correct affectsConfiguration predicate
  • Parse error keeps last-good config and reports position
  • bun test and lint pass

References

  • requirements.md: Req 9.1–9.4
  • design.md: §11, §17 (paths)

Dependencies

Blocked by: 1.2 (#3). Parallelizable with 1.3–1.9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions