Skip to content

WIP Add manual watch mode for restart control#850

Open
xiantang wants to merge 1 commit intomasterfrom
feature/manual-restart-shortcut
Open

WIP Add manual watch mode for restart control#850
xiantang wants to merge 1 commit intomasterfrom
feature/manual-restart-shortcut

Conversation

@xiantang
Copy link
Copy Markdown
Collaborator

@xiantang xiantang commented Jan 11, 2026

close #804
Add watch_mode configuration option ('auto' or 'manual') to allow users to control when Air restarts their application. In manual mode, the app only restarts when the user presses 'r', ignoring file changes. This is useful for apps with slow startup times (e.g., database connections).

Changes:

  • Add watch_mode field to build config (default: 'auto')
  • Add keyboard listener in main.go to detect 'r' key press
  • Add manualRestartCh channel to Engine for triggering restarts
  • Ignore file change events when in manual mode
  • Add tests for watch_mode configuration
  • Update air_example.toml with watch_mode documentation

Add watch_mode configuration option ('auto' or 'manual') to allow users
to control when Air restarts their application. In manual mode, the app
only restarts when the user presses 'r', ignoring file changes. This is
useful for apps with slow startup times (e.g., database connections).

Changes:
- Add watch_mode field to build config (default: 'auto')
- Add keyboard listener in main.go to detect 'r' key press
- Add manualRestartCh channel to Engine for triggering restarts
- Ignore file change events when in manual mode
- Add tests for watch_mode configuration
- Update air_example.toml with watch_mode documentation
@xiantang xiantang changed the title Add manual watch mode for restart control WIP Add manual watch mode for restart control Jan 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 11, 2026

Codecov Report

❌ Patch coverage is 39.47368% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
main.go 0.00% 14 Missing ⚠️
runner/engine.go 60.86% 8 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
runner/config.go 74.90% <100.00%> (+0.09%) ⬆️
runner/engine.go 59.39% <60.86%> (-1.10%) ⬇️
main.go 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

[New Feature] It supports custom keyboard shortcuts for restarting, such as using Ctrl+R, instead of restarting immediately when files are modified.

1 participant