Skip to content

Conversation

@jlguo
Copy link

@jlguo jlguo commented Jan 19, 2026

Summary

  • Performance improvement: Convert synchronous Unix command loading to asynchronous
  • User experience: Eliminates UI blocking during PATH directory scanning
  • Responsiveness: Provides immediate fallback commands while full list loads

Changes

  • Replace readdirSync/statSync with async fs/promises operations
  • Use minimal fallback commands immediately to avoid UI blocking
  • Process PATH directories in batches with event loop yielding
  • Add robust error handling for individual file/directory failures
  • Preserve fallback commands on load failure instead of resetting

Benefits

  1. No more UI freezing when triggering command completion
  2. Immediate command suggestions via fallback commands
  3. Better error resilience - individual failures don't break entire process
  4. Improved responsiveness on systems with many PATH entries or slow filesystems

Technical Details

  • Before: Synchronous blocking operations that freeze UI during PATH scanning
  • After: Asynchronous non-blocking operations with progressive loading
  • Batch processing: 10 entries per batch with setImmediate yielding
  • Error handling: Individual file/directory errors caught and ignored

Test Plan

  • Trigger command completion (/ or @) - should see immediate suggestions
  • Verify UI remains responsive during command loading
  • Test on systems with many PATH directories
  • Verify fallback commands work when full loading fails

Coworker: @claude
Issue: #164

- Replace synchronous fs operations with async/await for better responsiveness
- Use minimal fallback commands immediately to avoid UI blocking
- Process PATH directories in batches with yields to event loop
- Add error handling for individual file/directory access failures
- Keep minimal fallback commands as fallback on load failure
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.

1 participant