-
Notifications
You must be signed in to change notification settings - Fork 93
🐞 Flickering on cursor move and text editing #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same issue, I'm testing the example and it is flickering. Looks like it's trying to set highlight provider non-stop Also the example is completely broken, as it always use plaintext and not support dark theme (I barely see the gutter in dark theme).
|
I have personally not experienced this as of recent. @thecoolwinter has this been fixed recently? |
I don't think this has been fixed. Iirc 10.0 introduced a new api that diffs highlight providers. It sounds like that's accidental resetting the default tree sitter highlighter when text changes. As a temporary workaround, use a state variable to make a TreeSitterClient and pass it to the editor. That'll keep it around while typing. @State var treeSitterClient = TreeSitterClient
//...
CodeEditSourceEditor(
//...
highlightProviders: [treeSitterClient],
//...
) |
I've got a fix for this, my hunch was correct that there was some mismanagement of the default tree sitter highlight provider. I've opened a PR to make CESE correctly detect when the default highlight provider is wanted, and to keep around the tree-sitter provider between view updates. |
Description
Since 0.10.0 the syntax highlighting flickers on and off for a split second for any action performed inside the view, meaning:
This was not the case with the previous version of
CodeEditSourceEditor
(0.9x)To Reproduce
CodeEditSourceEditor
instance where text is handled by a@Obsersvable
viewmodel and start to edit textExpected Behavior
The syntax highlighting should not flicker.
Version Information
CodeEditSourceEditor: [e.g. 0.10.0]
macOS: 14.7 (23H124)
Xcode: Version 16.2 (16C5032a)
Additional Context
No response
Screenshots
See video:
Screen.Recording.2025-02-05.at.08.53.45.mov
The text was updated successfully, but these errors were encountered: