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

Crash from overwriting core string table #93

Open
Leolainen opened this issue Jun 6, 2024 · 0 comments
Open

Crash from overwriting core string table #93

Leolainen opened this issue Jun 6, 2024 · 0 comments

Comments

@Leolainen
Copy link

Hello! Thanks for an excellent plugin!

I've had problems with crashes when using absolute paths. Some debugging points to the string table being entirely overwritten in lua/snap/producer/ripgrep/general.lua. The string function imported from lua/snap/common/string.lua contains only a split function (and "aniseed/locals"). So string.format function ended up being nil, causing a crash.

Screenshot 2024-06-06 at 16 35 33

My problem is solved by changing a line in lua/snap/common/string.lua:

local _2amodule_name_2a = "snap.common.string"
local _2amodule_2a
do
    package.loaded[_2amodule_name_2a] = string <-- changed {} to string
    _2amodule_2a = package.loaded[_2amodule_name_2a]
end

This is my config that crashed:

snap.register.map({ "n" }, { "<Leader>sT" }, function()
                snap.run {
                    producer = snap.get 'producer.ripgrep.vimgrep'.args({
                        '--hidden',
                    }, vim.fn.systemlist('git rev-parse --show-toplevel')[1]),
                    select = snap.get 'select.vimgrep'.select,
                    multiselect = snap.get 'select.vimgrep'.multiselect,
                    views = { snap.get 'preview.vimgrep' },
                    steps = { {
                        consumer = snap.get 'consumer.fzf',
                        config = { prompt = "FZF>" }
                    } },
                }
            end)

This seem to have solved my issue, for now. But it's probably better if any contributors would look into it.

I'm not very experienced with Lua, and fennel even less so, nor have I found anyone else reporting the same issue so I can't tell if this is a real bug or just a "me" problem.
For context: I'm on a mac with Neovim 0.10.0 and using LunarVim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant