Skip to content

treesitter/highlighter.lua:145: end_col value outside range #12861

Closed
@entombedvirus

Description

@entombedvirus
  • nvim --version: NVIM v0.5.0-nightly-4-gbedab7e87
  • vim -u DEFAULTS (version: ) behaves differently? N/A
  • Operating system/version: ubuntu-16.04
  • Terminal name/version: kitty -> ssh -> tmux
  • $TERM: tmux

Steps to reproduce using nvim -u NORC

  1. setup treesitter for go and enable TS syntax highlighting for go
  2. open up the contents of https://gist.github.com/entombedvirus/19038b42b09439b227b0c6e75d977f5c in a .go file
  3. jump to line 29, insert line above using O
  4. type x : as if to type x := 1

Actual behaviour

As soon that : is pressed, the message area should now Error executing lua callback: ...7e/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:145: end_col value outside range while still in INSERT mode.

NOTE: The error doesn't repro at different files or even in different lines in the same file. But I have 100% repro on that specific line on that specific file.

I added some extra logging to treesitter/highlighter.lua:

      if hl then
        local status, err = pcall(function()
            a.nvim_buf_set_extmark(self.buf, ts_hs_ns, start_row, start_col, {
                end_col = end_col,
                end_line = end_row,
                hl_group = hl
            })
        end)
        if not status then
            print(vim.inspect{
                status = status,
                err = err,
                start_row = start_row,
                start_col = start_col,
                end_col = end_col,
                end_line = end_row,
                hl_group = hl
            })
        end
      end

and got the following output:

{                                                                                                                                                                                         
  end_col = 24,                                                                                                                                                                           
  end_line = 30,                                                                                                                                                                          
  err = "...7e/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:146: end_col value outside range",                                                                                   
  hl_group = 310,                                                                                                                                                                         
  start_col = 31,                                                                                                                                                                         
  start_row = 27,                                                                                                                                                                         
  status = false                                                                                                                                                                          
}                                                                                                                                                                                         
{                                                                                                                                                                                         
  end_col = 4,                                                                                                                                                                            
  end_line = 30,                                                                                                                                                                          
  err = "...7e/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:146: end_col value outside range",                                                                                   
  hl_group = 338,                                                                                                                                                                         
  start_col = 0,                                                                                                                                                                          
  start_row = 30,                                                                                                                                                                         
  status = false                                                                                                                                                                          
}                                                                                                                                                                                         
{                                                                                                                                                                                         
  end_col = 6,                                                                                                                                                                            
  end_line = 30,                                                                                                                                                                          
  err = "...7e/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:146: col value outside range",                                                                                       
  hl_group = 312,                                                                                                                                                                         
  start_col = 5,                                                                                                                                                                          
  start_row = 30,                                                                                                                                                                         
  status = false                                                                                                                                                                          
}                                                                                                                                                                                         
{                                                                                                                                                                                         
  end_col = 7,                                                                                                                                                                            
  end_line = 30,                                                                                                                                                                          
  err = "...7e/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:146: col value outside range",                                                                                       
  hl_group = 345,                                                                                                                                                                         
  start_col = 6,                                                                                                                                                                          
  start_row = 30,                                                                                                                                                                         
  status = false                                                                                                                                                                          
}   

Expected behaviour

no error messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugissues reporting wrong behaviortreesitter

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions