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

fix: error message when using nvim-treesitter 'main' branch #198

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

markmacode
Copy link
Contributor

I am currently using the main branch for nvim-treesitter which is the development branch for v1.0

nvim-treesitter/nvim-treesitter#4767 (comment)

create a new main branch (targeting Neovim nightly only) for the new slimmed down installation functionality

This is causing nvim-ts-autotag to output an error, it tries to setup using the deprecated configs module, the main branch on TS has this removed. This error shows every time in the command line when opening Neovim.

The change on this PR fixes that error by inferring that we are using the main branch of TS. I tested this change on the latest version v0.9.2 of TS too, so it wont break current configs of users not using the main branch.

Error (without full stack trace)

Failed to source `.../plugin/nvim-ts-autotag.lua`
.../plugin/nvim-ts-autotag.lua: Vim(source):E5113: Error while calling lua chunk:
.../lua/nvim-ts-autotag.lua:12: attempt to call field 'define_modules' (a nil value)

Lazy.nvim config to reproduce

return {
  {
    "nvim-treesitter/nvim-treesitter",
    lazy = false,
    branch = "main",
    build = ":TSUpdate",
    config = function()
      require("nvim-treesitter").setup({
        ensure_install = { "core", "stable" },
      })
    end,
  },

  {
    "windwp/nvim-ts-autotag",
    dependencies = { "nvim-treesitter/nvim-treesitter" },
    config = function()
      require("nvim-ts-autotag").setup()
    end,
  },
}

@markmacode markmacode changed the title Stop error message when using nvim-treesitter 'main' branch fix: error message when using nvim-treesitter 'main' branch Jun 21, 2024
@PriceHiller
Copy link
Collaborator

Good catch! Thanks for the PR!

LGTM 🙂

@PriceHiller PriceHiller merged commit ddfccbf into windwp:main Jun 21, 2024
2 checks passed
@markmacode markmacode deleted the patch-1 branch June 21, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants