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

fix(tree-sitter): remove slow html highlight patterns #4195

Conversation

TomJGooding
Copy link
Contributor

Fixes #4152 by removing all ((element (start_tag (tag_name) @_tag) patterns from the html.scm highlights query file.

These patterns will cause a segfault on relatively large documents and even just one seems a massively expensive operation from some quick testing.

All tests pass after removing these and I couldn't see they were actually used anywhere in syntax highlighting, but please correct me if I'm wrong!

Please review the following checklist.

  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

Fixes Textualize#4152 by removing all
`((element (start_tag (tag_name) @_tag)` patterns from the `html.scm`
highlights query file.

These patterns will cause a segfault on relatively large documents
and even just one seems a massively expensive operation from some
quick testing.

All tests pass after removing these and I couldn't see they were
actually used anywhere in syntax highlighting, but please correct me
if I'm wrong!
@TomJGooding TomJGooding marked this pull request as ready for review February 20, 2024 21:15
Copy link
Member

@darrenburns darrenburns left a comment

Choose a reason for hiding this comment

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

Thanks!

@darrenburns darrenburns merged commit 65c4cce into Textualize:main Feb 22, 2024
20 checks passed
@willmcgugan
Copy link
Collaborator

Much appreciated, @TomJGooding !

@juftin
Copy link
Contributor

juftin commented Feb 22, 2024

Very nice work on this, thank you!

@TomJGooding
Copy link
Contributor Author

No problem, glad I can contribute occasionally rather than just being a nuisance!

@TomJGooding TomJGooding deleted the fix-tree-sitter-remove-slow-html-highlight-patterns branch February 27, 2024 18:44
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.

TextArea crashes Python on html language
4 participants