From fbee50f036f80e537bf3f5e6a180c451555e0d6d Mon Sep 17 00:00:00 2001 From: Yoni FIRROLONI Date: Thu, 12 Dec 2024 22:11:55 +1100 Subject: [PATCH 1/2] ts_ls: prevent from formatting prevent ts_ls from touching the formating. --- modules/plugins/languages/ts.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index 8843cc46..e72a8796 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -22,10 +22,16 @@ ts_ls = { package = pkgs.typescript-language-server; lspConfig = '' - lspconfig.ts_ls.setup { - capabilities = capabilities; - on_attach = attach_keymaps, - cmd = ${ + + lspconfig.ts_ls.setup { + capabilities = capabilities; + on_attach = ( + function (client, bufnr) + attach_keymaps(client, bufnr); + client.server_capabilities.documentFormattingProvider = false; + end + ) , + cmd = ${ if isList cfg.lsp.package then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}'' @@ -79,6 +85,7 @@ ls_sources, null_ls.builtins.formatting.prettier.with({ command = "${cfg.format.package}/bin/prettier", + filetypes = { "typescript" }, }) ) ''; From 114b9b41214c4204b69d06c327f472e2ce300f07 Mon Sep 17 00:00:00 2001 From: Yoni FIRROLONI Date: Mon, 16 Dec 2024 09:28:29 +1100 Subject: [PATCH 2/2] ts formatting: remove useless indent --- modules/plugins/languages/ts.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index e72a8796..b3e04702 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -85,7 +85,7 @@ ls_sources, null_ls.builtins.formatting.prettier.with({ command = "${cfg.format.package}/bin/prettier", - filetypes = { "typescript" }, + filetypes = { "typescript" }, }) ) '';