nvim-telescope / telescope-smart-history.nvim

A history implementation that memorizes prompt input for a specific context
MIT License
141 stars 5 forks source link

sqlite database not initialized. #9

Closed madelaney closed 3 months ago

madelaney commented 3 months ago

While trying to set this plugin up, when I try to use telescope, I get the following:

E5108: Error executing lua: ...aney/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/db.lua:223: ...ey/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/stmt.lua:35: sqlite.lua: sql statement parse, , stmt: `select name from sqlite_master where name= ?`, err: `(`file is not a database`)`
stack traceback:
        [C]: in function 'error'
        ...aney/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/db.lua:223: in function 'run'
        ...ney/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/tbl.lua:63: in function 'tbl'
        ...history.nvim/lua/telescope/_extensions/smart_history.lua:42: in function 'init'
        ...im/lazy/telescope.nvim/lua/telescope/actions/history.lua:81: in function 'handler'
        ...nvim/lazy/telescope.nvim/lua/telescope/actions/state.lua:50: in function 'get_current_history'
        .../nvim/lazy/telescope.nvim/lua/telescope/actions/init.lua:80: in function <.../nvim/lazy/telescope.nvim/lua/telescope/actions/init.lua:78>
        ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:58: in function 'key_func'
        ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:293: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:292>

I'm using the config (via lazy)

{
  "nvim-telescope/telescope.nvim",
  dependencies = {
    'nvim-telescope/telescope-smart-history.nvim',
    "nvim-telescope/telescope-ui-select.nvim",
    "kkharji/sqlite.lua",
  },
  config = function(_, opts)
    require("telescope").setup({
      extensions = {
        wrap_results = true,
    history = {
          path = vim.fn.expand('~/.local/state/nvim/history.db'),
          limit = 100,
        },     
      },
    })
    require("telescope").load_extension("smart_history")
  end
}

Am I loading this wrong?

rawnly commented 3 months ago

same here

madelaney commented 3 months ago

turns out that I had the config in the wrong area.

the following works as expected:

{
  "nvim-telescope/telescope.nvim",
  dependencies = {
    'nvim-telescope/telescope-smart-history.nvim',
    "nvim-telescope/telescope-ui-select.nvim",
    "kkharji/sqlite.lua",
  },
  config = function(_, opts)
    require("telescope").setup({
      defaults = {
        history = {
          path = vim.fn.expand('~/.local/state/nvim/history.db'),
          limit = 100,
        },    
      },
      extensions = {
        wrap_results = true, 
      },
    })
    require("telescope").load_extension("smart_history")
  end
}