sqls.nvim
sqls.nvim copied to clipboard
Cannot switch database with SqlsSwitchDatabase
Hi,
Thanks for this plugin. Everything is working for me, however I cannot switch databases with :SqlsSwitchDatabase
. After selection the number of the desired database, nothing happens, I don't get any errors or anything but it remains in the same database.
The way I can manage to actually switch databases is by defining another connection in the configuration with another database, and then switching connections instead.
This is my config:
require("lspconfig").sqls.setup({
on_attach = function(client, bufnr)
require("setup.lsp.handlers").on_attach(client, bufnr)
require("sqls").on_attach(client, bufnr)
end,
capabilities = require("setup.lsp.handlers").capabilities,
settings = {
sqls = {
connections = {
{
driver = "postgresql",
dataSourceName = "host=127.0.0.1 port=5432 user=iduran dbname=test",
},
{
driver = "postgresql",
dataSourceName = "host=127.0.0.1 port=5432 user=iduran",
},
},
},
},
})
I can reproduce by manually sending a request to the server:
vim.lsp.buf_request(0, 'workspace/executeCommand', {command = 'switchDatabase', arguments = {'testdb'}}, function() end)
It works with the mysql driver though, so I'm almost sure the problem is either in sqls
or in the postgresql driver
Thanks for letting me know. Feel free to close this issue if you think is not being caused by your plugin then.
connections = {
{
driver = 'postgresql',
dataSourceName = 'postgres://<user>:<password>@localhost/<database_name>?sslmode=disable',
},
},