feat: complete LSP and formatter configuration

- Add missing LSPs: lua_ls, bashls, yamlls, jsonls, marksman, taplo, sqls
  - Add missing formatters: prettier, shfmt, sqlfluff, cmake_format
  - Configure ruff with import organization and auto-fixes
  - Tune basedpyright to reduce diagnostic noise (basic mode)

  All LSPs verified attaching and formatters working correctly.
This commit is contained in:
dlond 2025-10-08 23:10:35 +13:00
parent 611ed89f33
commit 647b352970
3 changed files with 93 additions and 39 deletions

View file

@ -1,40 +1,40 @@
-- Formatter configuration
return {
-- ========================================
-- Formatter Configuration (conform.nvim)
-- ========================================
{
'stevearc/conform.nvim',
event = 'BufWritePre', -- Format on save
-- cmd = { 'ConformInfo' }, -- Optional: If you want the command available
-- keys = { ... } -- Optional: Define keys if needed
opts = {
formatters_by_ft = {
lua = { 'stylua' },
c = { 'clang_format' },
cpp = { 'clang_format' },
-- Use ruff for Python formatting (includes isort and is faster than black
-- Ensure 'ruff' is installed via Home Manager (pkgs.ruff)
python = { 'ruff_format', 'ruff_fix' },
-- python = { 'isort', 'black' },
nix = { 'alejandra' }, -- Add nix formatter
-- Add other filetypes and formatters, e.g.:
-- javascript = { "prettier" },
-- typescript = { "prettier" },
-- css = { "prettier" },
-- html = { "prettier" },
-- json = { "prettier" },
-- yaml = { "prettier" },
-- markdown = { "prettier" },
-- bash = { "shfmt" },
},
-- Configure format_on_save behavior
format_on_save = {
-- I recommend these options, but adjust to your liking
timeout_ms = 500, -- Stop formatting if it takes too long
lsp_fallback = true, -- Fallback to LSP formatting if conform fails
},
},
-- ========================================
-- Formatter Configuration (conform.nvim)
-- ========================================
{
'stevearc/conform.nvim',
event = 'BufWritePre', -- Format on save
-- cmd = { 'ConformInfo' }, -- Optional: If you want the command available
-- keys = { ... } -- Optional: Define keys if needed
opts = {
formatters_by_ft = {
lua = { 'stylua' },
c = { 'clang_format' },
cpp = { 'clang_format' },
python = { 'ruff_organize_imports', 'ruff_format', 'ruff_fix' },
nix = { 'alejandra' }, -- Add nix formatter
-- Add other filetypes and formatters, e.g.:
javascript = { 'prettier' },
typescript = { 'prettier' },
css = { 'prettier' },
html = { 'prettier' },
json = { 'prettier' },
yaml = { 'prettier' },
markdown = { 'prettier' },
bash = { 'shfmt' },
sh = { 'shfmt' },
cmake = { 'cmake_format' },
sql = { 'sqlfluff' },
},
-- Configure format_on_save behavior
format_on_save = {
-- I recommend these options, but adjust to your liking
timeout_ms = 500, -- Stop formatting if it takes too long
lsp_fallback = true, -- Fallback to LSP formatting if conform fails
},
},
},
}