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

perf(treesitter): bound has-ancestor? for highlighter #27783

Closed
wants to merge 1 commit into from

Commits on Mar 22, 2024

  1. perf(treesitter): bound has-ancestor? for highlighter

    Problem:
    `has-ancestor?` predicate can take long when the match is deep in the
    tree, e.g., long `else if` chain in C. This may slow down highlighting
    and thus redrawing significantly.
    
    Solution:
    Add option for limiting `has-ancestor?`'s search length, and use it for
    highlighter.
    The limit `15` is arbitrary, but seems to be good enough:
    * Existing use of `has-ancestor?` in highlight queries are quite local.
      For example in cpp, it searches for a call expression above a
      quantified identifier to highlight the function name.
    * Scrolling is reponsive enough in the long `else if` chain example.
    tomtomjhj committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    8195c1e View commit details
    Browse the repository at this point in the history