• 
      

    Vendor interesting_lines.scm queries from nvim-treesitter-textobjects.

    Review Request #15255 — Created Aug. 27, 2026 and updated

    Information

    Review Board
    release-9.x

    Reviewers

    This change vendors textobjects.scm files from the
    nvim-treesitter-textobjects repository (Apache-2.0, same org as
    nvim-treesitter) as interesting_lines.scm, filtered down to the patterns
    capturing @function.outer and @class.outer. These will drive
    tree-sitter-based interesting lines detection in the diff viewer,
    covering 49 languages.

    update-queries.py now takes a second argument pointing to a
    nvim-treesitter-textobjects checkout, and processes each vendored file
    from a per-file source spec (repository, queries path, source URL,
    input/output filenames, and an optional transform). The existing
    inherits resolution, commit-history fallback, and grammar validation
    apply to both repositories, with transforms applied before validation so
    we validate what we ship.

    The textobjects transform (query_utils.filter_query_patterns) keeps
    only patterns using the captures we want, drops the comments attached to
    dropped patterns, dedupes patterns duplicated by inherits resolution
    (javascript pulls ecma in twice), and drops per-language wrapper
    patterns that would yield the wrong header line (a decorated Python
    definition would report the first decorator line; the plain
    function_definition pattern already yields the def line).

    Each vendored file is recorded in queries.lock with the textobjects
    repository URL and commit. Upstream has no usable function or class
    captures for some languages (such as perl), which simply do not get an
    interesting_lines.scm and will fall back to the regex scanner.

    The actual vendored files are part of my commit but I've excluded them
    from the posted change here.

    • Ran update-queries.py against fresh checkouts of both repositories,
      with nvim-treesitter pinned to the queries.lock commit. The existing
      highlights.scm and injections.scm files regenerated byte-identical.
    • Added a test compiling every vendored interesting_lines.scm against
      its grammar, plus unit tests for filter_query_patterns().
    • Spot-checked the vendored output for Python, JavaScript, TypeScript,
      C, and C++.
    • Ran unit tests (reviewboard/treesitter).
    Summary ID
    Vendor interesting_lines.scm queries from nvim-treesitter-textobjects.
    This change vendors textobjects.scm files from the nvim-treesitter-textobjects repository (Apache-2.0, same org as nvim-treesitter) as interesting_lines.scm, filtered down to the patterns capturing @function.outer and @class.outer. These will drive tree-sitter-based interesting lines detection in the diff viewer, covering 49 languages. update-queries.py now takes a second argument pointing to a nvim-treesitter-textobjects checkout, and processes each vendored file from a per-file source spec (repository, queries path, source URL, input/output filenames, and an optional transform). The existing inherits resolution, commit-history fallback, and grammar validation apply to both repositories, with transforms applied before validation so we validate what we ship. The textobjects transform (`query_utils.filter_query_patterns`) keeps only patterns using the captures we want, drops the comments attached to dropped patterns, dedupes patterns duplicated by inherits resolution (javascript pulls ecma in twice), and drops per-language wrapper patterns that would yield the wrong header line (a decorated Python definition would report the first decorator line; the plain function_definition pattern already yields the def line). Each vendored file is recorded in queries.lock with the textobjects repository URL and commit. Upstream has no usable function or class captures for some languages (such as perl), which simply do not get an interesting_lines.scm and will fall back to the regex scanner. Testing Done: - Ran update-queries.py against fresh checkouts of both repositories, with nvim-treesitter pinned to the queries.lock commit. The existing highlights.scm and injections.scm files regenerated byte-identical. - Added a test compiling every vendored interesting_lines.scm against its grammar, plus unit tests for filter_query_patterns(). - Spot-checked the vendored output for Python, JavaScript, TypeScript, C, and C++. - Ran unit tests (reviewboard/treesitter).
    uvzxmtwkyutolnknputnxksxpxmxnzzo
    Checks run (2 succeeded)
    flake8 passed.
    JSHint passed.