AstroNvim / AstroNvim/astrocommunity

Is the SQL pack broken or it's just me?

Open
#1,794 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Lua
Stars
1.7k
Forks
313
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [x] I have searched through the AstroNvim documentation
- [x] I have searched through the existing issues of this project
- [x] I have searched the existing issues of plugins related to this issue
- [x] I can replicate the bug with the minimal `repro.lua` provided below

### Neovim version (nvim -v)

NVIM v0.12.4

### Operating system/version

Arch Linux (linux 7.1.5.arch1-2)

### Terminal/GUI

st

### Describe the bug

- it outputs the stack trace each time I open a SQL file
- it reports that sqls module is not found
- it says that it's missing a connection to a database, but I just want to edit my schema or queries
- it freezes for a few seconds on save before giving up formatting

### Steps to Reproduce

To reproduce this bug, follow these steps:

1. Run `nvim -u repro.lua queries.sql`
2. Let Mason install sqls
3. Watch the error consistently appear on screen each time you open a SQL buffer

[queries.sql](https://github.com/user-attachments/files/30540962/queries.sql)

### Expected behavior

In the current state the pack doesn't provide a good user exeperience. Therefore, the expected behavior I'd say is "get the pack to a working state".

### Screenshots

(download the stack trace if you just want to see the errors.)

[stacktrace.txt](https://github.com/user-attachments/files/30540858/stacktrace.txt)

### Additional Context

In case this is not a bug and I'm doing something wrong, first I apologize. Second, I need the help of someone who understands how to use sqls. I'm tired of it getting in my way of editing SQL code.

### Minimal configuration

```Lua
-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

-- install plugins
local plugins = {
{ "AstroNvim/AstroNvim", import = "astronvim.plugins" },
{ "AstroNvim/astrocommunity", { import = "astrocommunity.pack.sql" } },

-- add any other plugins/customizations here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})

-- add anything else here (autocommands, vim.filetype, etc.)
```

Contributor guide

Open the contributing guide

Research direction

Start with repro.lua and the SQL pack entry point imported as astrocommunity.pack.sql, then run the reproduction and review stacktrace.txt while opening and saving queries.sql. Done means the pack no longer produces the reported stack trace, missing-module or database-connection errors, and saving the SQL buffer does not freeze while formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim, sql
Domain
databases, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.