Updated ts_ls

This commit is contained in:
2024-10-20 17:41:20 +02:00
parent 45f7e9323e
commit 8d8a9a7e36

View File

@@ -11,7 +11,6 @@ return {
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
config = function() config = function()
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local typescript_tools = require("typescript-tools")
local tserrortranslator = require("ts-error-translator") local tserrortranslator = require("ts-error-translator")
local cmp_nvim_lsp = require("cmp_nvim_lsp") local cmp_nvim_lsp = require("cmp_nvim_lsp")
@@ -34,7 +33,6 @@ return {
"eslint", "eslint",
"bashls", "bashls",
"tailwindcss", "tailwindcss",
"ts_ls",
} }
for _, lsp in ipairs(defaultLsps) do for _, lsp in ipairs(defaultLsps) do
@@ -69,36 +67,13 @@ return {
}, },
}) })
-- powershell -- typescript
lspconfig["powershell_es"].setup({ lspconfig["ts_ls"].setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = on_attach, on_attach = on_attach,
bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services",
})
-- typescript tools
-- local cwd = vim.fn.getcwd()
-- local tsserver_path = cwd .. "/node_modules/.bin/tsserver"
--
-- local cmd = ""
-- if vim.loop.fs_stat(tsserver_path) then
-- cmd = tsserver_path
-- else
-- cmd = "typescript-language-server"
-- end
--[[ typescript_tools.setup({
capabilities = capabilities,
-- on_attach = function(client, bufnr)
-- on_attach(client, bufnr)
-- if cmd == "typescript-language-server" then
-- vim.notify("Using global tsserver")
-- end
-- end,
on_attach = on_attach,
settings = { settings = {
-- cmd = { cmd, "--stdio" }, typescript = {
tsserver_file_preferences = { inlayHints = {
includeInlayParameterNameHints = "all", includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = true, includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true, includeInlayFunctionParameterTypeHints = true,
@@ -107,10 +82,29 @@ return {
includeInlayPropertyDeclarationTypeHints = true, includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true, includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true, includeInlayEnumMemberValueHints = true,
quotePreference = "auto",
}, },
}, },
}) ]] javascript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
})
-- powershell
lspconfig["powershell_es"].setup({
capabilities = capabilities,
on_attach = on_attach,
bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services",
})
tserrortranslator.setup() tserrortranslator.setup()
end, end,