From 53e82142f343e189f3c06bf1dbdf423b23d3df76 Mon Sep 17 00:00:00 2001 From: asif Date: Tue, 3 Jun 2025 12:25:29 +0530 Subject: [PATCH] added lsp server settings for typescript and eslint --- nvim/.config/nvim/lua/plugins/lsp.lua | 49 +++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index 4be4bf2..7eab03b 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -67,6 +67,52 @@ local servers = { }, }, }, + ts_ls = { + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + }, + }, + completions = { + completeFunctionCalls = true, + }, + }, + capabilities = { + documentFormattingProvider = false, + }, + }, + eslint = { + settings = { + format = false, + codeAction = { + disableRuleComment = { + enable = true, + location = "separateLine", + }, + showDocumentation = { + enable = true, + }, + }, + packageManager = "npm", + onIgnoredFiles = "off", + }, + on_attach = function(client, bufnr) + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = bufnr, + command = "EslintFixAll", + }) + end, + }, } local ensure_installed = vim.tbl_keys(servers or {}) @@ -81,9 +127,6 @@ require("mason-lspconfig").setup({ function(server_name) local server = servers[server_name] or {} server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) - if server_name == "jdtls" then - require("java").setup() - end require("lspconfig")[server_name].setup(server) end, },