Repository navigation
Conversation
This branch has not been deployed
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.
Fixes #255
What changed
TestAppearanceRestylesInPlacereads a demo, switches it to dark and compares it with a fresh dark build. Four demos do part of their work on goroutines of their own, whichFastForwardandSettledo not wait for, so that work could land between the reads or before one build's read and after the other's:lspAsk), replacing "No problems" with the problems list; this is the failure the issue reports. The editor's own highlighter also lexes on a goroutine (base/editor/editor.go), which showed up under load as a differing span on the sample's first line.formula.Viewwhose renderer's font has not loaded yet loads it throughcore.NewResourceand draws nothing (an em-square placeholder canvas with no ops) until then. The light build is the process's first, so a formula could still be blank after the switch while the fresh dark build, with the font loaded, drew it. The document's Go block is also lexed on a goroutine the first time (base/textview/highlight).base/diff/view.go), so either build could be read before its colors arrived. It failed once in the 50-run loop after the first two fixes.The test's
settlenow waits in real time, asTestEditorandTestTextViewFormulasalready do, for that work to be done in both builds: the Editor's problems and colored code, every canvas in the TextView's document drawing and its Go block colored, and the DiffView's code colored. A smalllexedhelper checks that a lexer split the matched lines into spans. The demos stay as they are: their servers and lexers run off the engine's goroutine on purpose.Verification
go test -count=50 -run 'TestAppearanceRestylesInPlace$' ./examples/gallery:-count=50reuses one process, so the font and the highlighter's cache are cold only in its first run. The first-build failures were reproduced by running the compiled test binary once per process, 8 at a time:-run 'TestAppearanceRestylesInPlace$/^TextView$', 60 processes: 18 failed before (the blank formula canvas), 0 after-run 'TestAppearanceRestylesInPlace$/^Editor$', 60 processes: 28 failed before, 0 after-run 'TestAppearanceRestylesInPlace$/^DiffView$', 60 processes: 4 failed with the first two fixes, before the DiffView waitgo tool nsgo checkpasses.go tool nsgo test ./examples/gallery: 93 passed, 11 skipped, andTestTerminalfailed (the shell's title never arrived within 10 s); it fails the same way on this machine with main's test binary, and this change does not touch it.Screenshots: none