nvim-treesitter / playground

Treesitter playground integrated into Neovim
Apache License 2.0
897 stars 47 forks source link

`:TSPlaygroundToggle` stopped working #82

Closed hood closed 2 years ago

hood commented 2 years ago

As title implies, I'm getting :TSPlaygroundToggle is not an editor command when trying to invoke the command.

Following some excerpts of my init.vim file:

Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' }
Plug 'nvim-treesitter/nvim-treesitter-textobjects'
Plug 'JoosepAlviste/nvim-ts-context-commentstring'
Plug 'nvim-treesitter/playground', { 'on': 'TSPlaygroundToggle' }
  require'nvim-treesitter.configs'.setup{
    highlight = {
      enable = true,
      additional_vim_regex_highlighting = false,
    },
    textobjects = {
      select = {
        enable = true,
        lookahead = true,
        keymaps = {
          ['if'] = '@function.inner',
          ['af'] = '@function.outer',
          ['ic'] = '@class.inner',
          ['ac'] = '@class.outer',
        },
      },
      lsp_interop = {
        enable = true,
      },
    },
    textsubjects = {
      enable = true,
    },
    autopairs = {
      enable = true,
    },
    context_commentstring = {
      enable = true,
      config = {
        typescriptreact = {
          __default = '// %s',
          jsx_element = '{/* %s */}',
          jsx_fragment = '{/* %s */}',
          jsx_attribute = '// %s',
          comment = '// %s'
        },
      },
    },
    playground = {
      enable = true,
      disable = {},
    },
  }

I'm running nightly, so I'm at 0.8 at whatever the latest commit is.

Doing :TSConfigInfo shows that, for whatever reason, playground has no module_path associated:

-- ...
    incremental_selection = {
      disable = {},
      enable = false,
      keymaps = {
        init_selection = "gnn",
        node_decremental = "grm",
        node_incremental = "grn",
        scope_incremental = "grc"
      },
      module_path = "nvim-treesitter.incremental_selection"
    },
    indent = {
      disable = {},
      enable = false,
      module_path = "nvim-treesitter.indent"
    },
    playground = {
      disable = {},
      enable = true
    },
    textobjects = {
      lsp_interop = {
        border = "none",
        disable = {},
        enable = true,
        loaded = true,
        module_path = "nvim-treesitter.textobjects.lsp_interop",
        peek_definition_code = {}
      },
-- ...
clason commented 2 years ago

Seems like an issue with vim-plug lazy-loading; it works for me (with packer.nvim).

hood commented 2 years ago

Yep, you're right. Ty for solving my headaches!