nvim-treesitter / nvim-treesitter-context

Show code context
MIT License
2.52k stars 202 forks source link

TSContextEnable no longer works #524

Closed TheComet closed 2 hours ago

TheComet commented 5 hours ago

Description

My lazy config is:

return {
    "nvim-treesitter/nvim-treesitter-context",
    config = function()
        local context = require("treesitter-context")
        vim.keymap.set("n", "<leader>o", context.toggle)
    end
}

I am on master, commit 158377d

It works fine when starting neovim, but if I toggle it off and then on, it will no longer show any context for the rest of the session. I have tried calling context.enable and I have also tried manually running :TSContextEnable with no success.

Neovim version

NVIM v0.10.1 Build type: Release LuaJIT 2.1.1716656478

Expected behavior

I expect enable() to enable the context after it was disabled.

Actual behavior

enable() does not enable the context.

Minimal config

local plugins = {
  ts         = 'https://github.com/nvim-treesitter/nvim-treesitter',
  ts_context = 'https://github.com/nvim-treesitter/nvim-treesitter-context',
  -- ADD ADDITIONAL PLUGINS THAT ARE _NECESSARY_ TO REPRODUCE THE ISSUE
}

for name, url in pairs(plugins) do
  local install_path = '/tmp/nvim/site/'..name
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
  vim.o.runtimepath = install_path..','..vim.o.runtimepath
end

-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

Steps to reproduce

  1. nvim --clean -u minimal.lua
  2. ...
apollo1321 commented 3 hours ago

This PR has broken the intended behavior

https://github.com/nvim-treesitter/nvim-treesitter-context/pull/521

TheComet commented 53 minutes ago

Thanks for the quick response time! Appreciate it