From 16e0df81f49906589a349b4a7b82f964d7db87a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Andr=C3=A9=20Damas?= Date: Thu, 27 Mar 2025 12:48:32 +0000 Subject: [PATCH] formating --- .editorconfig | 2 +- lazy-lock.json | 1 + lua/plugins/blink.lua | 2 +- lua/plugins/lsp.lua | 28 ++++++++++++++++++---------- lua/plugins/treesitter.lua | 3 ++- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.editorconfig b/.editorconfig index f202205..9df6296 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,5 @@ trim_trailing_whitespace = true insert_final_newline = true [*.lua] -max_line_length = 80 +max_line_length = 120 align_array_table = false diff --git a/lazy-lock.json b/lazy-lock.json index fba4224..22996c4 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -24,6 +24,7 @@ "output-panel.nvim": { "branch": "main", "commit": "9979f9988acb35fd8e699d8b1fbc7aa17c9d8148" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "render-markdown.nvim": { "branch": "main", "commit": "c91fa46fc8d79f5577beac70a459f30ec17a60c2" }, + "schemastore.nvim": { "branch": "main", "commit": "d307d291f38678d064cb987112926df6d9134de3" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua index 0217b77..47def32 100644 --- a/lua/plugins/blink.lua +++ b/lua/plugins/blink.lua @@ -1,6 +1,6 @@ return { 'saghen/blink.cmp', - dependencies = 'rafamadriz/friendly-snippets', + dependencies = { 'rafamadriz/friendly-snippets' }, version = '*', ---@module 'blink.cmp' diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 3c8e690..b65ab91 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -30,14 +30,17 @@ vim.api.nvim_create_autocmd('LspAttach', { local client = vim.lsp.get_client_by_id(args.data.client_id) if not client then return end - if vim.bo.filetype == "lua" or client.name == "jdtls" then - -- Format the current buffer on save - vim.api.nvim_create_autocmd('BufWritePre', { - buffer = args.buf, - callback = function() - vim.lsp.buf.format({ bufnr = args.buf, id = client.id }) - end, - }) + local LSP_CLIENT_NAMES_FORMAT_ON_SAVE = { "lua_ls", "jdtls" } + for _, client_name_autoformat in ipairs(LSP_CLIENT_NAMES_FORMAT_ON_SAVE) do + if client.name == client_name_autoformat then + -- Format the current buffer on save + vim.api.nvim_create_autocmd('BufWritePre', { + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ bufnr = args.buf, id = client.id }) + end, + }) + end end end, }) @@ -56,7 +59,8 @@ return { tools_to_install = { "lua-language-server", "vtsls", "ruff", "mypy", "black", "pyright", "tailwindcss-language-server", - "eslint-lsp", "lemminx", "gopls" + "eslint-lsp", "lemminx", "gopls", "prettierd", "dotenv-linter", + "editorconfig-checker", "proselint" } }, config = function(_, opts) @@ -82,7 +86,11 @@ return { format_on_save(client, bufnr) end, sources = { - null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.prettierd, + + null_ls.builtins.diagnostics.dotenv_linter, + null_ls.builtins.diagnostics.editorconfig_checker, + null_ls.builtins.diagnostics.proselint }, }) end diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index c5b9373..7d85255 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -21,7 +21,8 @@ return { "html", "jsdoc", "hurl", - "typescript" + "typescript", + "json" }, sync_install = false, highlight = { enable = true },