From 99a4eafa34450fc94e43e3f0ed4df559a40f9b35 Mon Sep 17 00:00:00 2001 From: Yoni Firroloni Date: Fri, 20 Dec 2024 04:11:18 +0000 Subject: [PATCH] languages/typescript: prevent ts_ls from formatting (#495) * ts_ls: prevent from formatting prevent ts_ls from touching the formating. ts formatting: remove useless indent * fix unnecessary whitespace --------- Co-authored-by: raf --- modules/plugins/languages/ts.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index 8843cc4..2530d35 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -23,8 +23,11 @@ package = pkgs.typescript-language-server; lspConfig = '' lspconfig.ts_ls.setup { - capabilities = capabilities; - on_attach = attach_keymaps, + 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 @@ -79,6 +82,7 @@ ls_sources, null_ls.builtins.formatting.prettier.with({ command = "${cfg.format.package}/bin/prettier", + filetypes = { "typescript" }, }) ) '';