PuzzleScript icon indicating copy to clipboard operation
PuzzleScript copied to clipboard

Syntax highlighting can sometimes skip regions in large projects

Open Auroriax opened this issue 1 year ago • 3 comments

If you open a large PuzzleScript project (~1000 lines or more) in the editor, then if you scroll quickly (e.g. by dragging the scroll bar), then you can run into cases where the syntax highlighting does not work correctly for a region of code. This can also cause you to be unable to do some things, like Ctrl+Clicking levels.

I originally noted this on my PS fork, as projects there usually cover more lines than a normal PuzzleScript project. However, this can be reproduced in the PuzzleScript editor as well.

Screenshot_10 108115055-e2a98600-7099-11eb-8a12-a2feadd70e87

Auroriax avatar Dec 05 '22 19:12 Auroriax

Thanks for the report. Any console errors or the like when this happens?

Thinking aloud to myself - I guess the best possibility here is to try upgrade the codemirror version (but not to the super new one that would need a whole rewrite because it has a different parsing system). I need to be careful because I've made some minor under-the-hood changes to codemirror.js directly, but hmm!

increpare avatar Dec 06 '22 04:12 increpare

Sadly, there don't seem to be any errors reported to the console when this happens, in both Chrome and Firefox. Chrome seems to report a couple of violations:

[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.ch40mestatus.qjz9zk/feature/5745543795965952
S.on @ codemirror.js:6705
(anonymous) @ codemirror.js:2345
S @ codemirror.js:97
S @ codemirror.js:62
S.fromTextArea @ codemirror.js:4679
(anonymous) @ editor.js:82
[Violation] Forced reflow while executing JavaScript took 59ms
rng.js:20 [Violation] 'setTimeout' handler took 93ms
rng.js:20 [Violation] 'setTimeout' handler took 101ms
rng.js:20 [Violation] 'setTimeout' handler took 113ms

So nothing super interesting, it seems!

Auroriax avatar Dec 08 '22 18:12 Auroriax

Ok timeouts, interesting! That's at least a well-defined behavioural issue. On my end working on speeding up the parser might help with it it (though it's already reasonably optimized). But it's a general enough there are probably other ways...

Am Do., 8. Dez. 2022 um 19:35 Uhr schrieb Tom H. @.***>:

Sadly, there don't seem to be any errors reported to the console when this happens, in both Chrome and Firefox. Chrome seems to report a couple of violations:

[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.ch40mestatus.qjz9zk/feature/5745543795965952 S.on @ codemirror.js:6705 (anonymous) @ codemirror.js:2345 S @ codemirror.js:97 S @ codemirror.js:62 S.fromTextArea @ codemirror.js:4679 (anonymous) @ editor.js:82 [Violation] Forced reflow while executing JavaScript took 59ms rng.js:20 [Violation] 'setTimeout' handler took 93ms rng.js:20 [Violation] 'setTimeout' handler took 101ms rng.js:20 [Violation] 'setTimeout' handler took 113ms

So nothing super interesting, it seems!

— Reply to this email directly, view it on GitHub https://github.com/increpare/PuzzleScript/issues/947#issuecomment-1343168746, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADRVYAU5DBOC5U2QQMEL6TWMITA3ANCNFSM6AAAAAASUTZI2Y . You are receiving this because you commented.Message ID: @.***>

increpare avatar Dec 09 '22 07:12 increpare