sqls icon indicating copy to clipboard operation
sqls copied to clipboard

"no database connection" on start when configuring by workspace/configuration

Open oblitum opened this issue 3 years ago • 8 comments

Describe the bug A clear and concise description of what the bug is.

I currently use workspace/configuration instead of configuration files and the server is always emitting the "no database connection" error message on start, but the server does works regardless.

To Reproduce Steps to reproduce the behavior:

  1. Use a workspace/configuration config. An example one I use to set coc.nvim in neovim 0.5 is:
    vim.fn['coc#config']('languageserver.sqls', {
        command = 'sqls',
        filetypes = { 'sql' },
        settings = {
            sqls = {
                connections = {
                    {
                        driver = 'postgresql',
                        dataSourceName = 'postgres://postgres@localhost/database?sslmode=disable'
                    }
                }
            }
        }
    })
    

Expected behavior A clear and concise description of what you expected to happen.

I don't expect this message to show up.

Versions (please complete the following information):

  • OS Version: Arch Linux
  • sqls Version sqls Version:0.2.18, Revision:db8733f

Additional context Add any other context about the problem here.

oblitum avatar Jul 11 '21 23:07 oblitum

I'm also having the same issue, however I'm using Neovim's LSP config instead of COC.

waydegg avatar Jun 10 '22 15:06 waydegg

Me too, but I'm using lunarvim. This is the config that I setup with :LspSettings sqls

{
  "settings": {
    "sqls": {
      "connections": [
        {
          "driver": "postgresql",
          "proto": "unix",
          "user": "postgres",
          "passwd": "password",
          "dbName": "omitted"
        },
        {
          "driver": "postgresql",
          "proto": "unix",
          "user": "postgres",
          "passwd": "password",
          "dbName": "omittedAsWell"
        }
      ]
    }
  }
}

cizordj avatar Jul 06 '22 17:07 cizordj

I'm also having the same issue, however I'm using Neovim's LSP config instead of COC.

Me as well. :/

PhilVince96 avatar Aug 30 '22 21:08 PhilVince96

I had the same issue, and I fixed it by setting up the global config. It seems that it ignores all other methods. to fix create the config file on ~/.config/sqls/config.yml:

# Set to true to use lowercase keywords instead of uppercase.
lowercaseKeywords: false
connections:
  - alias: psql
    driver: postgresql
    dataSourceName: 'host=127.0.0.1 port=5432 user=postgres password=secret dbname=testdb sslmode=disable'

Cih2001 avatar Sep 17 '22 15:09 Cih2001

@Cih2001 That's what I ended up doing as well. The good thing though is that we don't save the credentials on VIM config files (which is tracked by git).

cizordj avatar Sep 19 '22 12:09 cizordj

I did that as well but its not working for me, not only is still showing the same error message but also my db settings are not getting picked. I can only use sqls when setting workspace/configuration

SoryEscobar avatar Nov 04 '22 18:11 SoryEscobar

As far as I looked the code of sqls, workspace/didChangeConfiguration should work.

mattn avatar Dec 31 '23 07:12 mattn