From b94f5623fa9fc8c60c1195695e3c2a3732b2c729 Mon Sep 17 00:00:00 2001 From: August Raack Date: Tue, 26 May 2026 12:15:32 -0500 Subject: [PATCH] Changing to self contained sqls Community pack uses require("sqls") but the dependency of nanotee/sqls.nvim doesn't have an init.lua and therefore cannot be imported that way. Somehow these two things slipped out of sync. There's nothing too special going on in nanotee/sqls.nvim anyway so this self contained version is good enough. --- src/lua/community.lua | 1 + src/lua/plugins/sqlfluff.lua | 40 ++++++++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/lua/community.lua b/src/lua/community.lua index 122c4e9..9d86734 100644 --- a/src/lua/community.lua +++ b/src/lua/community.lua @@ -5,6 +5,7 @@ ---@type LazySpec return { "AstroNvim/astrocommunity", + -- NOTE: SQL defined in plugins/sqlfluff.lua { import = "astrocommunity.pack.lua" }, { import = "astrocommunity.pack.nix" }, { import = "astrocommunity.pack.python.base" }, diff --git a/src/lua/plugins/sqlfluff.lua b/src/lua/plugins/sqlfluff.lua index 9df1df9..742fbb9 100644 --- a/src/lua/plugins/sqlfluff.lua +++ b/src/lua/plugins/sqlfluff.lua @@ -1,11 +1,42 @@ return { - -- keep the community pack - { import = "astrocommunity.pack.sql" }, + -- Treesitter SQL parser + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "sql" }) + end, + }, + + -- Install sqls via mason + { + "mason-org/mason-lspconfig.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "sqls" }) + end, + }, + + -- Configure sqls LSP (no nanotee/sqls.nvim needed) + { + "AstroNvim/astrolsp", + opts = { + config = { + sqls = { + on_attach = function(client, _) + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + end, + }, + }, + }, + }, - -- none-ls (null-ls fork): make diagnostics/formatting use postgres + -- sqlfluff: postgres dialect { "jay-babu/mason-null-ls.nvim", + optional = true, opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "sqlfluff" }) opts.handlers = opts.handlers or {} opts.handlers.sqlfluff = function() local null_ls = require "null-ls" @@ -19,9 +50,10 @@ return { end, }, - -- Conform: also switch formatter args to postgres + -- Conform: postgres formatter { "stevearc/conform.nvim", + optional = true, opts = { formatters_by_ft = { sql = { "sqlfluff" } }, formatters = {