From 1514eca6226ba23e8a218a70a21030c2c650d966 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 2 Jul 2024 13:08:07 +0200 Subject: [PATCH] nvim: Update to new conform.nvim version Update and fix small breaking change in new conform by specifically setting lsp formatting as fallback. Move to explicit ruff format import organizing and remove tailwind css lsp for the time being. --- nvim/.config/nvim/lazy-lock.json | 2 +- nvim/.config/nvim/lua/plugins/config/lsp.lua | 1 - nvim/.config/nvim/lua/plugins/ide.lua | 40 ++++++++++++++------ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 736fc8c..66a965e 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -23,7 +23,7 @@ "cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" }, - "conform.nvim": { "branch": "master", "commit": "797d1f622a23d4a21bb58218bdf5999a9beac4ef" }, + "conform.nvim": { "branch": "master", "commit": "60e6fbddbdf37d7790de07dc7420beefaf650e5e" }, "dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" }, "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, diff --git a/nvim/.config/nvim/lua/plugins/config/lsp.lua b/nvim/.config/nvim/lua/plugins/config/lsp.lua index b4e3236..6263dfb 100644 --- a/nvim/.config/nvim/lua/plugins/config/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/config/lsp.lua @@ -39,7 +39,6 @@ local servers = { basedpyright = {}, ruff = {}, serve_d = {}, - tailwindcss = {}, taplo = {}, texlab = {}, tsserver = {}, diff --git a/nvim/.config/nvim/lua/plugins/ide.lua b/nvim/.config/nvim/lua/plugins/ide.lua index 3adafec..679c25d 100644 --- a/nvim/.config/nvim/lua/plugins/ide.lua +++ b/nvim/.config/nvim/lua/plugins/ide.lua @@ -16,21 +16,21 @@ local formatters = { astro = { { "prettierd", "prettier" } }, bash = { "shfmt" }, bib = { "bibtex-tidy" }, - css = { { "prettierd", "prettier" } }, + css = { { "prettierd", "prettier" }, "rustywind" }, graphql = { { "prettierd", "prettier" } }, - html = { { "prettierd", "prettier" } }, + html = { { "prettierd", "prettier" }, "rustywind" }, javascript = { { "prettierd", "prettier" } }, javascriptreact = { { "prettierd", "prettier" } }, json = { "jq" }, liquid = { { "prettierd", "prettier" } }, lua = { "stylua" }, markdown = { { "prettierd", "prettier" } }, - python = { "ruff_fix", "ruff_format" }, + python = { "ruff_fix", "ruff_format", "ruff_organize_imports" }, sh = { "shfmt" }, svelte = { { "prettierd", "prettier" } }, typescript = { { "prettierd", "prettier" } }, typescriptreact = { { "prettierd", "prettier" } }, - vue = { { "prettierd", "prettier" } }, + vue = { { "prettierd", "prettier" }, "rustywind" }, yaml = { { "prettierd", "prettier" } }, zsh = { "shfmt" }, } @@ -141,7 +141,7 @@ return { "stevearc/conform.nvim", config = function() require("conform").setup({ - lsp_fallback = true, + lsp_format = "fallback", format_after_save = function(bufnr) if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then return @@ -149,12 +149,6 @@ return { return { lsp_fallback = true } end, formatters_by_ft = formatters, - formatters = { - -- enable python isort functionality - ruff_fix = { - prepend_args = { "--select", "I" }, - }, - }, }) vim.api.nvim_create_user_command("FormatDisable", function(args) if args.bang then @@ -202,7 +196,7 @@ return { end, }, }, - event = { "BufReadPost", "BufNewFile", "BufWritePre" }, + event = { "BufWritePre" }, opts = {}, }, @@ -225,6 +219,28 @@ return { }, }, + -- automatic docstring creation for a variety of languages + { + "danymat/neogen", + dependencies = "nvim-treesitter/nvim-treesitter", + opts = { + snippet_engine = "luasnip", + }, + cmd = { + "Neogen", + }, + keys = { + { + "lg", + function() + require("neogen").generate() + end, + silent = true, + desc = "generate docstring", + }, + }, + }, + -- testing setup { "nvim-neotest/neotest",