RRethy/nvim-treesitter-endwise

Plugin stop working after the first execution in Ruby files

aliaksandrb opened this issue · 5 comments

Hi, long time endwise user here, poking the nvim alternatives. Thanks for the plugin!

Describe the bug
Plugin stop execution after the first successful completion.

To Reproduce
Minimal config:

{
    'nvim-treesitter/nvim-treesitter',
    build = ':TSUpdate',
    dependencies = { 'RRethy/nvim-treesitter-endwise' },
    config = function()
      require('nvim-treesitter.configs').setup({
        endwise = {
          enable = true,
        },
      })
    end
  }

:TSConfigInfo output

{
  auto_install = false,
  ensure_installed = {},
  ignore_install = {},
  modules = {
    endwise = {
      disable = {},
      enable = true,
      loaded = true,
      module_path = "nvim-treesitter.endwise"
    },
    highlight = {
      additional_vim_regex_highlighting = false,
      custom_captures = {},
      disable = {},
      enable = false,
      module_path = "nvim-treesitter.highlight"
    },
    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"
    }
  },
  sync_install = false
}
  1. Open new or an existing Ruby file, start a new class/module. The end part added after <CR> as expected.
  2. Define new method, nothing happens after <CR>
class A
  def test
    |
end

Expected behavior
It shoud continue working for all following input.

Additional context

$ nvim --version
NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Ventura-arm64.local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.8.3/share/nvim"

:checkhealth

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v18.15.0 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be           compatible with runtime ABI.

Installation of additional treesitter-syntax for Ruby doesn't help either.

I cannot reproduce this with your minimal config. The minimal config you shared also don't look like a minimal config, rather it looks like a config with what you found relevant. Making a true minimal config may help you narrow down the issue.

I can reopen the issue with a true minimal config that can be supplied to nvim -u NONE.

Your new issue template explicitly states to

(DO NOT INCLUDE PACKER IN A MINIMAL init.lua):

so I've skipped the package manager code. This is a full version:

local lazy = {
  lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim',
  opts = {},
}

function lazy.install()
  if not vim.loop.fs_stat(lazy.lazypath) then
    vim.fn.system({
      'git',
      'clone',
      '--filter=blob:none',
      'https://github.com/folke/lazy.nvim.git',
      '--branch=stable',
      lazy.lazypath,
    })
  end
end

function lazy.setup(plugins)
  vim.opt.rtp:prepend(lazy.lazypath)
  require('lazy').setup(plugins, lazy.opts)
end

lazy.install()

lazy.setup({
  {
    'nvim-treesitter/nvim-treesitter',
    build = ':TSUpdate',
    dependencies = { 'RRethy/nvim-treesitter-endwise' },
    config = function()
      require('nvim-treesitter.configs').setup({
        endwise = {
          enable = true,
        },
      })
    end
  }
})

I run it as

$ nvim --clean -u /tmp/init.lua 1.rb

Followed by :Lazy in inside nvim to ensure everything is installed.

Still not able to reproduce, maybe try a :checkhealth nvim-treesitter.

Okay, must be on my side then.