fix: astronvim - formatting & diagnostic & code actions

This commit is contained in:
Ryan Yin
2023-07-14 00:53:29 +08:00
parent 298affd460
commit 271846703f
2 changed files with 62 additions and 3 deletions

View File

@@ -65,6 +65,13 @@ return {
},
}
},
{
"ThePrimeagen/refactoring.nvim",
dependencies = {
{"nvim-lua/plenary.nvim"},
{"nvim-treesitter/nvim-treesitter"}
}
},
-- Language Parser for syntax highlighting / indentation / folding / Incremental selection
{
"nvim-treesitter/nvim-treesitter",
@@ -101,6 +108,54 @@ return {
opts.automatic_installation = false
end,
},
{
"jose-elias-alvarez/null-ls.nvim",
opts = function(_, opts)
local null_ls = require "null-ls"
local code_actions = null_ls.builtins.code_actions
local diagnostics = null_ls.builtins.diagnostics
local formatting = null_ls.builtins.formatting
local hover = null_ls.builtins.hover
local completion = null_ls.builtins.completion
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
if type(opts.sources) == "table" then
vim.list_extend(opts.sources, {
-- Common Code Actions
code_actions.gitsigns,
-- common refactoring actions based off the Refactoring book by Martin Fowler
code_actions.refactoring,
code_actions.gomodifytags, -- Go - modify struct field tags
code_actions.impl, -- Go - generate interface method stubs
code_actions.shellcheck,
code_actions.proselint, -- English prose linter
-- Completion
completion.luasnip,
-- Diagnostic
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
diagnostics.buf, -- check text in current buffer
diagnostics.checkmake, -- check Makefiles
-- Formatting
formatting.prettier, -- js/ts/vue/css/html/json/... formatter
diagnostics.hadolint, -- Dockerfile linter
formatting.black, -- Python formatter
formatting.ruff, -- extremely fast Python linter
formatting.goimports, -- Go formatter
formatting.shfmt, -- Shell formatter
formatting.rustfmt, -- Rust formatter
formatting.taplo, -- TOML formatter
formatting.terraform_fmt, -- Terraform formatter
formatting.stylua, -- Lua formatter
formatting.sqlfluff.with({ -- SQL formatter
extra_args = { "--dialect", "postgres" }, -- change to your dialect
}),
formatting.nginx_beautifier, -- Nginx formatter
})
end
end,
},
-- Debugger installationl
{
"jay-babu/mason-nvim-dap.nvim",

View File

@@ -83,6 +83,7 @@
cmake
cmake-language-server
gnumake
checkmake
gcc # c/c++ compiler, required by nvim-treesitter!
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
gdb
@@ -111,6 +112,7 @@
#-- golang
go
gomodifytags
iferr # generate error handling code for go
impl # generate function implementation for go
gotools # contains tools like: godoc, goimports, etc.
@@ -118,10 +120,7 @@
delve # go debugger
#-- lua
luajit
stylua
luajitPackages.luarocks
luajitPackages.luacheck
lua-language-server
#-- bash
@@ -142,10 +141,15 @@
terraform-ls
jsonnet
jsonnet-language-server
hadolint # Dockerfile linter
#-- Others
taplo # TOML language server / formatter / validator
nodePackages.yaml-language-server
sqlfluff # SQL linter
actionlint # GitHub Actions linter
buf # protoc plugin for linting and formatting
proselint # English prose linter
#-- Misc
tree-sitter # common language parser/highlighter