From 62a5d29f1e25ff821b3622753b4107d13d5984fc Mon Sep 17 00:00:00 2001 From: Rudolf Tucek Date: Tue, 1 Dec 2026 00:13:46 +0100 Subject: [PATCH] nixvim: restrict JS formatter to certain file types The JS prettier formatter performed undesired formatting on yaml and markdown files. As it turns out, this is due to the JS prettier plugin. This can be fixed by limiting prettier only to explicit file types. --- home/neovim/lsp/javascript.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/home/neovim/lsp/javascript.nix b/home/neovim/lsp/javascript.nix index 5170734..314bc22 100644 --- a/home/neovim/lsp/javascript.nix +++ b/home/neovim/lsp/javascript.nix @@ -16,7 +16,23 @@ plugins.none-ls.sources.formatting = { # see https://github.com/prettier/prettier - prettier.enable = true; + prettier = { + enable = true; + # filetypes is explicit: the none-ls default list also includes other fiile types like + # yaml and markdown. + settings.filetypes = [ + "javascript" + "javascriptreact" + "typescript" + "typescriptreact" + "json" + "jsonc" + "css" + "scss" + "less" + "html" + ]; + }; }; }; }