Fix Sequencer event loop yielding behavior while preserving file timing fix#2
Closed
Copilot wants to merge 4 commits intocopilot/fix-d528ce6b-0887-4df3-9250-3d7622167e53from
Conversation
…yielding Co-authored-by: iBicha <[email protected]>
Copilot
AI
changed the title
[WIP] Address the comment in the PR you created: @iBicha/brighterscript/pull/1
Fix Sequencer event loop yielding behavior while preserving file timing fix
Sep 8, 2025
This reverts commit 03e98f9.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses the comment from @TwitchBronBron in #1 about maintaining the Sequencer's event loop yielding behavior while still fixing the original issue where files added during
beforeProgramValidatewere not being validated.Problem
The original fix in #1 replaced
sequencer.forEach(Object.values(this.files), ...)with a simpleforloop inside a.once()block:While this fixed the timing issue (capturing files after the
beforeProgramValidateevent), it broke the Sequencer's ability to yield to the event loop periodically. This is critical for the Language Server to be able to cancel long-running validations.Solution
This PR implements the factory function approach suggested in the review comment. I added a new
forEachFactory<T>(itemsFactory: () => T[], func: (item: T) => any)method to the Sequencer class that:beforeProgramValidate)The Program validation now uses:
Benefits
beforeProgramValidateare validatedTesting
Added comprehensive tests that verify:
All existing tests continue to pass, ensuring no regressions.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.