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

TreeSitter Tag Auto Close #250

Merged
merged 6 commits into from
May 30, 2024

Conversation

thecoolwinter
Copy link
Collaborator

Description

Fixes a few bugs with #247 and converts it to use tree-sitter rather than a regex-based implementation. This should be faster on larger documents and makes it more robust to edge cases in tag regexes. This also handles newlines correctly, as the old PR caused the editor to no longer be able to delete newlines

Also fixes a small bug in the TreeSitterClient that caused every query to be dispatched to main asynchronously. This was the cause for a few visual oddities like flashing colors when changing themes. This also improves highlighting while scrolling fast as most highlights are processed synchronously.

  • Removes extensions on NewlineProcessingFilter
  • Cleans up TagFilter
    • Moves all newline processing to the one filter
    • Use tree-sitter for tag completion, supporting the following languages: HTML, JSX, TSX
  • Adds a few methods to TreeSitterClient for synchronously querying the tree sitter tree.
  • Adds a new TreeSitterClientExecutor class that the client uses to execute operations safely asynchronously and synchronously.
    • This is extremely useful for testing, as it allows the tests to force all operations to happen synchronously.
  • Adds a check to dispatchMain to see if the thread is already the main thread (meaning no async dispatch)

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

Screen.Recording.2024-05-29.at.7.11.15.PM.mov
Screen.Recording.2024-05-29.at.7.37.02.PM.mov

Copy link
Collaborator

@0xWDG 0xWDG left a comment

Choose a reason for hiding this comment

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

🔥

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.

Nice work! ❤️‍🔥

@thecoolwinter thecoolwinter merged commit cf85789 into CodeEditApp:main May 30, 2024
2 checks passed
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.

4 participants