Skip to content

bug: highlighting doesn't work with nvim-treesitter main branch #261

@iguanacucumber

Description

@iguanacucumber

Describe the bug

  • On the treesitter main branch (rewrite of treesitter, and now the default branch):
    when opening a markdown with a codeblock inside, it displays this warning:

[otter] No treesitter parser found for current buffer. Can't activate.
Code highlighting doesn't happen

  • On the treesitter master branch:
    It just works

To Reproduce
Use those init.lua and open a markdown file with a lua codeblock inside:

  • Treesitter master branch
vim.env.LAZY_STDPATH = ".repro-master"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
	spec = {
		{
			"nvim-treesitter/nvim-treesitter",
			build = ":TSUpdate",
      lazy = false,
			branch = "master",
			config = function()
				require("nvim-treesitter.configs").setup({
					ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
          auto_install = true,
          highlight = { enable = true }
				})
			end,
		},

		{
			"jmbuhr/otter.nvim",
			dependencies = "nvim-treesitter/nvim-treesitter",
			config = function()
				require("otter").activate({ "lua" }, false, false, nil)
			end,
		},
	},
})
  • Treesitter main branch
vim.env.LAZY_STDPATH = ".repro-main"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
	spec = {
		{
			"nvim-treesitter/nvim-treesitter",
			build = ":TSUpdate",
      lazy = false,
			branch = "main",
			config = function()
				require("nvim-treesitter").setup()
				require("nvim-treesitter").install({
          "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline"
				})
			end,
		},

		{
			"jmbuhr/otter.nvim",
			dependencies = "nvim-treesitter/nvim-treesitter",
			config = function()
				require("otter").activate({ "lua" }, false, false, nil)
			end,
		},
	},
})

System

  • OS: Arch linux
  • Nvim version: Stable and nightly
  • otter.nvim version: c44d645

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions