Skip to content

Smarter Default Highlight Provider Management #310

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

Merged

Conversation

thecoolwinter
Copy link
Collaborator

Description

Updates the highlight provider parameter to correctly reflect its documentation, and use a smarter method for keeping around the default highlighter. This fixes an issue where the default highlight provider was re-initialized on every view update (keyboard navigation, keystrokes, etc.).

Now, highlight providers have two states: nil or Array. If CESE sees a nil argument, it creates and keeps around a TreeSitterClient like the documentation says. This client is kept as a variable on the view's coordinator so it isn't re-initialized between view updates.

This also allows highlighting to be disabled by passing an empty array for the highlight providers parameter, causing CESE to not make any default providers.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

N/A

@thecoolwinter thecoolwinter marked this pull request as ready for review April 21, 2025 15:54
@thecoolwinter thecoolwinter changed the title Smarter Highlight Provider Defaults Management Smarter Highlight Provider Management Apr 21, 2025
@thecoolwinter thecoolwinter changed the title Smarter Highlight Provider Management Smarter Default Highlight Provider Management Apr 21, 2025
austincondiff
austincondiff previously approved these changes Apr 21, 2025
@thecoolwinter thecoolwinter merged commit bb2cbf5 into CodeEditApp:main Apr 21, 2025
2 checks passed
@thecoolwinter thecoolwinter deleted the fix/highlight-provider-defaults branch April 21, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐞 Broken example 🐞 Flickering on cursor move and text editing
2 participants