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

[Bug]: sqlite error when description contains ' #472

Closed
1 task done
gbcreation opened this issue Sep 6, 2024 · 3 comments · Fixed by #473
Closed
1 task done

[Bug]: sqlite error when description contains ' #472

gbcreation opened this issue Sep 6, 2024 · 3 comments · Fixed by #473
Assignees
Labels
bug Something isn't working

Comments

@gbcreation
Copy link

Similar Issues

  • Before filing, I have searched for similar issues.

Neovim Version

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1723675123

Steps to Reproduce

Configure the nvim-surround plugin with Lazy.nvim like this:

return {
    'kylechui/nvim-surround',
    version = "*", -- Use for stability; omit to use `main` branch for the latest features
    keys = {
        { "<leader>'", '<Cmd>normal cs"\'<CR>', desc = 'Change surrounding " to \'' },
        { '<leader>"', '<Cmd>normal cs\'"<CR>', desc = 'Change surrounding \' to "' },
    },
    config = function ()
        require('nvim-surround').setup({ })
    end
}

The lazy_nvim extension and the frecency sorting enabled.

Expected Behavior

No error when selecting the keymaps in the Legendary list.

Actual Behavior

The following error occurs:

Error executing vim.schedule lua callback: ...erts/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/db.lua:223: ...ts/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/stmt.lua:35: sqlite.lua: sql stat
ement parse, , stmt: `select * from item_count where item_id = "'Change surrounding " to \''"`, err: `(`near "to": syntax error`)`

Minimal Configuration to Reproduce

local root = vim.fn.fnamemodify('./.repro', ':p')

-- set stdpaths to use .repro
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
  vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end

-- bootstrap lazy
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    '--single-branch',
    'https://github.com/folke/lazy.nvim.git',
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  -- do not remove the colorscheme! it makes testing nicer
  'folke/tokyonight.nvim',
  {
    'mrjones2014/legendary.nvim',
    dependencies = {
      -- place your `vim.ui.select()` handler plugin here
      -- for example:
      -- 'nvim-telescope/telescope.nvim',
      -- 'stevearc/dressing.nvim',
    },
  },
  -- add any other pugins here
}

require('lazy').setup(plugins, {
  root = root .. '/plugins',
})

require('dressing').setup()

require('legendary').setup({
  -- add any options here
})

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme! it makes testing nicer
vim.cmd([[colorscheme tokyonight]])

Output from :LegendaryLog

:LegendaryLog output (click to expand)

Additional Details and/or Screenshots

No response

@gbcreation gbcreation added the bug Something isn't working label Sep 6, 2024
@mrjones2014
Copy link
Owner

Can you test if #473 fixes your issue? Fixes it for me. Unfortunately since I had to change the ID generation algorithm, your existing frecency data will be invalid, so feel free to run :LegendaryFrecencyReset

@gbcreation
Copy link
Author

It fixes the issue, but every time I open Legendary, this error occurs:

Failed to sort items: "...nvim/lazy/legendary.nvim/lua/legendary/data/itemlist.lua:167: attempt to call field 'sql_escape' (a nil value)"

@gbcreation
Copy link
Author

Actually, this error occurred because I run the :LegendaryFrecencyReset command and did not restarted nvim. After restarting, all is good! 👍

Thank you very much for the fix.

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