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

Joining a highlighted line with "J" breaks tree-sitter highlighter #1408

Open
2 tasks done
stephenprater opened this issue Apr 25, 2024 · 3 comments
Open
2 tasks done
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@stephenprater
Copy link

stephenprater commented Apr 25, 2024

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

NVIM v0.10.0-dev-3005+gaf8500af6-Homebrew

Neorg setup

  {
    'nvim-neorg/neorg',
    dependencies = { "luarocks.nvim" },
		ft = "norg",
    cond = function()
      return not os.getenv("SPIN")
    end,
    config = function()
      require('neorg').setup({
        load = {
          ["core.defaults"] = {},
          ["core.concealer"] = {
            config = {
              icons = {
                todo = {
                  undone = {
                    icon = " "
                  }
                }
              }
            }
          },
          ["core.export"] = {
            config = {
              export_dir = "~/log/"
            }
          },
          -- ["core.completion"] = {
          --   config = {
          --     engine = "nvim-cmp", name = "[Norg]"
          --   }
          -- },
          ["core.integrations.nvim-cmp"] = {},
          ["core.dirman"] = {
            config = {
              workspaces = {
                log = "~/log"
              },
              index = "prater.norg"
            }
          },
        }
      })

      vim.cmd([[autocmd FileType norg setlocal foldmethod=expr foldexpr=nvim_treesitter#foldexpr() tw=80 sw=2]])
      vim.cmd([[autocmd FileType norg Copilot disable]])

    end
  },

Actual behavior

When joining a highlighted line longer than the softwrap length, this error starts getting thrown. It is is then thrown on every keypress within a Neorg buffer until I restart Neovim.

┊  Error  10:08:02 msg_show.emsg  Noice last Error in decoration provider treesitter/highlighter.line:
Error executing lua: ...84/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:337: Invalid 'end_col': out of range
stack traceback:
  [C]: in function 'nvim_buf_set_extmark'
  ...84/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:337: in function 'fn'
  ...84/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:210: in function 'for_each_highlight_state'
  ...84/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:291: in function 'on_line_impl'
  ...84/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:367: in function <...84/share/nvim/runtime/lua/vim/treesi
  [C]: in function 'nvim_exec2'
  vim/_editor.lua: in function 'cmd'
  .../share/nvim/lazy/nvim-notify/lua/notify/service/init.lua:63: in function 'push'
  ...ocal/share/nvim/lazy/nvim-notify/lua/notify/instance.lua:77: in function <...ocal/share/nvim/lazy/nvim-notify/lua/
  ...e/nvim/lazy/noice.nvim/lua/noice/view/backend/notify.lua:169: in fun

Expected behavior

It should not do that.

Steps to reproduce

In an empty neorg file type a sentence longer than the softwrap like (80 cols) - if it autowraps, press "J" to join with the previous line. There is no error.

Break the line so that it is shorter than the softwrap length.

Press "*" at the beginning of the first line so that it highlights as a headline.
Press "J" to join with the next line.

The error will be thrown many times. Breaking the line again will not supress it. (It's possible it does, and I just don't have the patience to hit enter enough to times to get through all of the times it's thrown - but Neovim is effectively unusable until it's restarted.)

Potentially conflicting plugins

nvim-treesitter I guess?

Other information

No response

Help

Yes, but I don't know how to start. I would need guidance (check question below)

Implementation help

No response

@stephenprater stephenprater added the bug Issues related to bugs. Please attach a severity, a priority and category with this label. label Apr 25, 2024
@benlubas
Copy link
Contributor

bisected to 5202271

The commit that first loads the introspector module by default.

This bug has been so annoying recently :/

@benlubas
Copy link
Contributor

benlubas commented May 3, 2024

I'll add, disabling the todo-introspector is a sufficient temp fix for me. Here's the config for that:

["core.defaults"] = {
  config = {
    disable = { "core.todo-introspector" },
  },
},

Minimal Repro

File contents:

*a*
  1. Press o then backspace

@benlubas
Copy link
Contributor

benlubas commented May 10, 2024

@stephenprater can you still reproduce this on the latest nightly? I no longer see it. I lied. That simple repro doesn't work, but with more complex examples it still happens to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.
Projects
None yet
Development

No branches or pull requests

2 participants