Prototype: Fast/slow path for incremental updates#572
Draft
thomasmarshall wants to merge 1 commit intomainfrom
Draft
Prototype: Fast/slow path for incremental updates#572thomasmarshall wants to merge 1 commit intomainfrom
thomasmarshall wants to merge 1 commit intomainfrom
Conversation
This commit adds a very basic incremental update mechanism, similar to what Sorbet does when it chooses between a fast and slow path. If the semantic shape of the document hasn't changed (i.e. no namespaces added or removed) then we don't need to create any new namespace declarations or perform any resolution. Otherwise, we'll do a full re-resolve. This doesn't do any form of invalidation, so there is no need to do any form of dependency tracking. It's beneficial primarily for simple LSP use-cases, where we want to avoid running expensive resolution when not necessary. For example, if the user is just typing code in the body of a method or adding a new method, there isn't any reason to re-run resolution. We are very likely missing some cases, but this is a prototype to demonstrate how the fast/slow path approach could work quite straightforwardly in Rubydex. It doesn't achieve what we want to eventually achieve (more granular invalidation and re-resolution) but it makes common case editing more bearable.
This was referenced Feb 6, 2026
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 adds a very basic incremental update mechanism, similar to what Sorbet does when it chooses between a fast and slow path. If the semantic shape of the document hasn't changed (i.e. no namespaces added or removed) then we don't need to create any new namespace declarations or perform any resolution. Otherwise, we'll do a full re-resolve.
This doesn't do any form of invalidation, so there is no need to do any form of dependency tracking. It's beneficial primarily for simple LSP use-cases, where we want to avoid running expensive resolution when not necessary. For example, if the user is just typing code in the body of a method or adding a new method, there isn't any reason to re-run resolution.
We are very likely missing some cases, but this is a prototype to demonstrate how the fast/slow path approach could work quite straightforwardly in Rubydex. It doesn't achieve what we want to eventually achieve (more granular invalidation and re-resolution) but it makes common case editing more bearable.