Skip to content

fix: reload config changes without window restart - #130

Merged
hellodk merged 1 commit into
masterfrom
fix/config-watcher-reload
Aug 30, 2026
Merged

fix: reload config changes without window restart#130
hellodk merged 1 commit into
masterfrom
fix/config-watcher-reload

Conversation

@hellodk

@hellodk hellodk commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #129

Edits to ~/.champ/config.yaml (from a terminal or external tool) were not picked up until a VS Code window restart. The previous watcher relied on vscode.workspace.createFileSystemWatcher rooted at os.homedir() — out-of-workspace watching is unreliable on Linux, so external edits were frequently missed.

Changes

  • New src/config/config-watcher.ts — reliable, debounced watcher combining:
    • Native FileSystemWatcher fast path (in-VS-Code edits) → signalChanged()
    • An mtime poller fallback (platform-independent, catches terminal/external edits)
    • Both debounce into a single loadProvider() call
  • src/extension.ts rewritten watcher block: ConfigWatcher + native watcher feed one debounced reload path
  • test/unit/config/config-watcher.test.ts — 5 tests (baseline, debounced single reload, collapse rapid changes, no reload on unchanged, deleted-file reload)

Tests required

  • Baseline poll fires without invoking onChange
  • mtime change fires onChange exactly once (debounced)
  • Rapid changes collapse into a single reload
  • No reload when mtime unchanged
  • Deleted file triggers reload once

Gates: pnpm run check-types, pnpm vitest run (1751 pass), pnpm run lint (0 errors)

@hellodk
hellodk merged commit 7cacd60 into master Aug 30, 2026
4 of 6 checks passed
hellodk added a commit that referenced this pull request Aug 31, 2026
- config hot-reload without window restart — #129/#130
@hellodk
hellodk deleted the fix/config-watcher-reload branch August 31, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config ~/.champ/config.yaml edits don't reload until window restart

1 participant