Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow in nvim_replace_termcodes #441

Closed
2 tasks done
cameron1024 opened this issue Dec 4, 2024 · 1 comment · Fixed by Julian/lean.nvim#367
Closed
2 tasks done

Stack overflow in nvim_replace_termcodes #441

cameron1024 opened this issue Dec 4, 2024 · 1 comment · Fixed by Julian/lean.nvim#367
Labels
bug Something isn't working

Comments

@cameron1024
Copy link

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • I have read the README

Bug Description

I'm using lean.nvim with the Lean programming language, and geting an error when I press "enter", which is bound because I'm using keymap.preset = "enter".

This only triggers after typing \ in insert mode, which is used to insert special characters (Lean uses lots of mathematical symbols, so typing \alpha in insert mode followed by a space will insert a α in the buffer. I'm not 100% sure where this is coming from (perhaps the LSP) but doesn't seem to have anything to do with blink.

Once I've typed \ at all, the error persists whenever I press enter in insert mode to enter a newline. If I press enter to accept a suggestion, the error doesn't trigger. I can enter a newline with <C-o>o without issues. Typing \ in a non-lean buffer doesn't trigger this behaviour. The error seems to be contained to the buffer that had the \ typed in it - opening a new lean buffer and pressing enter correctly enters newlines. Running Lazy reload blink.cmp doesn't fix the buffer.

The exact error I get is:

E5108: Error executing lua: stack overflow
stack traceback:
        [C]: in function 'nvim_replace_termcodes'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:15: in function 'get_non_blink_mapping_for_key'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:25: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function 'callback'
        ...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fallback.lua:38: in function <...re/nvim/lazy/blink.cmp/lua/blink/cmp/keymap/fa
llback.lua:24>

I got this by triggering the error then copying from the popup in vim itself, but if there's a better way to grab these stack traces let me know and I'll be happy to capture it properly.

Thanks 😁

Relevant configuration

keymap = {
  preset = "enter",
}

neovim version

NVIM v0.11.0-dev Build type: Release LuaJIT 2.1.1713773202

blink.cmp version: branch, tag, or commit

85f318b

@Saghen
Copy link
Owner

Saghen commented Dec 17, 2024

This seems to have been fixed on lean.nvim's side. Eventually, we'll use vim.on_key #487 (after 0.11 releases) and this will no longer be an issue

@Saghen Saghen closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants