MattiasMTS / cmp-dbee

Autocompletion for nvim-dbee
MIT License
49 stars 9 forks source link

Installing this plugin causes dbee-call-log to stop working #13

Closed slarse closed 7 months ago

slarse commented 7 months ago

Hello!

I found your plugin and decided to give it a li'l go, and it appears as if it breaks the dbee-call-log in the bottom left of the dbee UI. If I have this plugin installed, the dbee-call-log window is simply empty. As soon as I remove it, the call log shows up again with all calls intact, including the ones I made when cmp-dbee was installed.

I have zero experience of Lua so debugging this is somewhat beyond me at the moment. It may very well be something wrong with my setup as well as my Neovim config suffers from a good amount of "I have no idea of how any of this works".

Here's the commit that breaks it all for me: https://github.com/slarse/config/commit/740623a36bfe72364500f5ddf0bd1ffda8530d83

Reverting that causes the call log to show up again. Happy to run any diagnostics command you might need to figure this out.

MattiasMTS commented 7 months ago

hi @slarse thanks for opening the issue!! 🌟 We'll solve this for sure! This plugin is essentially using the "api" part of dbee (see here for example https://github.com/kndndrj/nvim-dbee/blob/master/lua/dbee/api/core.lua).

Can you check in /tmp/dbee-calllog.json before and after enabling the cmp-dbee plugin? 😄

It might be related on the event listener (https://github.com/kndndrj/nvim-dbee/blob/master/lua/dbee/api/core.lua#L18-L20) but not sure..

slarse commented 7 months ago

Hi @MattiasMTS,

I can't see anything odd about /tmp/dbee-calllog.json before or after. It looks fine. With cmp-dbee installed and enabled, calls are still written as they should to the log but only show up in the UI after cmp-dbee has been disabled.

I should mention that I'm not using the v0.1.3 release of Dbee as it can't be installed for me (and several others) due to https://github.com/kndndrj/nvim-dbee/issues/72, so I'm using this branch of my own fork instead.

MattiasMTS commented 7 months ago

So, the /tmp/dbee-calllog.json is persisting the logs before and after you enable cmp-dbee? Then it is a matter of the UI not showing it?

I don't see this issue, tho' I'm using a developer version of nvim-dbee.

Could you provide me with what kind of database you're using to try this out on? So I can try and reproduce the error 😋

slarse commented 7 months ago

Yes, exactly, as far as I can tell the calls are being written correctly to the call log regardless of if cmp-dbee is enabled or not. They simply don't show up in the UI when it's enabled.

Sure, I use Postgres. Here's the exact setup I've tried this with:

# docker command to run a PostgreSQL server
docker run --rm -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres:16

# Dbee configuration for the above server
export DBEE_CONNECTIONS='[
    {
        "name": "postgres",
        "url": "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable",
        "type": "postgres"
    }
]'
MattiasMTS commented 7 months ago

Awesome! I'll try and debug this further when I've some free time. Thanks for testing this out @slarse ! 🤜 🤛

MattiasMTS commented 7 months ago

So I gave this a go and I can't reproduce the bug unfortunately. Noteworthy, I'm using a developer version of nvim-dbee (databricks adapter). I'll keep this issue open for a while longer - in case we see other users facing the same issue.

What I did:

  1. start up local postgres version
  2. start writing some sql queries in the scratchpad (with cmp-dbee enabled)
  3. exit nvim-dbee
  4. turn off cmp-dbee
  5. start nvim-dbee again and check if the UI logs are there
  6. repeat process 2-5 for some time and check.

    I've attached a video of the workflow for you to see:

https://github.com/MattiasMTS/cmp-dbee/assets/86059470/da72b0df-a3cc-41c5-a5e7-7b0ec9291886

slarse commented 7 months ago

Thanks for looking into it.

Once I get up to speed with NeoVim plugins, I can try to debug it myself. As it's not reproducible for you, there's probably something in my setup not playing nice with something in cmp-dbee.