Comment.nvim icon indicating copy to clipboard operation
Comment.nvim copied to clipboard

BUG: fails silently in absence of LuaJIT

Open subnut opened this issue 1 year ago • 1 comments

EDIT: I just tried the exact same combination on the flatpak version (which has LuaJIT), and (unsurprisingly) it works.

Original issue follows -


None of the functions do anything. Literally. There's zero feedback. There is no error, nor is there any change being made in the buffer.

commentstring is set correctly. (i checked)

nvim -v

NVIM v0.9.5
Build type: RelWithDebInfo
Lua 5.1
Compilation: /usr/lib/ccache/bin/clang -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_VENDOR_BIT -I/usr/include/lua5.1 -I/usr/include -I/usr/include -I/builddir/neovim-0.9.5/build/src/nvim/auto -I/builddir/neovim-0.9.5/build/include -I/builddir/neovim-0.9.5/build/cmake.config -I/builddir/neovim-0.9.5/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Note the absence of LuaJIT.

minimal_init.lua

-- bootstrap packer
local ensure_packer = function()
  local fn = vim.fn
  local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
  if fn.empty(fn.glob(install_path)) > 0 then
    fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
    vim.cmd [[packadd packer.nvim]]
    return true
  end
  return false
end

local packer_bootstrap = ensure_packer()
return require('packer').startup(function(use)
  use 'wbthomason/packer.nvim'
  -- your plugins here
  use {
    'numToStr/Comment.nvim',
    config = function()
      require('Comment').setup()
    end
  }
  if packer_bootstrap then
    require('packer').sync()
  end
end)

subnut avatar Jan 31 '24 06:01 subnut

EDIT: See https://github.com/neovim/neovim/issues/27289

I've tracked it down to https://github.com/numToStr/Comment.nvim/blob/0236521ea582747b58869cb72f70ccfa967d2e89/lua/Comment/api.lua#L29

~If we replace U.catch with pcall or xpcall then everything works correctly.~

subnut avatar Feb 01 '24 14:02 subnut