Skip to content
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

TreeSitterClient Highlight Responsiveness #267

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

thecoolwinter
Copy link
Collaborator

Description

  • Fixes an issue where tree sitter edits would call their completion handler while the lock on the executor was still held, causing the next (should be sync) operation to be forced async. This led to all highlights being executed asynchronously.
    • The fix is to do the operation on the tree-sitter state using the executor, and then call the completion once that value is held. The highlighter can then query for syntax highlights and the executor is freed to execute them synchronously.
    • This does not effect async operations, just an improvement for synchronous operations.

Related changes:

  • Removed a redundant piece of code and replaced it with an existing helper function.
  • Makes the invalidation of highlighted code explicit. Sometimes highlights can be missed by the layout manager so making the layout of the highlighted ranges explicit removes that possibility.

Related Issues

None.

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

Before

Screen.Recording.2024-10-12.at.2.43.56.PM.mov

After

Screen.Recording.2024-10-12.at.2.35.14.PM.mov

@thecoolwinter thecoolwinter added the bug Something isn't working label Oct 12, 2024
Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I didn't realize highlights were asynchronous, nice improvement!

@thecoolwinter thecoolwinter merged commit 4a1db47 into CodeEditApp:main Oct 13, 2024
2 checks passed
@thecoolwinter thecoolwinter deleted the fix/tree-sitter-sync branch October 13, 2024 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants