Repository: neovim/neovim
File: runtime/lua/vim/treesitter/highlighter.lua (Lua)

Code before:

        local spell, spell_pri_offset = get_spell(capture_name)

        -- The "priority" attribute can be set at the pattern level or on a particular capture
        local priority = (
          tonumber(metadata.priority or metadata[capture] and metadata[capture].priority)
          or vim.hl.priorities.treesitter
        ) + spell_pri_offset

        -- The "conceal" attribute can be set at the pattern level or on a particular capture
        local conceal = metadata.conceal or metadata[capture] and metadata[capture].conceal

        local url = get_url(match, buf, capture, metadata)

        if not on_conceal and (not on_spell or spell ~= nil) then
          local opts = {
            end_line = end_row,
            end_col = end_col,
            hl_group = hl,
            ephemeral = true,
            priority = priority,
            conceal = conceal,
            spell = spell,
            url = url,
          }
          local mark = { begin_line = start_row, begin_col = start_col, opts = opts }
          add_mark(mark, buf, line, next_marks)
        end

        if
          (metadata.conceal_lines or metadata[capture] and metadata[capture].conceal_lines)
          and #api.nvim_buf_get_extmarks(buf, ns, { start_row, 0 }, { start_row, 0 }, {}) == 0
        then
          api.nvim_buf_set_extmark(buf, ns, start_row, 0, {
            end_line = end_row,
            conceal_lines = '',
          })
        end
      end

      if start_row > line then
        state.next_row = start_row
      end
    end

    state.prev_marks = next_marks
  end)
end

---@private
---@param _win integer

Review comment (suggestion):
start/end are the normal convention in the codebase

```suggestion
          local mark = { start_line = start_row, start_col = start_col, opts = opts }
```

Code after:
      state.iter =
        state.highlighter_query:query():iter_captures(root_node, self.bufnr, line, root_end_row + 1)
    end

    local captures = state.highlighter_query:query().captures

    while line >= state.next_row do
      local capture, node, metadata, match = state.iter(line)

      local outer_range = { root_end_row + 1, 0, root_end_row + 1, 0 }
      if node then
        outer_range = vim.treesitter.get_range(node, buf, metadata and metadata[capture])
      end
      local outer_range_start_row = outer_range[1]

      for _, range in ipairs(tree_region) do
        local intersection = Range.intersection(range, outer_range)
        if intersection then
          local start_row, start_col, end_row, end_col = Range.unpack4(intersection)

          if capture then
            local hl = state.highlighter_query:get_hl_from_capture(capture)

            local capture_name = captures[capture]

            local spell, spell_pri_offset = get_spell(capture_name)

            -- The "priority" attribute can be set at the pattern level or on a particular capture
            local priority = (
              tonumber(metadata.priority or metadata[capture] and metadata[capture].priority)
              or vim.hl.priorities.treesitter
            ) + spell_pri_offset

            -- The "conceal" attribute can be set at the pattern level or on a particular capture
            local conceal = metadata.conceal or metadata[capture] and metadata[capture].conceal

            local url = get_url(match, buf, capture, metadata)

            if hl and end_row >= line and not on_conceal and (not on_spell or spell ~= nil) then
              local opts = {
                end_line = end_row,
                end_col = end_col,
                hl_group = hl,
                ephemeral = true,
                priority = priority,
                conceal = conceal,
                spell = spell,
                url = url,
              }
              local mark = { start_line = start_row, start_col = start_col, opts = opts }
              add_mark(mark, buf, line, next_marks)