From bc5635c1f5b846d08d2b9057dc278445b9d0dc5a Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 21 Oct 2024 14:59:17 -0300 Subject: [PATCH] feat(neovim): drop prettierd in favor of deno fmt --- .../home-manager/programs/neovim/default.nix | 4 +-- .../programs/neovim/lua/plugins/none-ls.lua | 31 ++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/modules/home-manager/programs/neovim/default.nix b/modules/home-manager/programs/neovim/default.nix index ead6e7a..c3838ab 100644 --- a/modules/home-manager/programs/neovim/default.nix +++ b/modules/home-manager/programs/neovim/default.nix @@ -74,7 +74,6 @@ in # Markdown markdownlint-cli marksman - prettierd # Nix nixd @@ -85,7 +84,8 @@ in python312Packages.flake8 ruff - # TypeScript + # TypeScript/JavaScript + deno typescript-language-server # Rust diff --git a/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua b/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua index 3f13da4..824f270 100644 --- a/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua +++ b/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua @@ -9,6 +9,35 @@ return { opts = function(_, config) -- config variable is the default configuration table for the setup function call local null_ls = require("null-ls") + local helpers = require("null-ls.helpers") + + local deno_fmt = helpers.make_builtin({ + name = "deno_fmt", + filetypes = { + "angular", + "astro", + "css", + "html", + "javascript", + "json", + "jsonc", + "less", + "markdown", + "sass", + "scss", + "svelte", + "typescript", + "vue", + "yaml", + }, + method = { null_ls.methods.FORMATTING }, + generator_opts = { + command = "deno", + args = { "fmt", "--unstable-component", "-" }, + to_stdin = true, + }, + factory = helpers.formatter_factory, + }) -- Check supported formatters and linters -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting @@ -20,8 +49,8 @@ return { null_ls.builtins.formatting.clang_format, null_ls.builtins.formatting.csharpier, null_ls.builtins.formatting.nixfmt, - null_ls.builtins.formatting.prettier, null_ls.builtins.formatting.stylua, + deno_fmt, } return config -- return final config table end,