telescope-cheat.nvim icon indicating copy to clipboard operation
telescope-cheat.nvim copied to clipboard

Couldn't connect to sql database when running Telescope cheat fd

Open smjonas opened this issue 4 years ago • 10 comments

Hey, I wanted to try out this plugin but couldn't get it working (it should be installed correctly since require("telescope").extensions shows cheat as an installed extension).

Running Telescope cheat fd shows me this error message:

E5108: Error executing lua /home/jonas/.vim/plugged/sqlite.lua/lua/sqlite/defs.lua:667: sqlite  
.lua: couldn't connect to sql database, ERR:    

(with an empty error message)

Could you help me with this?

smjonas avatar Sep 26 '21 09:09 smjonas

🤔 interesting, are you on nightly? and does pervious commits work? try git checkout HEAD^ in telescope-cheat directory. Maybe recent changes to improve startuptime, factored this odd error

kkharji avatar Sep 26 '21 14:09 kkharji

I was on the stable 0.5 version, but I just tested it on the nightly from a few days ago and got the same problem.

The old version worked with git checkout HEAD^ . :smiley: . Once the database is created I can then switch to the latest version and I get no errors.

EDIT: it's not working since 888594e, the commit before that (7322a73) works

smjonas avatar Sep 26 '21 15:09 smjonas

The old version worked with git checkout HEAD^ .

To confirm https://github.com/nvim-telescope/telescope-cheat.nvim/commit/4a58b92fc70af622ddc115f843b0e552ca5bd6ea broke it?

EDIT: it's not working since 888594e, the commit before that (7322a73) works

Is it possible that you have an outdated sqlite.lua?

Thanks @jonasstr for investigating, I'm going to try to reproduced and switch to nightly later tonight.

kkharji avatar Sep 26 '21 16:09 kkharji

It was broken even one commit before 4a58b92 (888594e broke it). What I wrote about "it worked with git checkout HEAD^" was wrong.

I could reproduce it on 888594e after deleting the databases folder inside vim.fn.stdpath "data" .. "/databases", which is /home/jonas/.local/share/nvim for me.

I have the latest version of sqlite.lua (2bd7cda).

Thanks @jonasstr for investigating, I'm going to try to reproduced and switch to nightly later tonight.

Glad I can help :) Just to inform you, I could reproduce this on the stable version also.

smjonas avatar Sep 26 '21 18:09 smjonas

Once the database is created I can then switch to the latest version and I get no errors.

I encountered the same error. This workaround works for me.

younger-1 avatar Sep 30 '21 16:09 younger-1

Got the same error, with a fresh install. After creating the folder vim.fn.stdpath "data" .. "/databases" manually, it worked.

ghillb avatar Nov 28 '21 11:11 ghillb

Im having the same issue. Im on Nvim 0.6 and have all the plugins updated.

Got the same error, with a fresh install. After creating the folder vim.fn.stdpath "data" .. "/databases" manually, it worked.

That worked perfectly:) In case anyone is wondering for nvim you have to create the directory $HOME/.local/share/nvim/databases

jaime10a avatar Dec 14 '21 02:12 jaime10a

This bug has been open for a while. This seems like an easy fix.

pmatulis avatar Sep 10 '23 00:09 pmatulis

Just ran into this too. FWIW, it seems that this is the bit that should be making the directory: https://github.com/nvim-telescope/telescope-cheat.nvim/blob/93f4af8240819833ba9c81c0947ee9fc94c93490/lua/telescope/_extensions/cheat/db.lua#L72-L75

That is called by https://github.com/nvim-telescope/telescope-cheat.nvim/blob/93f4af8240819833ba9c81c0947ee9fc94c93490/lua/telescope/_extensions/cheat.lua#L85-L87

Any idea what needs to be done to actually fix this?

genebean avatar Jan 02 '24 19:01 genebean

FWIW, I added this to my init.lua before loading my plugins and everything works as expected, so I think the call to this same bit of code in the plugin isn't actually happening.

-- hack to deal with bug in telescope-cheat.nvim
-- https://github.com/nvim-telescope/telescope-cheat.nvim/issues/7
local cheat_dbdir = vim.fn.stdpath "data" .. "/databases"
if not vim.loop.fs_stat(cheat_dbdir) then
  vim.loop.fs_mkdir(cheat_dbdir, 493)
end

genebean avatar Jan 02 '24 21:01 genebean