fix(core): record editor opens after a cancelled initial build - #244
Merged
Merged
Conversation
The text store waited on workspaceInitialized before it recorded an editor's open or closed the editor's documents. A cancelled initial build, which any write during startup causes, rejects that promise for good, so every later open was dropped without a log line and the editor's documents were never synced. - The store's open and close gates wait for the initial build to finish, whether it completed, was cancelled or failed - The workspace manager logs a failed initial build as an error, and a cancelled one or a gone connection at debug; ModelService.ready no longer logs it - workspaceInitialized still rejects when the build does not complete New public names - The protected HydraniumTextDocuments.initialBuildFinished Fixes #242
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.
When the initial workspace build was cancelled, the server stopped recording the editor's opens for the rest of its life, without a log line. The text store waited on
workspaceInitializedbefore it recorded an open, and a cancelled build, which any write during startup causes, rejects that promise for good. From then on every open was dropped, the editor's changes were ignored as stale, and nothing the server wrote was pushed to the editor, so a save from it could overwrite other clients' edits. Closing the editor's documents when its worker port closed hung on the same promise. This change has the store's two gates wait for the initial build to finish, whether it completed, was cancelled or failed, asModelService.readyalready did.A failed initial build is now logged once, by the workspace manager, where it happens: at
errorfor a real failure, atdebugfor a cancellation or a connection that went away at teardown. Every framework waiter discards the rejection, and the workspace manager's log does not depend onModelServicehaving been constructed, which in a host without a data server may never happen.What changes for adopters
HydraniumTextDocuments.initialBuildFinished()is a new protected method. The LSPdidOpenhandler andcloseLanguageClientDocuments()await it.HydraniumWorkspaceManager.initializeWorkspacelogs a failed setup before it rejectsworkspaceInitialized. An override that rejects the deferred itself, without callingsuper, logs its own failure.ModelService.readyno longer logs the rejection atdebug; it still never rejects.workspaceInitializedis unchanged: it still rejects when the initial build does not complete, so a caller relying on that keeps working.How I know it works
Against
main, both new tests fail for the reason they name:errorline for a failed build (expected one, received none).Fixes #242.