nvim-treesitter-textobjects icon indicating copy to clipboard operation
nvim-treesitter-textobjects copied to clipboard

race condition of unmap between detach() and b:undo_ftplugin in ftplugins

Open haolian9 opened this issue 2 years ago • 1 comments

Describe the bug when the race condition occurs, attach.make_detach() will throw "no such mapping" errors

To Reproduce Steps to reproduce the behavior:

  1. $ touch a.py
  2. config nvim: filetype plugin on
  3. config nvim-treesitter-textobjects
    require('nvim-treesitter.config').setup({
        textobjects = {
            move = {
                enabled = true,
                go_next_start = {
                    ["]m"] =  "@function.outer"
                }
            }
        }
    })`
    
  4. $ nvim a.py
  5. :set ft=sh

Expected behavior as nvim-treesitter-textobject already overwrited those mapping on attaching, no such mapping can be safetly ignored in my opinion on detaching.

Output of :checkhealth nvim_treesitter

Error detected while processing modelines[69]..FileType Autocommands for "*":
Error executing lua callback: ...r-textobjects/lua/nvim-treesitter/textobjects/attach.lua:61: E31: No such mapping
stack traceback:
        [C]: in function 'nvim_buf_del_keymap'
        ...r-textobjects/lua/nvim-treesitter/textobjects/attach.lua:61: in function 'detach'
        .../plugged/nvim-treesitter/lua/nvim-treesitter/configs.lua:490: in function 'detach_module'
        .../plugged/nvim-treesitter/lua/nvim-treesitter/configs.lua:499: in function 'reattach_module'
        .../plugged/nvim-treesitter/lua/nvim-treesitter/configs.lua:109: in function <.../plugged/nvim-treesitter/lua/nvim-treesitter/configs.lua:108>

Output of nvim --version

NVIM v0.8.0-dev-969-g7a9b59379
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az105-466

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

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

Run :checkhealth for more info

Additional context

$nvim/runtime/ftplugin/python.vim has b:undo_ftplugin='silent! nunmap <buffer> ]m'

haolian9 avatar Aug 29 '22 13:08 haolian9

same issue to #169, but it's closed and i want to put out more info about this, so i opened another issue

haolian9 avatar Aug 29 '22 13:08 haolian9

I am getting the same issue when I open files with ft=ruby

datanoise avatar Dec 15 '22 23:12 datanoise

This should be fixed by #368. Feel free to reopen if you still have problems.

kiyoon avatar Feb 07 '23 17:02 kiyoon